API reference
Render a file
POST /api/pub/v1/files/{fileId}/render, render a deck to PDF in the background.
POST
https://api.dhanu.ai/api/pub/v1/files/{fileId}/renderQueues 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
| Code | Status | Meaning |
|---|---|---|
invalid_api_key | 401 | The bearer key is missing or unknown. |
api_key_revoked | 401 | The key was revoked. |
api_key_expired | 401 | The key passed its expiry date. |
api_key_ip_not_allowed | 403 | The caller's IP is outside the key's allowlist. |
developer_access_revoked | 403 | The key's creator lost developer access in the workspace. |
api_key_project_scope | 403 | The key covers no active projects, or projectId is outside its scope. |
not_found | 404 | No such resource in the key's workspace. |
unsupported_export_format | 422 | That file kind cannot be exported in the requested format. |