Create a content
Code Mode: praxis.content.contents.create
HTTP: POST /content/v1/contents
Create a video content from one asset of a Media library, before publishing it to end users. Send library_id and asset_id from praxis.media (assets.create, assets.list or the asset you uploaded return them); the create pins asset_version (default 1) and immediately asks Media to transcode the wanted renditions, so the content reports readiness processing until they are ready. kind is video, the only kind today. settings is optional and its four groups are merged over the service defaults: source (library_id and asset_id required, asset_version 1, follow_new_versions false, renditions 480/720/1080), access (capability_seconds 600 within 100 to 3000, encryption false, allowed_origins empty), player (poster null, show_title true, accent_color null, default_quality auto, speeds 0.75/1/1.25/1.5/2, storyboard true, autoplay false, remember_position true) and description (at most 2000 characters). An unknown field — including mode, which was removed because a content is always signed — is refused by name with 400. Returns the new content with HTTP 201; save its id for publish, versions and playback calls.
Signature
praxis.content.contents.create(args:{body:{/** Content kind to create; video is the only kind today. */ kind:"video";/** Merchant-facing title for the content, a non-empty string. */ title:string;/** Initial settings; each group left out keeps its service default. */ settings?:{/** The Media asset to publish; library_id and asset_id are required on a create. */ source:{/** Media library id (lib_…) holding the asset; required on a create. */ library_id:string;/** Media asset id (ast_…) to publish; required on a create. */ asset_id:string;/** Version of that asset to pin; defaults to 1. */ asset_version?:number;/** Whether a playback follows the asset newest version; defaults to false. */ follow_new_versions?:boolean;/** Output heights to transcode now, each one of 480, 720 or 1080 with no repeat; defaults to 480, 720 and 1080. */ renditions?:Array<480|720|1080>};/** Initial access settings; capability_seconds defaults to 600, encryption to false and allowed_origins to empty. */ access?:{/** Lifetime of each playback capability in seconds, from 100 to 3000. */ capability_seconds?:number;/** Whether the delivered renditions are encrypted. */ encryption?:boolean;/** Page origins allowed to open a playback, at most 20 canonical https origins; send an empty list to allow any origin. */ allowed_origins?:Array<string>};/** Initial player settings; each field left out keeps its default. */ player?:{/** Poster image URL shown before playback starts; null by default. */ poster?:string|null;/** Whether the player shows the content title; true by default, and when false the playback title is null. */ show_title?:boolean;/** Player accent colour as */ accent_color?:string|null;/** Quality the player starts with; auto by default, or one output height that this content actually has, one of 480, 720 or 1080. e.g. "auto" */ default_quality?:"auto"|480|720|1080;/** Playback speeds the player offers, each between 0.25 and 4 and the list must contain 1; defaults to 0.75, 1, 1.25, 1.5 and 2. */ speeds?:Array<number>;/** Whether the player shows storyboard previews while scrubbing; true by default. */ storyboard?:boolean;/** Whether the player starts playing without a click; false by default. */ autoplay?:boolean;/** Whether the player resumes at the position the end user left; true by default. */ remember_position?:boolean};/** Initial free text about the content, at most 2000 characters. */ description?:string}}}):Promise<{/** Object type, always content. */ type?:"content";/** Content id (cnt_…) that every read, write and playback call on this content takes. */ id?:string;/** Content kind; video is the only kind today. */ kind?:"video";/** Merchant-facing title, set on create or update and shown by the Kit player when show_title is true. */ title?:string;/** Publication state: draft before the first publish, published while a version is live, unpublished after an unpublish, archived after an archive and final in tha */ status?:"draft"|"published"|"unpublished"|"archived";/** Version number a playback plays, or null when nothing is live (draft or unpublished). */ live_version?:number|null;/** Highest version number, made by each settings save; publish with no version pins this one. */ latest_version?:number;/** Whether Media has every wanted rendition of the pinned asset version: processing while transcoding starts or is running, ready when a publish can go live, faile */ readiness?:"processing"|"ready"|"failed";/** The settings of the latest version, as this read returns them. */ settings?:{/** The asset this content publishes and how it follows it. */ source?:{/** Media library id (lib_…) holding the asset, from praxis.media. */ library_id?:string;/** Media asset id (ast_…) to publish, from praxis.media. */ asset_id?:string;/** Version of that asset this content pins; defaults to 1 and is used unless follow_new_versions is true. */ asset_version?:number;/** Whether a playback follows the asset newest version instead of pinning asset_version; false by default. */ follow_new_versions?:boolean;/** Output heights wanted from Media, one of 480, 720 or 1080 each and no repeat; defaults to 480, 720 and 1080, and a change asks Media to transcode what is missin */ renditions?:Array<480|720|1080>};/** How a playback is authorized; a playback reads this group from the latest version, so a change takes effect at once. */ access?:{/** Lifetime of each playback capability in seconds, from 100 to 3000; defaults to 600 and a capability never outlives the 3000 second ceiling. */ capability_seconds?:number;/** Whether the delivered renditions are encrypted; false by default. */ encryption?:boolean;/** Page origins allowed to open a playback, for example https://school.example.com, at most 20 entries; each must be a canonical https origin (http://localhost is */ allowed_origins?:Array<string>};/** How the Kit renders the player; a playback reads this group from the live version. */ player?:{/** Poster image URL shown before playback starts; null by default. */ poster?:string|null;/** Whether the player shows the content title; true by default, and when false the playback title is null. */ show_title?:boolean;/** Player accent colour as */ accent_color?:string|null;/** Quality the player starts with; auto by default, or one output height that this content actually has, one of 480, 720 or 1080. e.g. "auto" */ default_quality?:"auto"|480|720|1080;/** Playback speeds the player offers, each between 0.25 and 4 and the list must contain 1; defaults to 0.75, 1, 1.25, 1.5 and 2. */ speeds?:Array<number>;/** Whether the player shows storyboard previews while scrubbing; true by default. */ storyboard?:boolean;/** Whether the player starts playing without a click; false by default. */ autoplay?:boolean;/** Whether the player resumes at the position the end user left; true by default. */ remember_position?:boolean};/** Free text about the content, at most 2000 characters; empty by default. */ description?:string};/** RFC 3339 time the content was created. */ create_time?:string;/** RFC 3339 time of the last change; list results are ordered by it, newest first. */ update_time?:string;/** RFC 3339 time of the first publish, or null for a content never published. */ publish_time?:string|null;/** RFC 3339 time the content was archived, or null while it is not archived. */ archive_time?:string|null}>;Request body
| Required | Content types | Description |
|---|---|---|
| yes | application/json | The content to create, with the library asset it publishes and any settings that differ from the defaults. |
Responses
| Status | Content types | Description |
|---|---|---|
| 201 | application/json | The new content; its id is the handle for every later content call and its readiness starts as processing. |
| 400 | application/json | INVALID_PARAMS: the request is not shaped the way this face accepts — an unknown or misspelled field, a repeated query parameter, a value outside its allowed range (for example capability_seconds outside 100 to 3000 or a rendition other than 480, 720 or 1080), or a body that is not a JSON object. The error names the field at fault and what it accepts; correct that field and send the request again. |
| 401 | application/json | The credential is missing, malformed or expired. Merchant routes answer UNAUTHENTICATED when the API key or session names no organization; the playback door answers ACCESS_TOKEN_EXPIRED when the end-user token cannot be verified and SIGN_IN_EXPIRED or SIGN_IN_REVOKED when the sign-in behind it is over. Send a valid API key, or sign the end user in again for a fresh access token, then retry. |
| 404 | application/json | The reference does not name a content this organization owns: CONTENT_NOT_FOUND for an unknown, foreign or archived content id, VERSION_NOT_FOUND for a version number that does not exist, SOURCE_NOT_FOUND when the library or asset behind a source is gone. Read the current id from praxis.content.contents.list (or praxis.media for the asset) and retry with that; never construct an id. |
| 502 | application/json | UPSTREAM_UNAVAILABLE: a dependency refused the call — Media (the transcoder or the manifest issuer) or, for a playback, the end-user token verifier. Nothing was written; retry later, and if it persists report the time and the request path. |
| 503 | application/json | UPSTREAM_UNAVAILABLE: this face is not usable in this environment — the CONTENT service binding is unwired, or the anonymous rate limiter is unavailable or misconfigured so the door fails closed. Use an environment where the face is wired, or retry when the dependency is back. |