Skip to content
Yamuno
Browse

API Reference

Endpoint

POST YOUR_ENDPOINT_URL
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

Find the endpoint URL and create tokens in Confluence Settings → PDF Exporter → API.


Request Body

Give either pageId or spaceId. Every other field is optional. Unknown fields are rejected, so typos don't go unnoticed.

Field Type Description
pageId string Page to export, by numeric ID.
spaceId string Space to export — every page in it, in page-tree order.
includeChildren boolean With pageId: also export every page under it. Default true.
template string Template ID or exact template name. Default: the default style.
output "pdf" | "zip" One merged PDF (default), or a ZIP of separate PDFs.
name string Used in the file name, followed by the date: Release notes 2026-10-07.pdf. Up to 100 characters. Default PDF export.
attachTo string Numeric ID of a page to attach the file to. The token owner must be able to edit it.
mention string[] Up to 10 Atlassian account IDs to @mention in a comment on the attachTo page when the export finishes, so Confluence emails them. Requires attachTo.
requestId string Your own ID for the request, up to 128 characters. A request with a requestId that was already used starts nothing and returns 409, so retries are safe.

Finding IDs

  • Page ID: open the page; it's the number after /pages/ in the URL
  • Space ID: from the Confluence REST API, GET /wiki/api/v2/spaces?keys=YOURKEY
  • Account ID: open the person's profile; it's the last part of the profile URL

Responses

Every response is JSON with a fixed status and message:

{"status": "accepted", "message": "Export started. It will appear in My exports for the token owner, and on the attachTo page if given."}

Scripts should check the HTTP code, or match on status.

HTTP status Meaning
202 accepted The export started.
400 invalid-json The body isn't a JSON object.
400 invalid-request A field is unknown or has an invalid value. The token's Recent calls names it.
400 missing-scope Neither pageId nor spaceId was given, both were, or one isn't a numeric ID.
400 mention-needs-page mention was given without attachTo.
401 unauthorized The token is missing or wrong.
401 token-expired The token has expired or was revoked.
403 no-edit-access The token owner can't edit the attachTo page.
403 owner-inactive The token owner could not be checked and may no longer be active.
404 not-found The page, space or attachTo page doesn't exist, or the token owner can't view it.
404 template-not-found No template has that ID or name.
405 method-not-allowed Use POST.
409 duplicate The requestId was already used.
413 payload-too-large The body is larger than 16 KB.
429 rate-limited The token has started 30 exports this hour. Try again later.
500 internal-error Unexpected error. The token's Recent calls has details.

All checks that can fail fast — the token, the fields, the template, whether the token owner can see the page and edit the attachTo page — happen before the export starts, so a non-202 response never leaves a half-started export.


What Happens After 202

  1. The export is generated in the background, as the token owner. Pages they can't view are left out, and the export notes how many.
  2. The file appears in the token owner's My exports, kept for the site's retention period (7 days by default).
  3. With attachTo, the file is attached to that page and stays there.
  4. With mention, a comment on that page @mentions the people, linking the file — or saying why the export failed. Confluence emails them.
  5. The token's Recent calls records accepted, then started, then done (or failed, with the reason).

A merged PDF that would be too large is exported as a ZIP of separate PDFs instead, and the export says so.

Stuck on something this page does not cover? Ask the developers.