Skip to Content

Remote storage

Read documents from your bucket and write results back, without moving files through your service

Point source and destination at a storage connector and Papyrus reads the document from your bucket and writes the result back. Your service sends two URIs instead of uploading and downloading files, and the response carries only the facts about the stored result.

curl http://127.0.0.1:8000/v1/markdown \
  -H 'Authorization: Bearer dev' \
  -H 'Content-Type: application/json' \
  -d '{"source": "s3://prod/contracts/msa.pdf", "destination": "s3://prod/markdown/msa.md"}'
{
  "source": {
    "uri": "s3://prod/contracts/msa.pdf",
    "name": "msa.pdf",
    "size": 18810,
    "mimeType": "application/pdf",
    "extension": "pdf",
    "label": "pdf",
    "group": "document"
  },
  "result": {
    "uri": "s3://prod/markdown/msa.md",
    "name": "msa.md",
    "size": 3092,
    "mimeType": "text/markdown",
    "extension": "md",
    "label": "markdown",
    "group": "markup"
  },
  "options": {"readMode": "text"}
}

result.uri is where the file was written; content is omitted. This example assumes an operator configured an S3 connector named prod; see configuration.

Combine sources and destinations

Any source works with a destination:

SourceDestinationUse it to
s3://prod/…s3://prod/…Process objects that are already in a bucket
upload or URLs3://prod/…Store results for later, return only the location to your caller
s3://prod/…noneRead from storage, get the result in the response

Destinations must be connector URIs; a URL or file:// destination fails with 422 unsupported_uri.

What gets stored

OperationStored file
MarkdownThe Markdown
Markdown with chunkingThe full JSON document, envelope and chunks; name the destination .json
Render, thumbnail, screenshotThe image

Papyrus writes to the exact key you give and overwrites an existing object. It does not add an extension, so name the key with the one you want.

Handle failures

  • The connector and the destination are checked before any processing, so 422 unknown_connector and 422 unsupported_uri return immediately.
  • 404 source_not_found: the source object does not exist.
  • 502 source_fetch_failed: reading from storage failed, for example a permission error.
  • 502 destination_failed: the upload failed after processing; nothing was stored, retry the request.

On this page