Skip to Content

Request format

The fields every operation takes and the envelope every operation returns

Markdown, render, thumbnail and screenshot take the same four fields and return the same three-key envelope. Inspect takes only source and options, and returns no result.

Fields

FieldRequiredMeaning
sourceyes, except for uploadsWhat to process: an upload, a URL or a storage object. See URI formats
optionsnoOperation options. Omitted fields take their defaults
outputnojson for the envelope, file for the artifact as the response body
destinationnoA storage URI to write the result to instead of returning it

Field names are camelCase: maxTokens, fullPage, waitUntil. Unknown fields, snake_case names included, fail with 422 validation_error.

Send JSON or upload a file

Send JSON when the document is reachable by URL or storage URI:

curl http://127.0.0.1:8000/v1/thumbnail \
  -H 'Authorization: Bearer dev' \
  -H 'Content-Type: application/json' \
  -d '{"source": "https://axelered.com", "output": "json"}'

Send multipart/form-data to upload the document. The file goes in the file part and the rest of the request, as JSON, in the metadata part. source defaults to file://file, so an upload without options needs no metadata at all:

curl http://127.0.0.1:8000/v1/render \
  -H 'Authorization: Bearer dev' \
  -F 'metadata={"output": "json", "options": {"width": 800, "format": "webp"}};type=application/json' \
  -F file=@sample.pdf

The envelope

With output: json, these operations return source, result and options:

{
  "source": {
    "uri": "file://file",
    "name": "sample.pdf",
    "size": 18810,
    "mimeType": "application/pdf",
    "extension": "pdf",
    "label": "pdf",
    "group": "document",
    "pageCount": 1
  },
  "result": {
    "name": "sample-1.webp",
    "size": 122152,
    "mimeType": "image/webp",
    "extension": "webp",
    "label": "webp",
    "group": "image",
    "width": 800,
    "height": 1036,
    "encoding": "base64",
    "content": "UklGRiDdAQBXRUJQVlA4IBTdAQDwZASdASogAwwE…"
  },
  "options": {"page": 1, "width": 800, "format": "webp"}
}
KeyContent
sourceThe input as Papyrus detected it from its content: type, size, and what the operation learned, such as pageCount, title or fetch for URLs
resultThe produced file. content holds it as UTF-8 text for Markdown and base64 for images, as encoding says
optionsYour options with every default applied

Operation data such as chunks sits next to these three keys. Fields Papyrus does not know are omitted, never null.

Choose the output

RequestResponse body
output: jsonThe envelope with result.content
output: fileThe artifact itself, with its name in Content-Disposition
destination setThe envelope without content; result.uri is where the file was written

Markdown defaults to json; render, thumbnail and screenshot default to file. When the response carries operation data, such as chunks, output: file and destination deliver the full JSON document instead of the bare artifact.

Inspect produces no file. It always returns JSON and rejects output and destination.

On this page