Exports

Export artifacts to PDF, PPTX, PNG, HTML, or Google Slides. PPTX and Google Slides require Google connection.

Create an export

Synchronously exports an artifact. Waits for the export pipeline and returns the completed export with a download URL. If the response has status "failed" with error.code "GOOGLE_AUTH_REQUIRED", the user's Google account is not connected. For larger artifacts or latency-sensitive callers, use exports.create_async.

POST
/v1/exports

Authorization

AuthorizationRequiredBearer <token>

NextDocs API key (nxd_xxx format)

In: header

Request Body

application/jsonOptional
artifact_idRequiredstring

ID of the artifact to export.

Minimum length: 1
formatRequiredstring

Export format. png returns a ZIP containing page images.

Value in: "pdf" | "pptx" | "png" | "html" | "google-slides" | "ktml"
pagesarray<integer>

Page numbers to export (1-indexed). If omitted, all pages are exported.

Response Body

Resource created successfully.

TypeScript Definitions

Use the response body type in TypeScript.

idRequiredstring

Stable export ID.

artifact_idRequiredstring
contentRequiredstring | null | null

Inline content for HTML exports. Null for binary formats (use download_url instead).

content_typeRequiredstring | null | null

MIME type of the export content.

created_atRequiredstring
download_urlRequiredstring | null | null

Download URL for the completed export. When available this is a direct object-storage URL that external clients can fetch without reusing the API key.

errorRequiredobject | null | null
expires_atRequiredstring | null | null
file_nameRequiredstring | null | null

Suggested filename for the downloaded export.

formatRequiredstring
Value in: "pdf" | "pptx" | "png" | "html" | "google-slides" | "ktml"
google_slides_presentation_idstring | null | null

Google Slides presentation ID. Only present for google-slides format exports.

objectRequiredstring
Value in: "export"
pages_exportedRequirednumber | null | null

Number of pages included in the export.

statusRequiredstring
Value in: "processing" | "completed" | "failed"
updated_atRequiredstring

Request validation failed.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject

Authentication required or API key is invalid.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject

The requested resource was not found.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject

Rate limit or usage quota exceeded.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject
curl -X POST "https://api.nextdocs.io/v1/exports" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "artifact_id": "doc_abc123",
    "format": "pdf",
    "pages": [
      1,
      2,
      3
    ]
  }'
const body = JSON.stringify({
  "artifact_id": "doc_abc123",
  "format": "pdf",
  "pages": [
    1,
    2,
    3
  ]
})

