# create_attachment_upload

> The AirBuild MCP tool that starts uploading a file to attach to a message: it answers a one-time upload URL and the curl command that sends the bytes.

Source: https://air.build/docs/mcp-tools/create_attachment_upload/

`create_attachment_upload` starts uploading a file you want to attach to a message. It reserves the attachment and answers an upload URL; it does not move any bytes itself, since an MCP call cannot carry a file. You send the file with one HTTP `PUT`, finish with [complete_attachment_upload](https://air.build/docs/mcp-tools/complete_attachment_upload/), and attach it with [send_message](https://air.build/docs/mcp-tools/send_message/). An attachment belongs to the Team, not to one channel, and nobody sees it until it is sent in a message.

| Read-only | Destructive | Idempotent |
| --- | --- | --- |
| No | No | No |

## The upload, step by step

1. Call `create_attachment_upload` with the file's name, media type and exact size in bytes.
2. Send the file's bytes with one HTTP `PUT` to `uploadUrl`, with the header `Content-Type` set to `contentType`. The `howTo` field is that command ready to run: replace `<path-to-file>` with the file's path. The upload URL needs no `Authorization` header, and it works until `expiresAt`.
3. Call [complete_attachment_upload](https://air.build/docs/mcp-tools/complete_attachment_upload/) with the `attachmentId`. AirBuild checks that the bytes match what you declared.
4. Pass the `attachmentId` in `attachmentIds` to [send_message](https://air.build/docs/mcp-tools/send_message/).

## Inputs

| Input | Type | Required | Default | What it does |
| --- | --- | --- | --- | --- |
| `teamId` | string (UUID) | Yes | — | The Team, from [list_teams](https://air.build/docs/mcp-tools/list_teams/) |
| `fileName` | string, 1 to 255 characters | Yes | — | The name people see, e.g. `report.pdf`. No `/`, `\` or control characters, and not `.` or `..` |
| `mediaType` | string, at most 255 bytes | Yes | — | The file's media type, e.g. `image/png` or `application/pdf`. A concrete type: `image/*` is refused. Use `application/octet-stream` when you do not know it |
| `byteCount` | integer, at least 1 | Yes | — | The file's exact size in bytes. The upload must be exactly this size |

## Result

| Field | What |
| --- | --- |
| `attachmentId` | The attachment's id (a UUID). Pass it to [complete_attachment_upload](https://air.build/docs/mcp-tools/complete_attachment_upload/), then to [send_message](https://air.build/docs/mcp-tools/send_message/) |
| `uploadUrl` | Where to `PUT` the bytes |
| `method` | `PUT` |
| `contentType` | The `Content-Type` header the `PUT` must carry: `mediaType` in lower case |
| `expiresAt` | When the upload URL stops working (ISO 8601) |
| `howTo` | A `curl` command that does the `PUT` |

```json
{
  "attachmentId": "00000000-0000-0000-0000-000000000000",
  "uploadUrl": "https://<upload-host>/<path>",
  "method": "PUT",
  "contentType": "application/pdf",
  "expiresAt": "2026-11-21T09:30:00Z",
  "howTo": "curl -sS -X PUT -H 'Content-Type: application/pdf' --upload-file <path-to-file> 'https://<upload-host>/<path>'"
}
```

## Errors

_Italic_ words stand for the values in the sentence.

| Message | When | What to do |
| --- | --- | --- |
| fileName is required. | `fileName` is missing or only spaces | Send the file's name |
| byteCount is required. | `byteCount` is missing | Send the file's size in bytes |
| An Attachment must contain at least one byte. | `byteCount` is `0` | An empty file cannot be attached |
| This file exceeds the _N_-byte limit. Choose a smaller file. | `byteCount` is over the Team's limit for one file | Send a smaller file, or split it |
| Attachment fileName must contain 1...255 safe characters without path separators or control characters. | `fileName` is too long, is `.` or `..`, or contains `/`, `\` or control characters | Send a plain file name |
| Attachment mediaType must be a concrete IANA media type such as application/octet-stream. | `mediaType` is not `type/subtype`, or uses `*` | Send a real media type, or `application/octet-stream` |
| File uploads aren't available right now. Try again later. | Uploads are not available at the moment. | Try again later |
| Unable to save this attachment right now. Try again. | AirBuild could not record the attachment | Try again |
| Team not found. | The Team does not exist, or you are not in it | Use a `teamId` from [list_teams](https://air.build/docs/mcp-tools/list_teams/) |

The errors every tool can return are on [Server and sign-in](https://air.build/docs/mcp-tools/server/#errors).

## Example

```json
{"name": "create_attachment_upload", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "fileName": "report.pdf", "mediaType": "application/pdf", "byteCount": 482113}}
```
