Create File

Creates a file record and returns a presigned upload URL plus the form fields to include in the multipart POST. Upload the file directly to the returned URL, then reference it by `file_id` from other resources. The upload URL expires 10 minutes after creation, so request it as part of the same flow that performs the upload. Each `purpose` enforces its own MIME allowlist and maximum file size, validated before the presigned URL is issued — a `content_type` or `size_bytes` outside the purpose's limits is rejected with a 400. | Purpose | Allowed content types | Max file size | | --- | --- | --- | | `dispute_evidence` | `application/pdf`, `image/png`, `image/jpeg`, `image/tiff` | 5 MB |

Authentication

x-truemed-api-keystring

Sales channel API key for merchant server-to-server authentication

Request

Request body for FileCreateRequest
content_typestringRequired

The file’s MIME type, e.g. application/pdf. Must be allowed for the given purpose.

filenamestringRequired<=255 characters
The original filename, e.g. receipt.pdf.
purposeenumRequired

The business domain the file is for (e.g. dispute_evidence).

size_bytesintegerRequired

The file size in bytes. Must be within the per-purpose maximum.

Response

Successful response
expires_atdatetime

When the presigned upload URL expires (10 minutes after creation).

file_idstring
The public file identifier. Reference this id from other resources.
upload_fieldsmap from strings to strings
Form fields to include in the multipart upload POST, before the file part.
upload_urlstring

Presigned URL to POST the file to (multipart/form-data).

Errors

400
Bad Request Error
404
Not Found Error
405
Method Not Allowed Error
500
Internal Server Error
501
Not Implemented Error