Skip to content

docs: rewrite the SDK page, fix realtime auth and inputs claims - #48

Merged
a-essawy merged 1 commit into
mainfrom
docs/sdk-page-rewrite
Jul 21, 2026
Merged

docs: rewrite the SDK page, fix realtime auth and inputs claims#48
a-essawy merged 1 commit into
mainfrom
docs/sdk-page-rewrite

Conversation

@a-essawy

Copy link
Copy Markdown
Contributor

Two claims on the live page were wrong, both verified against production with a live API key.

Realtime. The page warned that realtime needs session-cookie auth and that API-key users must poll. The SDK appends the key as ?token= and apps/api/src/routes/events-ws.ts authenticates it. Live check: WS upgraded and streamed 18 events for a running job.

Uploads. The example passed inputs: { source: asset.url } and referenced {source} in the command. No placeholder substitution exists. inputs keys are filenames staged in the working directory and referenced by bare name, so the example could not work as written.

Other changes:

  • Output type block and error-code list removed, now linked to /concepts/job and /support/errors instead of restated in two places.
  • Adds WaitTimeoutError, JobFailedError, throwOnFailure, jobs.stats, and the client attribution option, all shipped in 4.x and previously undocumented.
  • "Ships ESM" corrected: the package also ships CommonJS.
  • One mermaid diagram for the create then poll-or-push then outcome path.
  • Drops jobs.getTimings from the page. It works, but it exposes internal pipeline stages (queue wait, consumer, DB insert) that callers shouldn't build against.
  • Prose down from roughly 1000 words to 700.

Test plan

Two probe scripts run against production with a real key, non-destructive (self-expiring assets, own jobs, a webhook endpoint created and deleted in the same run):

  • probe-sdk-live.mjs: 21/21. Upload to job to signed output URL fetched at 200, logs, download, cancel, realtime WS over an API key, webhook signature accept plus tampered and stale rejects.
  • probe-sdk-rest.mjs: 18/18. Webhook endpoint lifecycle, idempotency key dedupe, persisted upload and delete, ffprobe jobData, HLS output where outputUrl returns the .m3u8 across 3 files, timeout, orgId, baseUrl.

mint broken-links clean for this page. Frontmatter and plan-limit validators pass.

The realtime section said API keys can't stream and that only cookie auth
works. The SDK appends the key as a ?token= query param and the API
authenticates it, so the warning sent API-key users to polling for no
reason. Verified against production.

The uploads example passed inputs as { source } and referenced {source}
in the command. There is no placeholder substitution: inputs keys are
filenames staged in the working directory, referenced by bare name, so
that example never worked.

Also: the output type block duplicated /concepts/job and the error code
list duplicated /support/errors, both now linked instead of restated.
Adds the wait errors and options shipped in 4.x (WaitTimeoutError,
JobFailedError, throwOnFailure), the client attribution option, and a
diagram of the create/poll-or-push/outcome path. Drops getTimings, which
exposes internal pipeline stages we don't want callers depending on.
@a-essawy
a-essawy merged commit 33086d3 into main Jul 21, 2026
1 check passed
@a-essawy
a-essawy deleted the docs/sdk-page-rewrite branch July 21, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant