Skip to content
Navigation

Render a composition

Renders one HTML document you wrote (a Hyperframes composition) and spends credits equal to its data-duration. Mosio checks it first: only local assets, a sized root element with a duration, and no Hyperframes lint errors. Google Fonts links and GSAP from a CDN are allowed; Mosio stores local copies. Registry components can be loaded with data-composition-src="compositions/components/<name>.html". See the composition guide for the rules. Needs the videos:create permission.

Every video belongs to a project (project_id in the response): its source, which opens in Studio in the dashboard, and its renders. Send project_id with html to render a new version of that video, or project_id alone to render it as it is now, including edits made in Studio. A new version is refused with project_edited when the video changed after base_version.

The brand's logo is available at assets/brand/logo.<ext> (its exact path is in the brand). Name the brand with brand_id when the workspace has more than one; a new version of a video uses the brand it was made for.

POST
https://app.mosio.me/v1/compositions

Authorization

  • apiKeyAPI key in headerrequired

Request bodyJSONrequired

  • htmloptionalstring

    One complete HTML document. Its root element sets the size and length, for example <div id="root" data-composition-id="main" data-start="0" data-duration="15" data-width="1080" data-height="1920" data-fps="30">.

    maxLength: 200000
  • project_idoptionalstring

    The video to render. With html, the HTML becomes its new version; alone, the video renders as it is now in Studio.

    pattern: ^prj_[a-z0-9]{16}$
  • base_versionoptionalstring

    The source version your HTML is based on. Without it, a new version is refused when the video was edited in Studio since the last version sent through the API or MCP.

    pattern: ^[0-9a-f]{16}$
  • titleoptionalstring

    A short title for the dashboard.

    maxLength: 80
  • brand_idoptionalstring

    The brand the video is for. Needed when the workspace has more than one brand; with one, it is used.

    pattern: ^brd_[0-9a-f]{16}$
  • playground_idoptionalstring

    The dashboard Playground trial (pgr_…) the prompt came from, so the video shows beside it. Ignored when it is not the workspace's.

    pattern: ^pgr_[0-9a-f]{16}$
  • idempotency_keyoptionalstring

    Send the same key again to get the same video instead of a second one.

    maxLength: 200 · minLength: 1

Returns

200

A video with this idempotency_key and the same body already exists; it is returned unchanged.

JSON
  • idstringrequired
  • statusqueuedorrenderingordoneorfailedorcanceledrequired
  • recipestringrequired

    composition for a rendered composition, or studio for a render of a project as it is in Studio. Older videos made from a retired fill-in design carry that design's id.

  • project_idstring | nullrequired

    The project (editable source) this is a render of. The dashboard shows it at /videos/<project_id>.

  • created_atstringrequired
    format: date-time
  • finished_atstring | nullrequired
    format: date-time
  • duration_secondsnumber | nullrequired

    Length of the finished video.

  • output_urlstring | nullrequired

    Short-lived link to the MP4 once status is done.

  • errorobject | nullrequired

    Why the render failed, when status is failed. Failed videos spend no credits.

    • codeoptionalstring
    • messageoptionalstring

201

The video was created and queued.

JSON
  • idstringrequired
  • statusqueuedorrenderingordoneorfailedorcanceledrequired
  • recipestringrequired

    composition for a rendered composition, or studio for a render of a project as it is in Studio. Older videos made from a retired fill-in design carry that design's id.

  • project_idstring | nullrequired

    The project (editable source) this is a render of. The dashboard shows it at /videos/<project_id>.

  • created_atstringrequired
    format: date-time
  • finished_atstring | nullrequired
    format: date-time
  • duration_secondsnumber | nullrequired

    Length of the finished video.

  • output_urlstring | nullrequired

    Short-lived link to the MP4 once status is done.

  • errorobject | nullrequired

    Why the render failed, when status is failed. Failed videos spend no credits.

    • codeoptionalstring
    • messageoptionalstring

400

The request body is not valid JSON or does not match the schema.
JSON
  • errorunauthorizedorinvalid_api_keyorinsufficient_scopeorforbiddenorinvalid_inputorinvalid_composition+8 morerequired

    A stable error code.

  • messagestringrequired

    A message for people, in Indonesian.

  • detailsoptionalunknown

    More about the error, such as the fields to fix.

401

The API key is missing or not valid.
JSON
  • errorunauthorizedorinvalid_api_keyorinsufficient_scopeorforbiddenorinvalid_inputorinvalid_composition+8 morerequired

    A stable error code.

  • messagestringrequired

    A message for people, in Indonesian.

  • detailsoptionalunknown

    More about the error, such as the fields to fix.

402

The workspace does not have enough credits for this video.
JSON
  • errorunauthorizedorinvalid_api_keyorinsufficient_scopeorforbiddenorinvalid_inputorinvalid_composition+8 morerequired

    A stable error code.

  • messagestringrequired

    A message for people, in Indonesian.

  • detailsoptionalunknown

    More about the error, such as the fields to fix.

409

The idempotency_key was used with a different body (idempotency_conflict), or the video was edited in Studio after base_version (project_edited, with the current version in details).
JSON
  • errorunauthorizedorinvalid_api_keyorinsufficient_scopeorforbiddenorinvalid_inputorinvalid_composition+8 morerequired

    A stable error code.

  • messagestringrequired

    A message for people, in Indonesian.

  • detailsoptionalunknown

    More about the error, such as the fields to fix.

422

The composition cannot be rendered yet. details.problems lists what to fix.
JSON
  • errorunauthorizedorinvalid_api_keyorinsufficient_scopeorforbiddenorinvalid_inputorinvalid_composition+8 morerequired

    A stable error code.

  • messagestringrequired

    A message for people, in Indonesian.

  • detailsoptionalunknown

    More about the error, such as the fields to fix.

429

The workspace already has the maximum number of videos queued or rendering (2). Wait for one to finish.
JSON
  • errorunauthorizedorinvalid_api_keyorinsufficient_scopeorforbiddenorinvalid_inputorinvalid_composition+8 morerequired

    A stable error code.

  • messagestringrequired

    A message for people, in Indonesian.

  • detailsoptionalunknown

    More about the error, such as the fields to fix.

Type to search…

↑↓ navigate↵ selectEsc close