SDK reference
Server API
Publish guides kept as JSON in your repository, delete or reset a user's data and keep Studio clips up to date from CI, with a secret key.
The server API uses an environment's secret key (ps_sec_…) and acts on that environment only. Keep secret keys on your servers and in CI secrets, never in client code.
curl https://api.playstep.app/v1/server/guides \
-H "Authorization: Bearer $PLAYSTEP_SECRET_KEY" \
-H "Content-Type: application/json" \
-d @guides.json
Publish guides
POST /v1/server/guides validates each guide against the guide spec, saves a new version when it changed, and publishes it. The body is an array of guides or { "guides": [...] }. A guide's spec_version must be at least what its steps need: 2 for steps found by selector, 3 for page steps or skip_if_on.
{ "published": [{ "id": "create-first-invoice", "version": 4 }] }
Invalid guides return 400 with the problems:
{ "error": "invalid", "issues": [{ "path": ["guides", 0, "steps", 1, "anchor"], "message": "A step that completes on tap needs an anchor" }] }
From the monorepo you can run the same thing with:
PLAYSTEP_SECRET_KEY=ps_sec_dev_… pnpm --filter @playstep/api guides:publish guides/onboarding.json
Unpublish a guide
DELETE /v1/server/guides/:id takes the guide out of this environment. Its versions stay in the dashboard.
Delete a user's data
POST /v1/server/users/delete deletes one end user's analytics events and their guide progress, by the id you passed to identify. The id goes in the body, never the URL:
curl -X POST https://api.playstep.app/v1/server/users/delete \
-H "Authorization: Bearer $PLAYSTEP_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "user_id": "user_123" }'
{ "deleted": 42 }
deleted is the number of events deleted. The SDKs file a signed-in user's events under u_ and the first 40 hex digits of the SHA-256 of <publishable key>:<user id>, so the same person has a different key in each environment and after each key rotation. This call tries every publishable key the app has had, in both environments, rotated-out keys included, whichever environment's secret key you use.
DELETE /v1/server/users/:userKey still deletes by the key itself: a u_… key as above, or an anonymous device's d_… key. It answers { "deleted": n } too (before, an empty 204), so a key that matched nothing shows as 0.
Billing counts keep only the hashed key for the current period. See data deletion.
A user's guide progress
For a signed-in user, PlayStep keeps their guide progress on the server, so a guide finished on one device does not start again on another (SDK 0.10+; see triggers). Two calls help with support. Both act on the secret key's environment.
POST /v1/server/users/progress with { "user_id": "user_123" } answers what their devices share, or null before their first guide:
{
"progress": {
"seen": true,
"guides": { "create-first-invoice": { "version": 4, "step": 2, "status": "done", "source": "trigger" } },
"reset": []
}
}
status is running, done or dismissed, and step is the step they are on, counting from 0. reset lists guides reset with the call below that their devices have not picked up yet.
POST /v1/server/users/progress/reset with { "user_id": "user_123", "guide_id": "create-first-invoice" } lets that guide start again for them, or every guide without guide_id. Each of their devices applies it on its next page load or launch. It answers the guides it reset:
{ "reset": ["create-first-invoice"] }
Studio clips from CI
/v1/server/studio is what playstep record uses to record
guide clips in CI. It is part of Pro (other plans get 402). You rarely call it yourself, but it is plain HTTP:
| Route | What it does |
|---|---|
GET /v1/server/studio/guides | The app's guides; each step says whether it has a clip and whether its anchor went missing in this environment (stale) |
GET /v1/server/studio/guides/:guide | A guide's draft, its recording notes and its revision |
POST /v1/server/studio/script | Fill with AI for { "guide": "<slug>", "platform": "web" }, in AI credits |
POST /v1/server/studio/clips | Upload a finished clip: the MP4 as the body (Content-Type: video/mp4, up to 20 MB), its name URL-encoded in x-clip-name and its length in x-clip-duration-ms. It counts against your plan's stored clips |
PUT /v1/server/studio/clips/:clip/poster | The clip's poster frame (image/jpeg, up to 2 MB) |
POST /v1/server/studio/guides/:guide/clips | { "clips": { "<step id>": <clip> } } sets those steps' clips in the draft and leaves the rest of it as it is |
Clips are made on your machine and only the finished files are uploaded. Publish the guide to show them.
Referrals
What your server says about where a user came from is trusted: it overrides what a browser reported (the Referrals add-on), and it confirms the user, so commissions that wait for a confirmation can be approved.
POST /v1/server/referrals/attribution records who referred a user. Send the user's id in your app (userId, hashed
on our side) or the u_… key, and what they came with: the ps_ref click id your signup page received, a promo
code they typed, or a link's readable ref. Add email and PlayStep keeps only its hash, to stop partners
referring themselves.
curl -X POST https://api.playstep.app/v1/server/referrals/attribution \
-H "Authorization: Bearer $PLAYSTEP_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "userId": "user_123", "code": "ALICE20", "email": "jane@example.com" }'
{ "credited": true, "flags": [] }
credited says whether a partner has credit for this user now. A click id counts once, for one user, inside its
program's attribution window, and only for the app its link belongs to; flags says why one didn't count (expired,
claimed, other_app, self_referral).
POST /v1/server/referrals/conversions records what a user did, for billing PlayStep doesn't read (connect Stripe or
Paddle Billing in Referrals › Billing and you needn't send payments yourself), or a signup or activation you'd rather
report from your server. id is yours, such as an invoice id: sending the same one again records nothing. Amounts
are in the currency's smallest unit (cents), before tax. A refund or chargeback names the payment it reverses.
curl -X POST https://api.playstep.app/v1/server/referrals/conversions \
-H "Authorization: Bearer $PLAYSTEP_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "id": "inv_1042", "kind": "paid", "userId": "user_123", "amount": 4900, "currency": "USD", "product": "pro" }'
{ "recorded": true, "credited": true, "commissions": 1 }
| Field | What |
|---|---|
id | Your id for it. Required. |
kind | signup, activation, paid (a first or one-off payment), renewal, refund or chargeback. |
userId, userKey or email | Who. An email is matched by its hash to the user who came with it. |
amount, currency | Required for payments, refunds and chargebacks. |
product | Your plan or product id, for programs that pay only on some. |
reverses | For refunds and chargebacks: the id of the payment. |
occurredAt | When it happened (epoch ms or ISO 8601). Default: now. |
credited says whether a partner gets credit for it: the user's partner touch must come before it (a few minutes
after counts too), so customers who paid before a partner reached them earn nobody anything. Commissions follow the
program's rules and wait out its hold period. Refunds take back a share of what the payment earned, never more.
Reporting a user from your server also confirms them, so commissions that wait for a confirmation can be approved.
POST /v1/server/referrals/users/link { "user_id": "…" } answers a user's own friend link and code, for your app or
emails, creating them the first time. It is 404 when the app has no friend referral program.
{ "link": "https://go.playstep.app/f-3k9x2m7q1a", "code": "K3X9M2Q1" }
Deleting a user also deletes where they came from. Commissions and payouts stay, without the user, because your accounts need them.