Documents

Document Upload

POST
/documents/document/upload

General-purpose document upload to Storage, form-data only. Accepted extensions: .docx, .xlsx, .doc, .xls. When several files are sent in one request, their form-data order is preserved in the response. Each document is assigned a storage id that can be referenced in later processes such as Document Merge or signing envelopes. 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-template.

Request Body

multipart/form-data

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/document/upload" \  -H "X-Origin: https://app.mavenmule.com" \  -H "X-Storage-Type: document-template" \  -F file="[]"
{  "result": {    "data": {      "files": [        {          "id": "7c2f5a91-3e44-4b0d-a6f8-1b2c3d4e5f60",          "fileName": "quarterly-report.docx"        }      ]    },    "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 'notes.pdf' has an unsupported format. Allowed: .docx,.xlsx,.doc,.xls",    "innerErrors": [      {        "code": "INVALID_TEMPLATE_FORMAT",        "message": "The file 'notes.pdf' has an unsupported format. Allowed: .docx,.xlsx,.doc,.xls",        "userMessage": "This document format isn't supported. Upload a .docx, .xlsx, .doc or .xls file."      }    ]  },  "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"}