Documents
File Upload Guide
Latest Update Time: 2026-07-02 00:00:00
Use the file upload API to upload a file and attach it to a QIMA resource (an order, inspection product, etc.).
See the File Introduction for base URL, authentication, and required headers.
Endpoint
POST https://ppapi.qima.com/user/{userId}/doc-type/{docType}/source/{sourceId}/file
This API requires Content-Type: multipart/form-data (set automatically by curl when using --form).
Prerequisites
In addition to the required headers and authentication setup:
- Permission to upload files for the target resource
- The
sourceIdof the resource you're attaching the file to (e.g. an order ID or product ID) - A valid
docTypevalue for what you're uploading (e.g.ORDER_ATTfor an order attachment)
Path Parameters
| Parameter | Required | Description |
|---|---|---|
userId | Yes | QIMA client user login ID. |
docType | Yes | The document type of this attachment, for example ORDER_ATT (order attachment). |
sourceId | Yes | The resource ID this file will be linked to (e.g. inspection product ID, order ID). Use a comma to link one file to multiple resources, e.g. id_1,id_2,id_3. |
Query Parameters
| Parameter | Required | Description |
|---|---|---|
recordHistory | No | Whether to record this upload in the resource's history log. yes or no. |
includeThumbnail | No | Whether to generate/include a thumbnail for the uploaded file. yes or no. |
Form Data
| Field | Required | Description |
|---|---|---|
file | Yes | The file to upload. |
Request Example
curl --location --request POST 'https://ppapi.qima.com/user/<qima-user-id>/doc-type/ORDER_ATT/source/<source-id>/file?recordHistory=yes&includeThumbnail=no' \
--header 'Ai-Api-Access-Token: {your api access token}' \
--header 'Ai-User-Id: {your user ID}' \
--header 'Authorization: Bearer {your token}' \
--header 'Referer: https://preprodmy.qima.com/' \
--form 'file=@"/path/to/cover-101.png"'
Successful Response
HTTP 200 OK returns the uploaded file's metadata.
{
"id": "355FBF0CF83D4B39AA6EDE2A2A6117F4",
"srcId": "613021F253D44D3DAC5A605DE6DB763E",
"fileType": "ORDER_ATT",
"fileName": "cover-101.png",
"comments": "",
"objectKey": "613021F253D44D3DAC5A605DE6DB763E/ORDER_ATT/0A1E336B57A744369B7BFE7D4E0222F2/cover-101.png",
"fileSize": 109471,
"version": 0,
"s3Url": null,
"createDate": "02-Jul-2026",
"updateDate": "02-Jul-2026"
}
Response Field Notes
| Field | Notes |
|---|---|
id | The file ID. Store this — pass it to Download a File by ID to retrieve the file later. |
srcId | The resource ID the file is linked to. Matches the sourceId you passed in the path. |
fileType | The document type. Matches the docType you passed in the path. |
objectKey | Internal storage path on S3. Not needed for downloading — use id with the Download API instead. |
s3Url | Temporary direct S3 URL for the file. null in this response; not populated on upload. |
createDate / updateDate | Date the file record was created/last updated, in dd-MMM-yyyy format (e.g. "02-Jul-2026"). |
Common Errors
See common authentication errors for 401 and 403 responses.
| Status | Meaning | Recommended Action |
|---|---|---|
400 Bad Request | sourceId can't be blank. | Confirm the sourceId path segment is populated. |
500 Internal Server Error | File upload failed on the server. | Contact QIMA support with the request time and file details. |
Next Steps
- Store the returned
idto download the file later, or pass it to other APIs that reference uploaded attachments.