fetch("https://api.nextdocs.io/v1/exports", {
  headers: {
    "Authorization": "Bearer <token>"
  },
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://api.nextdocs.io/v1/exports"
  body := strings.NewReader(`{
    "artifact_id": "doc_abc123",
    "format": "pdf",
    "pages": [
      1,
      2,
      3
    ]
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Authorization", "Bearer <token>")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://api.nextdocs.io/v1/exports"
body = {
  "artifact_id": "doc_abc123",
  "format": "pdf",
  "pages": [
    1,
    2,
    3
  ]
}
response = requests.request("POST", url, json = body, headers = {
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
})

print(response.text)
{
  "id": "job_abc123def456",
  "artifact_id": "doc_abc123",
  "content": null,
  "content_type": "text/html",
  "created_at": "2026-01-15T10:30:00.000Z",
  "download_url": "https://storage.googleapis.com/nextdocs-public-dev/exports/job_abc123def456/doc_abc123.pdf",
  "error": null,
  "expires_at": null,
  "file_name": "doc_abc123.pdf",
  "format": "html",
  "google_slides_presentation_id": null,
  "object": "export",
  "pages_exported": 5,
  "status": "processing",
  "updated_at": "2026-01-15T10:30:00.000Z"
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}

Create an export asynchronously

Asynchronously queues an artifact export. Returns immediately with status "processing". Poll exports.get(id) until status is "completed" or "failed". Use this for multi-page PDFs/PPTX or when the calling environment has tool-call timeouts.

POST
/v1/exports/async

Authorization

AuthorizationRequiredBearer <token>

NextDocs API key (nxd_xxx format)

In: header

Request Body

application/jsonOptional
artifact_idRequiredstring

ID of the artifact to export.

Minimum length: 1
formatRequiredstring

Export format. png returns a ZIP containing page images.

Value in: "pdf" | "pptx" | "png" | "html" | "google-slides" | "ktml"
pagesarray<integer>

Page numbers to export (1-indexed). If omitted, all pages are exported.

Response Body

Resource queued for asynchronous processing. The response contains the resource with a non-terminal status (e.g. "generating", "processing") — poll the resource via its .get endpoint until status reaches a terminal value.

TypeScript Definitions

Use the response body type in TypeScript.

idRequiredstring

Stable export ID.

artifact_idRequiredstring
contentRequiredstring | null | null

Inline content for HTML exports. Null for binary formats (use download_url instead).

content_typeRequiredstring | null | null

MIME type of the export content.

created_atRequiredstring
download_urlRequiredstring | null | null

Download URL for the completed export. When available this is a direct object-storage URL that external clients can fetch without reusing the API key.

errorRequiredobject | null | null
expires_atRequiredstring | null | null
file_nameRequiredstring | null | null

Suggested filename for the downloaded export.

formatRequiredstring
Value in: "pdf" | "pptx" | "png" | "html" | "google-slides" | "ktml"
google_slides_presentation_idstring | null | null

Google Slides presentation ID. Only present for google-slides format exports.

objectRequiredstring
Value in: "export"
pages_exportedRequirednumber | null | null

Number of pages included in the export.

statusRequiredstring
Value in: "processing" | "completed" | "failed"
updated_atRequiredstring

Request validation failed.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject

Authentication required or API key is invalid.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject

The requested resource was not found.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject

Rate limit or usage quota exceeded.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject
curl -X POST "https://api.nextdocs.io/v1/exports/async" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "artifact_id": "doc_abc123",
    "format": "pdf",
    "pages": [
      1,
      2,
      3
    ]
  }'
const body = JSON.stringify({
  "artifact_id": "doc_abc123",
  "format": "pdf",
  "pages": [
    1,
    2,
    3
  ]
})

fetch("https://api.nextdocs.io/v1/exports/async", {
  headers: {
    "Authorization": "Bearer <token>"
  },
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://api.nextdocs.io/v1/exports/async"
  body := strings.NewReader(`{
    "artifact_id": "doc_abc123",
    "format": "pdf",
    "pages": [
      1,
      2,
      3
    ]
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Authorization", "Bearer <token>")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://api.nextdocs.io/v1/exports/async"
body = {
  "artifact_id": "doc_abc123",
  "format": "pdf",
  "pages": [
    1,
    2,
    3
  ]
}
response = requests.request("POST", url, json = body, headers = {
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
})

print(response.text)
{
  "id": "job_abc123def456",
  "artifact_id": "doc_abc123",
  "content": null,
  "content_type": "text/html",
  "created_at": "2026-01-15T10:30:00.000Z",
  "download_url": "https://storage.googleapis.com/nextdocs-public-dev/exports/job_abc123def456/doc_abc123.pdf",
  "error": null,
  "expires_at": null,
  "file_name": "doc_abc123.pdf",
  "format": "html",
  "google_slides_presentation_id": null,
  "object": "export",
  "pages_exported": 5,
  "status": "processing",
  "updated_at": "2026-01-15T10:30:00.000Z"
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}

Get an export

Returns the current status of an export by ID. When completed, download_url points at a directly fetchable export asset.

GET
/v1/exports/{id}

Authorization

AuthorizationRequiredBearer <token>

NextDocs API key (nxd_xxx format)

In: header

Path Parameters

idRequiredstring

Export ID

Response Body

The requested resource.

TypeScript Definitions

Use the response body type in TypeScript.

idRequiredstring

Stable export ID.

artifact_idRequiredstring
contentRequiredstring | null | null

Inline content for HTML exports. Null for binary formats (use download_url instead).

content_typeRequiredstring | null | null

MIME type of the export content.

created_atRequiredstring
download_urlRequiredstring | null | null

Download URL for the completed export. When available this is a direct object-storage URL that external clients can fetch without reusing the API key.

errorRequiredobject | null | null
expires_atRequiredstring | null | null
file_nameRequiredstring | null | null

Suggested filename for the downloaded export.

formatRequiredstring
Value in: "pdf" | "pptx" | "png" | "html" | "google-slides" | "ktml"
google_slides_presentation_idstring | null | null

Google Slides presentation ID. Only present for google-slides format exports.

objectRequiredstring
Value in: "export"
pages_exportedRequirednumber | null | null

Number of pages included in the export.

statusRequiredstring
Value in: "processing" | "completed" | "failed"
updated_atRequiredstring

Authentication required or API key is invalid.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject

The requested resource was not found.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject
curl -X GET "https://api.nextdocs.io/v1/exports/job_abc123def456" \
  -H "Authorization: Bearer <token>"
fetch("https://api.nextdocs.io/v1/exports/job_abc123def456", {
  headers: {
    "Authorization": "Bearer <token>"
  }
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://api.nextdocs.io/v1/exports/job_abc123def456"

  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <token>")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://api.nextdocs.io/v1/exports/job_abc123def456"

response = requests.request("GET", url, headers = {
  "Authorization": "Bearer <token>"
})

print(response.text)
{
  "id": "job_abc123def456",
  "artifact_id": "doc_abc123",
  "content": null,
  "content_type": "text/html",
  "created_at": "2026-01-15T10:30:00.000Z",
  "download_url": "https://storage.googleapis.com/nextdocs-public-dev/exports/job_abc123def456/doc_abc123.pdf",
  "error": null,
  "expires_at": null,
  "file_name": "doc_abc123.pdf",
  "format": "html",
  "google_slides_presentation_id": null,
  "object": "export",
  "pages_exported": 5,
  "status": "processing",
  "updated_at": "2026-01-15T10:30:00.000Z"
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}

Download export

Downloads the completed export payload. HTML exports are served directly; binary formats may redirect to a signed object URL.

GET
/v1/exports/{id}/download

Authorization

AuthorizationRequiredBearer <token>

NextDocs API key (nxd_xxx format)

In: header

Path Parameters

idRequiredstring

Export ID

Response Body

The export file contents.

TypeScript Definitions

Use the response body type in TypeScript.

responseRequiredfile
Format: "binary"

Authentication required or API key is invalid.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject

The requested resource was not found.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject

The export is not ready or failed.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject
curl -X GET "https://api.nextdocs.io/v1/exports/job_abc123def456/download" \
  -H "Authorization: Bearer <token>"
fetch("https://api.nextdocs.io/v1/exports/job_abc123def456/download", {
  headers: {
    "Authorization": "Bearer <token>"
  }
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://api.nextdocs.io/v1/exports/job_abc123def456/download"

  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <token>")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://api.nextdocs.io/v1/exports/job_abc123def456/download"

response = requests.request("GET", url, headers = {
  "Authorization": "Bearer <token>"
})

print(response.text)
"string"
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found."
  }
}