Skip to content
dhanu docs
Browse pages

API reference

Render a file

POST /api/pub/v1/files/{fileId}/render, render a deck to PDF in the background.

POSThttps://api.dhanu.ai/api/pub/v1/files/{fileId}/render

Queues a headless render of a deck to PDF and returns the job. Wait on the job, or subscribe to job.succeeded, then export the deck as pdf. Rendering a deck that already has a current PDF is a no-op that still returns a job. Other kinds do not need a render step and answer unsupported_export_format.

Request

curl -X POST https://api.dhanu.ai/api/pub/v1/files/$FILE_ID/render \
  -H "Authorization: Bearer $DHANU_API_KEY"
const job = await dhanu.files.render(deckId);
await dhanu.jobs.wait(job.id);
const pdf = await dhanu.files.export(deckId, "pdf");
job = dhanu.files.render(deck_id)
dhanu.jobs.wait(job.id)
pdf = dhanu.files.export(deck_id, "pdf")

Response

202 Accepted

{ "job": { "id": "…", "type": "deck.export", "status": "queued", "result": null, "error": null, "createdAt": "…", "completedAt": null } }

Errors

CodeStatusMeaning
invalid_api_key401The bearer key is missing or unknown.
api_key_revoked401The key was revoked.
api_key_expired401The key passed its expiry date.
api_key_ip_not_allowed403The caller's IP is outside the key's allowlist.
developer_access_revoked403The key's creator lost developer access in the workspace.
api_key_project_scope403The key covers no active projects, or projectId is outside its scope.
not_found404No such resource in the key's workspace.
unsupported_export_format422That file kind cannot be exported in the requested format.