Upload Files
How to upload files using public API
The upload file endpoints allow you to upload files to QA Sphere.
Uploaded files can be referenced in the files field of public test case create/update requests and inside HTML fields. Public result endpoints currently support links only and do not accept file attachments.
Upload File
Upload a file to QA Sphere.
Request Body
Request body should be a multipart/form-data with a file form-field.
Limits
- Maximum file size:
50 MiB
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the uploaded file |
stableUrl | string | Host-relative URL of the uploaded file; safe across subdomain changes (use this) |
url | string | Absolute URL of the uploaded file |
Example Request
curl \
-H "Authorization: ApiKey your.api.key.here" \
-F 'file=@"/path/to/file"' \
https://your-company.your-region-code.qasphere.com/api/public/v0/fileExample Response
{
"id": "1CJLabPkq_PWeS4siaKcB1k",
"stableUrl": "/api/file/1CJLabPkq_PWeS4siaKcB1k",
"url": "https://your-company.your-region-code.qasphere.com/api/file/1CJLabPkq_PWeS4siaKcB1k"
}Error Responses
| Status Code | Description |
|---|---|
| 400 | Invalid multipart request or missing file |
| 401 | Invalid or missing API key |
| 403 | Insufficient permissions or suspended tenant |
| 413 | File exceeds the 50 MiB limit |
| 500 | Internal server error while uploading file |
Upload Files In Batch
Upload multiple files to QA Sphere in a single request.
Request Body
Request body should be a multipart/form-data with one or more files form-fields.
Limits
- Maximum files per request:
100 - Maximum file size:
50 MiBper file - Maximum request body size:
500 MiB
Response Fields
{
files: Array<{
id: string // Unique identifier for the uploaded file
stableUrl: string // Host-relative URL; safe across subdomain changes (use this)
url: string // Absolute URL
}>
}Example Request
curl \
-H "Authorization: ApiKey your.api.key.here" \
-F 'files=@"/path/to/file1"' \
-F 'files=@"/path/to/file2"' \
https://your-company.your-region-code.qasphere.com/api/public/v0/file/batchExample Response
{
"files": [
{
"id": "1CJLabPkq_PWeS4siaKcB1k",
"stableUrl": "/api/file/1CJLabPkq_PWeS4siaKcB1k",
"url": "https://your-company.your-region-code.qasphere.com/api/file/1CJLabPkq_PWeS4siaKcB1k"
},
{
"id": "1CJLabPkq_Q2x7A7Lwu7GsL5",
"stableUrl": "/api/file/1CJLabPkq_Q2x7A7Lwu7GsL5",
"url": "https://your-company.your-region-code.qasphere.com/api/file/1CJLabPkq_Q2x7A7Lwu7GsL5"
}
]
}Error Responses
| Status Code | Description |
|---|---|
| 400 | Invalid multipart request, no files provided, or too many files |
| 401 | Invalid or missing API key |
| 403 | Insufficient permissions or suspended tenant |
| 413 | A file exceeds 50 MiB or request body exceeds 500 MiB |
| 500 | Internal server error while uploading files |
:::tip Use stableUrl
Prefer the stableUrl field when referencing an uploaded file. It is host-relative (e.g. /api/file/{id}) and keeps resolving even after your tenant's subdomain changes. URLs that embed the old subdomain stop working once the subdomain changes.
:::
:::note Relative file URLs in responses
Read endpoints (e.g. GET /tcase/{id}, GET /run/{id}) return file references embedded in HTML fields, such as precondition.text, steps[].description, steps[].expected, run/plan descriptions, and comments, as host-relative URLs (/api/file/{id}). To fetch such an attachment, prepend your tenant base URL (e.g. https://your-company.your-region-code.qasphere.com). The dedicated files[].url field on the test-case response remains absolute.
:::