---
title: "Upload blob data as an attachment to the given test case"
method: POST
path: "/testcase/upload-attachment/{id}"
tags: ["TestCase"]
---

# Upload blob data as an attachment to the given test case

`POST /testcase/upload-attachment/{id}`

## Request

- Base URL: `https://app.testiny.io/api/v1`
- URL: `https://app.testiny.io/api/v1/testcase/upload-attachment/{id}`
- Auth: API key in header `X-Api-Key`
- TypeScript: <https://skmtc.dev/testiny/apis/testiny-api/docs/testcase/upload-attachment/:id/post.ts> (a function with typed inputs; its response is checked against the schema)

Upload blob data (in the request body) as an attachment to the given test case, with the blob metadata specified in the query parameters

## Path parameters

- `id` integer, required

## Query parameters

- `title` string, required
- `filename` string, required
- `mime_type` string

## Request body `application/octet-stream`

- string, binary

## Response `200`

Returns 'Blob'

- Blob
  - `id` integer: The unique entity id - must be a positive integer
  - `title` string: An optional descriptive title for the blob
  - `is_deleted` boolean: If the entity has been soft-deleted this value is true
  - `project_id` integer: The project id this entity or mapping belongs to
  - `created_at` string, date-time: The creation time for this entity or mapping value
  - `created_by` number: The creator user id of this entity or mapping value - or zero if created by the system
  - `modified_at` string, date-time: The last modification time for this entity or mapping value
  - `modified_by` number: The id of the user who last modified or undeleted this entity or mapping value - or zero if modified by the system
  - `deleted_at` string, date-time: The soft-deletion time for this entity or mapping value
  - `deleted_by` number: The id of the user who deleted this entity or mapping value - or zero if deleted by the system
  - `blob_id` string: A globally unique id for the blob
  - `mime_type` string: The MIME type of the blob (e.g. image/jpeg)
  - `filename` string: The file name of the blob when it was uploaded. Should have an extension compatible with the 'mime_type'
  - `size` number: The size in bytes of the final blob
  - `external_key` string: An optional external key for identification
  - `data` string: The base64 data of the blob when uploading - as an alternative to uploading the blob in a separate request (for small blobs)

## Other responses

- `4XX`: The request failed because invalid request parameters or data were supplied or access was denied.
- `5XX`: The request failed because an error occurred during processing of the request.

---

[API](https://skmtc.dev/testiny/apis/testiny-api.md) - [All operations](https://skmtc.dev/testiny/apis/testiny-api/llms.txt) - [OpenAPI document](https://skmtc.dev/testiny/apis/testiny-api/revisions/8f7643b2429d?raw)
