API Reference

Exports

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

Create an export

Exports an artifact and waits for completion. Best when you want the final export in one call and can tolerate a longer-running request.

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"
pagesarray<integer>

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

Response Body

Export completed synchronously (default). Returns the completed export.

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"
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
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."
  }
}

Create an export asynchronously

Queues an export as a background job and returns a job immediately. Poll jobs.get until it completes, then fetch the final export via exports.get using the returned export_id.

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"
pagesarray<integer>

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

Response Body

Export queued for asynchronous processing.

TypeScript Definitions

Use the response body type in TypeScript.

idRequiredstring
created_atRequiredstring
errorRequiredobject | null | null
objectRequiredstring
Value in: "job"
resultRequiredobject | null | null
statusRequiredstring
Value in: "processing" | "completed" | "failed"
typeRequiredstring
Value in: "artifact.create" | "export.run"
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
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",
  "created_at": "2026-01-15T10:30:00.000Z",
  "error": null,
  "object": "job",
  "result": null,
  "status": "processing",
  "type": "artifact.create",
  "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."
  }
}

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 export status.

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"
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."
  }
}