Skip to main content
This guide explains how to upload documents to Raydocs for extraction using the API. The process has three steps: get a signed URL, upload the file to temporary storage, then create or reuse a workspace-scoped document and attach it to an extraction session.
API reference: Session upload (attach to existing session) or Create Workspace Document (workspace-first, optional session attach).

Upload Flow Overview

Step 1: Get a Signed Upload URL

First, request a signed URL from the Vapor storage endpoint. This URL allows you to upload directly to S3 without routing the file through the API server.

Request Parameters

The content_type parameter is optional and defaults to application/octet-stream. You don’t need to detect or specify file types.

Response

The signed URL is valid for a limited time (typically 5 minutes). Upload your file promptly after receiving it.

Step 2: Upload to S3

Use the signed URL to upload your file directly to S3. Include the headers returned in the previous step.

Step 3: Create or Reuse Document and Attach to Session

After the file is uploaded to S3, create (or reuse) workspace-scoped document(s) and attach them to your extraction session. Use the uploaded key(s) from Step 1.

Request Parameters

Response

Upload/import is storage-only. Parsing is requested explicitly (reparse endpoint) or at extraction run time when required.
Deduplication is content-based at workspace scope. If two uploads have the same bytes, Raydocs reuses the same document record even when filenames differ.

Complete Example

Here’s a complete example in JavaScript:

Supported File Formats

PDF, images (PNG, JPEG, TIFF), and Office documents (DOCX, PPTX) are supported.

Alternative: Workspace-first Flow

To create documents in your workspace first (and optionally attach to sessions later), use the workspace document endpoint:
See Create Workspace Document for full details. You can also import from URL without using signed URLs.

Monitoring Processing Status

After uploading, poll the document endpoint to check processing status:
Or list all documents in the workspace:
For session-scoped listing:
Wait for all documents to reach processed status before running an extraction. If you trigger a run early, the API can return 409 with status: parsing_pending, and the manual run will auto-resume once required parsing artifacts are ready.

Error Handling

Common Upload Errors

Processing Failures

If a document’s status becomes failed:
  1. Check the document’s error message via the GET endpoint
  2. Verify the file is a valid, non-corrupted document
  3. Re-upload if the file was damaged during transfer