VideohatiDocs
API referencePlayback

Create a playback session

Create a playback session

POST/v1/playback/sessions

This operation supports dashboard session-cookie authentication. Call it only from trusted server code; browsers must not manufacture or expose the session cookie.

Server-side call: never expose your API key to the browser. Returns a signed manifestUrl, a sessionToken for the player, and a watermarkToken. The video must have at least one playable rendition. Requires an API key with read scope, or session-cookie auth plus projectId. Rate limit: 30 requests per 60 s per caller.

Error codes: unauthorized (401), insufficient_scope (403), account_not_approved (403), invalid_project_id (400), not_found (404), video_not_found (404), video_not_playable (409), invalid_body (400).

Authentication

  • apiKey — Project API key: Authorization: Bearer vh_live_... (live mode) or Authorization: Bearer vh_test_... (test mode). Keys carry read and/or write scopes.
  • sessionCookie — Dashboard session cookie set by POST /v1/auth/login. Video and playback endpoints additionally require the projectId query parameter under cookie auth.

Parameters

NameInTypeRequiredDescription
projectIdquerystring (Ulid)NoRequired when authenticating with the session cookie; ignored under API-key auth (the key is already project-scoped).

Request body

required

Content type: application/json

Schema: PlaybackSessionCreateRequest

{
  "videoId": "01JZ9WV3N8GQ5T2M7K4C6XBARH",
  "ttlSeconds": 3600,
  "watermarkText": "Ahmed K."
}

Responses

StatusMeaning
201Playback session created.
400The request body or query failed validation. The per-operation description lists the exact error.code values.
401No valid credential was presented.
403The credential is valid but does not permit this action. The per-operation description lists the exact error.code values.
404The resource does not exist or is not visible to this caller.
409The request conflicts with the resource's current state. The per-operation description lists the exact error.code values.
429Rate limit exceeded.

Example request

{
  "videoId": "01JZ9WV3N8GQ5T2M7K4C6XBARH",
  "ttlSeconds": 3600,
  "watermarkText": "Ahmed K."
}

Try it

POST
/v1/playback/sessions
Test mode only

API playground

Send a live request to api.videohati.com with a test-mode key.

This playground blocks vh_live_ keys. Use a key that starts with vh_test_ only; a request with a live key never leaves your browser.

The key is stored in your browser on docs.videohati.com only.

Required when authenticating with the session cookie; ignored under API-key auth (the key is already project-scoped).

https://api.staging.videohati.com/v1/playback/sessions