Skip to main content
GET
/
v1
/
collections
/
{id}
/
export
# NDJSON event stream
curl -N "https://api.okrapdf.com/v1/collections/col-40da068481cf4f248853507cba6be611/export?format=markdown" \
  -H "Authorization: Bearer okra_YOUR_KEY"

# Zip archive
curl -L "https://api.okrapdf.com/v1/collections/col-40da068481cf4f248853507cba6be611/export?format=zip" \
  -H "Authorization: Bearer okra_YOUR_KEY" \
  -o collection-export.zip

Overview

Exports markdown content for all documents in a collection. Supports NDJSON streaming (default) or a zip archive.

Request

id
string
required
Collection ID (col-...) or collection name.
format
string
markdown (default, NDJSON stream) or zip (one .md file per document).
# NDJSON event stream
curl -N "https://api.okrapdf.com/v1/collections/col-40da068481cf4f248853507cba6be611/export?format=markdown" \
  -H "Authorization: Bearer okra_YOUR_KEY"

# Zip archive
curl -L "https://api.okrapdf.com/v1/collections/col-40da068481cf4f248853507cba6be611/export?format=zip" \
  -H "Authorization: Bearer okra_YOUR_KEY" \
  -o collection-export.zip

NDJSON Event Shapes

start — first event in the stream:
{"type":"start","doc_count":3,"format":"markdown"}
result — one per document:
{
  "type": "result",
  "doc_id": "doc-abc123",
  "file_name": "10k.pdf",
  "page_count": 2,
  "pages": [
    {"pageNumber": 1, "content": "# Page 1 markdown", "vendor": "okra"},
    {"pageNumber": 2, "content": "# Page 2 markdown", "vendor": "okra"}
  ]
}
done — final success event:
{"type":"done","completed":3,"failed":0,"total_pages":12}
error — terminal failure:
{"type":"error","error":"Collection export failed"}