Documents

Data Upload

POST
/documents/data/upload

Uploads a structured JSON data file to Storage so it can be referenced as a data source in later requests (e.g. document generation). Two request shapes are accepted, selected by Content-Type: (1) multipart/form-data with one or more .json files; (2) a raw JSON body with Content-Type: application/json, stored as-is as an opaque blob. Uploaded data is automatically removed from Storage after the next document-generation request that consumes it, whether that request succeeds or fails — re-upload if you need it again. Max size is enforced at the gateway (20MB Production, 10MB Staging).

Authorization

AuthorizationBearer <token>

JWT token to authenticate the request.

In: header

X-Api-Key<token>

API key, sent as a request header.

In: header

Header Parameters

X-Service-Authorization?string

Service-to-service auth token, used as an alternative to Authorization for service-principal callers.

X-Client-Authorization?string

Client auth token, used as an alternative to Authorization for client-application callers.

X-Email?string

Caller email, used for identity resolution when authenticating via a service or client auth token.

X-OAuth-Flow?string

Indicates which OAuth flow variant issued the Authorization token.

X-Origin?string

Free-form caller-supplied origin identifier. Not validated; echoed back verbatim into the response envelope's origin field. Optional.

X-Storage-Type*string

Selects which storage container handles the request. This operation expects the value document-data.

Request Body

TypeScript Definitions

Use the request body type in TypeScript.

body?unknown

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/documents/data/upload" \  -H "X-Origin: https://app.mavenmule.com" \  -H "X-Storage-Type: document-data" \  -H "Content-Type: application/json" \  -d '{    "customerId": "12345",    "records": [      {        "field": "value"      }    ]  }'

{  "result": {    "data": {      "files": [        {          "id": "3f9a7c14-2b8e-4d6a-9f01-5c7e2a1b3d4e",          "fileName": "customer-data.json"        }      ]    },    "statusCode": 201,    "message": "Created"  },  "origin": "https://app.mavenmule.com",  "dateTime": "2026-07-14T09:32:15.0000000+00:00",  "operationId": "3a4b5c6d7e8f90112233445566778899"}

{  "error": {    "statusCode": 400,    "message": "The file 'payload.xml' has an unsupported extension. Allowed: .json",    "innerErrors": [      {        "code": "INVALID_DATA_FORMAT",        "message": "The file 'payload.xml' has an unsupported extension. Allowed: .json",        "userMessage": "Only .json files can be uploaded here. Convert your data to .json and try again."      }    ]  },  "origin": "https://app.mavenmule.com",  "dateTime": "2026-07-14T09:32:15.0000000+00:00",  "operationId": "3a4b5c6d7e8f90112233445566778899"}
{  "error": {    "statusCode": 401,    "message": "The request could not be authenticated.",    "innerErrors": [      {        "code": "UNAUTHORIZED",        "message": "The request could not be authenticated.",        "userMessage": "Your session has expired or is invalid. Please sign in again."      }    ]  },  "origin": "https://app.mavenmule.com",  "dateTime": "2026-07-14T09:32:15.0000000+00:00",  "operationId": "3a4b5c6d7e8f90112233445566778899"}
{  "error": {    "statusCode": 500,    "message": "Failed to persist the uploaded file to storage.",    "innerErrors": [      {        "code": "FILE_UPLOAD_FAILED",        "message": "Failed to persist the uploaded file to storage.",        "userMessage": "Something went wrong while uploading. Please try again or contact support."      }    ]  },  "origin": "https://app.mavenmule.com",  "dateTime": "2026-07-14T09:32:15.0000000+00:00",  "operationId": "3a4b5c6d7e8f90112233445566778899"}