> ## Documentation Index
> Fetch the complete documentation index at: https://docs.staging.relayapp.im/llms.txt
> Use this file to discover all available pages before exploring further.

# Attachments

> Read the upload state and download URL for stored media.

Read the upload state and download URL for stored media.

## The Attachment object

| Field | Type | Description |
| - | - | - |
| `id` | string | Unique identifier for the attachment (UUID) |
| `filename` | string | Original filename of the attachment |
| `content_type` | string | Declared MIME type, lowercased. Relay stores and returns the original bytes unchanged. |
| `size_bytes` | integer | Size of the attachment in bytes |
| `status` | string | Current upload state. |
| `download_url` (optional) | string | URL to download the attachment |
| `created_at` | string | When the attachment was created |
| `duration_ms` (optional) | integer or null | Audio or video duration in milliseconds when known. |
| `width` (optional) | integer or null | Pixel width when known. Width and height are supplied together. |
| `height` (optional) | integer or null | Pixel height when known. Width and height are supplied together. |

## Example

An attachment object, as `GET /v1/attachments/{attachmentId}` returns it:

| Field | Type | Meaning |
| - | - | - |
| `id` | string | Unique identifier for the attachment (UUID) |
| `filename` | string | Original filename of the attachment |
| `content_type` | string | Declared MIME type, lowercased |
| `size_bytes` | integer | Size of the attachment in bytes |
| `status` | string | Current upload state |
| `download_url` | string, optional | URL to download the attachment |
| `created_at` | string | When the attachment was created |
| `duration_ms` | \['integer', 'null'], optional | Audio or video duration in milliseconds when known |
| `width` | \['integer', 'null'], optional | Pixel width when known |
| `height` | \['integer', 'null'], optional | Pixel height when known |

## Operations

| Method | Path | What it does |
| - | - | - |
| `POST` | [`/v1/attachments`](https://docs.staging.relayapp.im/api-reference/attachments/pre-upload-a-file) | Pre-upload a file |
| `GET` | [`/v1/attachments/{attachmentId}`](https://docs.staging.relayapp.im/api-reference/attachments/get-attachment-metadata) | Get attachment metadata |
| `DELETE` | [`/v1/attachments/{attachmentId}`](https://docs.staging.relayapp.im/api-reference/attachments/delete-an-attachment) | Delete an attachment |

## Errors

Common authentication, validation, and server errors apply alongside resource errors. Read `error.message` for the rejected condition.

[1005](https://docs.staging.relayapp.im/api-reference/errors.md#1005), [2001](https://docs.staging.relayapp.im/api-reference/errors.md#2001), [2003](https://docs.staging.relayapp.im/api-reference/errors.md#2003), [2004](https://docs.staging.relayapp.im/api-reference/errors.md#2004), [3006](https://docs.staging.relayapp.im/api-reference/errors.md#3006).

## Next steps

* [API overview](https://docs.staging.relayapp.im/api-reference/overview.md)
* [Error codes](https://docs.staging.relayapp.im/api-reference/errors.md)
* [Receive events](https://docs.staging.relayapp.im/events.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.