---
title: "Upload an operator attachment"
description: "Uploads one file as the raw request body for a later message's attachment_ids (at most 8 per message)."
canonical: "https://www.cool.computer/docs/api-reference/operator/upload-an-operator-attachment"
---
# Upload an operator attachment

> Uploads one file as the raw request body for a later message's attachment_ids (at most 8 per message).

```http
POST https://api.cool.computer/api/operator/attachments
```

Uploads one file as the raw request body for a later message's attachment_ids (at most 8 per message). The bytes decide the kind, never Content-Type: a PNG, JPEG, GIF or WebP image of up to 20 MiB, 25 megapixels and 16384 pixels on a side, stored as the model receives it (within 2000x2000 and 4.5 MiB of base64; larger images are oriented, scaled and re-encoded, and width and height report the stored size). An image carrying metadata (EXIF such as orientation or GPS, XMP, IPTC, comments or PNG text) is oriented and re-encoded so no metadata is stored, a GIF is stored as a PNG of its first frame, animated PNG and WebP are refused, and an image whose decoding would take too much memory (such as a large progressive or 16-bit image) is refused with 413; an MP4, MOV or WebM video of up to 32 MiB, which the agent can copy to an account computer with cool_copy_attachment to inspect; or a UTF-8 text file of up to 1 MiB with its media type in Content-Type. A refusal says what to change; 413 means the file is too large. A member keeps at most 32 unsent uploads and 256 MiB, and an account stores at most 512 attachments and 1 GiB until their chats are deleted (429). An account uploads at most 2 files at once; another is refused with 429 attachment_upload_busy and Retry-After. Callers: the account owner with a user API key, user access token, claimed agent access token, or MCP token; organization API keys are refused. The body must keep coming: it may wait at most a minute in all for each 4 KiB, and the request at most 15 minutes, or it is ended with 408 request_body_timeout; send it again.

## Authorization

- A Cool Computers API key, user access token, or claimed agent access token in the Authorization header. Follow https://www.cool.computer/auth.md for agent registration and https://www.cool.computer/authentication.md for direct user credentials.

## Parameters

- `filename` (query, string, at least 1 characters, required): The file's name.

## Request body

Required.

- `*/*` (string, binary)

## Responses

- `201`: The stored attachment.
  - `application/json` (object)
    - `id` (string, required)
    - `filename` (string, required)
    - `media_type` (string, required): image/png, image/jpeg, image/gif, image/webp, video/mp4, video/quicktime, video/webm, or a text type.
    - `size_bytes` (integer, at least 0, required)
    - `width` (integer, at least 1): An image's stored width, the width the model sees.
    - `height` (integer, at least 1): An image's stored height, the height the model sees.
- `400`: Bad Request.
- `401`: Unauthorized.
- `403`: Forbidden.
- `413`: Payload Too Large.
- `429`: Too Many Requests. If the problem code is api_request_rate_exceeded, wait for Retry-After seconds; other problem codes describe a separate limit.
- `500`: Internal Server Error.
- `default`: A machine-readable API error with a stable code and recovery instruction.

An error is an `application/problem+json` document with a stable `code`; [API errors](/docs/api-reference/errors) says how to handle one.

## Example

```sh
curl -X POST "https://api.cool.computer/api/operator/attachments" \
  --url-query "filename=$PARAM_FILENAME" \
  -H "authorization: Bearer $TOKEN" \
  --data-binary @file
```

`--url-query` encodes the value it sends and needs curl 7.87 or later.
