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.
Authorization
AuthorizationRequiredBearer <token>NextDocs API key (nxd_xxx format)
In: header
Request Body
application/jsonOptionalartifact_idRequiredstringID of the artifact to export.
1formatRequiredstringExport format. png returns a ZIP containing page images.
"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.
idRequiredstringStable export ID.
artifact_idRequiredstringcontentRequiredstring | null | nullInline content for HTML exports. Null for binary formats (use download_url instead).
content_typeRequiredstring | null | nullMIME type of the export content.
created_atRequiredstringdownload_urlRequiredstring | null | nullDownload 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 | nullexpires_atRequiredstring | null | nullfile_nameRequiredstring | null | nullSuggested filename for the downloaded export.
formatRequiredstring"pdf" | "pptx" | "png" | "html" | "google-slides"google_slides_presentation_idstring | null | nullGoogle Slides presentation ID. Only present for google-slides format exports.
objectRequiredstring"export"pages_exportedRequirednumber | null | nullNumber of pages included in the export.
statusRequiredstring"processing" | "completed" | "failed"updated_atRequiredstringRequest validation failed.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectAuthentication required or API key is invalid.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectThe requested resource was not found.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectcurl -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.
Authorization
AuthorizationRequiredBearer <token>NextDocs API key (nxd_xxx format)
In: header
Request Body
application/jsonOptionalartifact_idRequiredstringID of the artifact to export.
1formatRequiredstringExport format. png returns a ZIP containing page images.
"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.
idRequiredstringcreated_atRequiredstringerrorRequiredobject | null | nullobjectRequiredstring"job"resultRequiredobject | null | nullstatusRequiredstring"processing" | "completed" | "failed"typeRequiredstring"artifact.create" | "export.run"updated_atRequiredstringRequest validation failed.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectAuthentication required or API key is invalid.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectThe requested resource was not found.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectcurl -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.
Authorization
AuthorizationRequiredBearer <token>NextDocs API key (nxd_xxx format)
In: header
Path Parameters
idRequiredstringExport ID
Response Body
The export status.
TypeScript Definitions
Use the response body type in TypeScript.
idRequiredstringStable export ID.
artifact_idRequiredstringcontentRequiredstring | null | nullInline content for HTML exports. Null for binary formats (use download_url instead).
content_typeRequiredstring | null | nullMIME type of the export content.
created_atRequiredstringdownload_urlRequiredstring | null | nullDownload 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 | nullexpires_atRequiredstring | null | nullfile_nameRequiredstring | null | nullSuggested filename for the downloaded export.
formatRequiredstring"pdf" | "pptx" | "png" | "html" | "google-slides"google_slides_presentation_idstring | null | nullGoogle Slides presentation ID. Only present for google-slides format exports.
objectRequiredstring"export"pages_exportedRequirednumber | null | nullNumber of pages included in the export.
statusRequiredstring"processing" | "completed" | "failed"updated_atRequiredstringAuthentication required or API key is invalid.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectThe requested resource was not found.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectcurl -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.
Authorization
AuthorizationRequiredBearer <token>NextDocs API key (nxd_xxx format)
In: header
Path Parameters
idRequiredstringExport ID
Response Body
The export file contents.
TypeScript Definitions
Use the response body type in TypeScript.
responseRequiredfile"binary"Authentication required or API key is invalid.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectThe requested resource was not found.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectThe export is not ready or failed.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectcurl -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."
}
}