Test mode (pk_test_* keys)
The API recognises a key that starts with pk_test_ as a test key and says so on every response. That is all test mode does today: a test key reaches the same data, the same workers and the same Stripe account as a live key.
Current state. Keys created in the dashboard or with
POST /me/api-keys are always pk_ followed by 40 hex characters; there is no way to create a pk_test_ key yourself. Under any key, POST /checkout/* uses the platform's Stripe account, which is live in production — a checkout completed there is a real charge. Do not use real cards when testing checkout.Key format and mode
| Key | Mode reported | Where it comes from |
|---|---|---|
pk_<40 hex> | live | Every key you create (dashboard, POST /me/api-keys). |
pk_test_<hex> | test | Not issued to accounts today. |
Detecting mode on a response
Every authenticated response carries:
Dcast-Key-Mode: live (or) Dcast-Key-Mode: testAnd GET /me returns the same value in data.mode:
{
"success": true,
"data": {
"keyId": "...",
"keyName": "my-key",
"mode": "live",
...
}
}What a test key changes today
| Aspect | Behaviour under a pk_test_ key |
|---|---|
| Authentication, scopes, rate limits | Same as a live key. |
| Idempotency-Key | Honoured; the cache is per key, so it never collides with another key. |
Stripe checkout (POST /checkout/*) | Same platform Stripe account as a live key — live in production. |
| Uploads, streams, restreams, rooms | Same routes, same data, same workers as a live key. |
| Webhooks | Same delivery. The envelope livemode field comes from the server environment, not from the key, so production deliveries say livemode: true. |
Recommended practice
- Use a separate DCAST account for development and CI, with its own keys, videos and webhook endpoints.
- Register a different webhook URL for that account so test events never reach your production receiver.
- Read
data.modefromGET /me(or theDcast-Key-Modeheader) in your health check if you want to assert which key an environment is using.
Not implemented
Issuing pk_test_ keys to accounts, Stripe test mode under test keys, a sandbox for uploads and streams, and livemode tied to the key are not implemented. See Roadmap.
