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, and downloaded with Download File. 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 (/api/file/{id}) 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 |
| 413 | File exceeds the 50 MiB limit |
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 // File ID
stableUrl: string // Host-relative URL (`/api/file/{id}`) 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 '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 |
| 413 | A file exceeds 50 MiB or request body exceeds 500 MiB |
Download File
Downloads an uploaded file.
File URLs returned by the API, such as stableUrl and url from the upload endpoints, point to /api/file/{id}. That URL serves the same file with the same API key or OAuth authentication, so you can fetch it directly.
Path Parameters
id: The file identifier returned by the upload endpoints
Response
The file content, with the file's MIME type as Content-Type.
Example Request
curl \
-H "Authorization: ApiKey your.api.key.here" \
-o file.png \
https://your-company.your-region-code.qasphere.com/api/public/v0/file/1CJLabPkq_PWeS4siaKcB1kUse 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.
Relative file URLs in responses
Read endpoints (e.g. GET /tcase/{tcase_or_legacy_id}, GET /run/paginated, GET /run/{run_id}/tcase/{tcase_or_legacy_id}) return file references embedded in HTML fields, such as precondition.text, steps[].description, steps[].expected, run descriptions, and result 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) and use Download File. In the dedicated files[] field of test case responses, stableUrl is host-relative for uploaded files and url is absolute; both are absent for legacy attachments.