Overview
The delegate-upload endpoint allows your Platform to generate secure, short-lived JWT tokens for your merchants’ frontend upload widgets (Uppy). This enables direct browser-to-storage uploads while maintaining proper attribution and billing.Delegated tokens expire after 5 minutes by default. Request a fresh token for each upload session.
Endpoint
Authentication
This endpoint requires your Platform API key in the Authorization header:Request Body
| Field | Type | Required | Description |
|---|---|---|---|
merchant_id | string | Yes | Your internal identifier for the merchant |
Example Request
Response
Short-lived JWT token for Uppy authentication
ISO 8601 timestamp when the token expires
Example Response
JWT Token Claims
The generated token contains claims that are used for attribution and billing:| Claim | Description |
|---|---|
sub | The merchant_id you provided |
api_key_id | Your Platform’s API key identifier |
scope | Token scope (e.g., upload) |
entity_type | Entity type identifier |
exp | Token expiration timestamp |
iat | Token issued-at timestamp |
The same delegation token is used for both the TUS upload and the subsequent processing request. This simplifies your integration since one token handles the entire flow.
Usage Flow
Direct Upload
Uppy uploads the file directly to our TUS server using the token for authentication. After the upload completes, Uppy returns the file URL.
Call Processing Endpoint
Your frontend calls the verify-pot-sizes endpoint with the same delegation token and the uploaded file URL.
Receive Enriched Data
The API fetches the file internally, processes it, bills the merchant (from the JWT), and returns enriched data directly in the response. See Verify Pot Sizes from Upload for the full response schema.
Error Responses
| Status | Error | Description |
|---|---|---|
401 | unauthorized | Invalid or missing API key |
400 | invalid_request | Missing merchant_id in request body |
429 | rate_limited | Too many token requests |
Best Practices
Request tokens just-in-time
Request tokens just-in-time
Don’t pre-fetch tokens. Request a fresh token when the user is ready to upload to ensure it doesn’t expire mid-upload.
Handle token expiration
Handle token expiration
If an upload fails due to token expiration, request a new token and retry. Uppy supports automatic retry with updated headers.
Use consistent merchant IDs
Use consistent merchant IDs
Use your internal user/merchant ID consistently. This ID is used for billing aggregation and usage tracking.

