Skip to main content
Upload a statement file to a project. The file is stored and queued for processing.
Only PDF files are supported. Maximum file size is 50 MB.

Upload Statement

Creates a new statement staging record and uploads the file. Supports two content types: multipart/form-data for direct file upload, and application/json for base64-encoded files.

Request

POST /v1/statements

Query Parameters

ParameterTypeRequiredDefaultDescription
projectIdUUIDYesThe project to upload the statement to

Headers

HeaderRequiredDescription
AuthorizationYesBearer <token> — must be scoped to the requested project
Content-TypeYesmultipart/form-data or application/json
AcceptNoSet to text/event-stream for real-time upload progress via SSE

Option A: Multipart Form Data

Upload a file directly using multipart/form-data.
FieldTypeRequiredDescription
fileFileYesThe PDF file to upload

Example

curl -X POST "https://api.royaltyport.com/v1/statements?projectId=a1b2c3d4-..." \
  -H "Authorization: Bearer rp_your_token_here" \
  -F "file=@Q1-royalties.pdf"

Option B: JSON Body

Upload a base64-encoded file using application/json.
FieldTypeRequiredDefaultDescription
filestringYesBase64-encoded file content
fileNamestringYesThe file name (e.g. statement.pdf)
fileTypestringNoapplication/pdfMIME type of the file

Example

curl -X POST "https://api.royaltyport.com/v1/statements?projectId=a1b2c3d4-..." \
  -H "Authorization: Bearer rp_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "file": "JVBERi0xLjQK...",
    "fileName": "Q1-royalties.pdf"
  }'

Response

FieldTypeDescription
staging_idintegerUnique identifier for tracking processing progress
staging_stagestringCurrent processing stage (queued, processing, completed, failed)
staging_donebooleanWhether staging (pre-processing) has completed
processing_donebooleanWhether statement processing has completed
created_atstringUpload timestamp (ISO 8601)
{
  "data": {
    "staging_id": 456,
    "staging_stage": "queued",
    "staging_done": false,
    "processing_done": false,
    "created_at": "2025-03-01T12:00:00Z"
  }
}

SSE Response

If the Accept header includes text/event-stream, the response is a server-sent event stream with upload progress:
event: progress
data: {"bytesUploaded":3145728,"bytesTotal":10485760,"percent":30}

event: progress
data: {"bytesUploaded":10485760,"bytesTotal":10485760,"percent":100}

event: complete
data: {"data":{"staging_id":456,"staging_stage":"queued","staging_done":false,"processing_done":false,"created_at":"2025-03-01T12:00:00Z"}}

Errors

StatusDescription
400Missing file, unsupported file type, or file exceeds 50 MB
403Token is not scoped to the requested project
429Rate limit exceeded
500File upload or database error