> ## Documentation Index
> Fetch the complete documentation index at: https://docs.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`](/api-reference/attachments/pre-upload-a-file)                      | Pre-upload a file       |
| `GET`    | [`/v1/attachments/{attachmentId}`](/api-reference/attachments/get-attachment-metadata) | Get attachment metadata |
| `DELETE` | [`/v1/attachments/{attachmentId}`](/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](/api-reference/errors#1005), [2001](/api-reference/errors#2001), [2003](/api-reference/errors#2003), [2004](/api-reference/errors#2004), [3006](/api-reference/errors#3006).

## Next steps

* [API overview](/api-reference/overview)
* [Error codes](/api-reference/errors)
* [Receive events](/events)
