---
title: "POST /v1/mailboxes/{mailboxId}/drafts/{draftId}/files"
method: POST
path: "/v1/mailboxes/{mailboxId}/drafts/{draftId}/files"
---

# POST /v1/mailboxes/{mailboxId}/drafts/{draftId}/files

`POST /v1/mailboxes/{mailboxId}/drafts/{draftId}/files`

## Request

- The document declares no server URL.
- Auth: one of:
  - OAuth 2 (authorization code, authorization URL `/authorize`, token URL `/oauth/token`, scopes: `email.write`)
  - HTTP bearer

Upload a file into a draft.

## Path parameters

- `mailboxId` string, required
- `draftId` string, required

## Query parameters

- `filename` string, required: Bounds mirroring `domain/email/message-part.ts` — every one of these arrives in a stranger's MIME headers, so the cap is the contract, not tidiness.

## Request body `*/*`

- unknown

## Response `201`

The request has succeeded and a new resource has been created as a result.

- DraftFile: A file uploaded into a draft. Its bytes are kept until the draft is sent or discarded.
  - `fileId` string, required: Name it to a send as `{ fileId }`, or to `removeDraftFile`.
  - `filename` string, required: Bounds mirroring `domain/email/message-part.ts` — every one of these arrives in a stranger's MIME headers, so the cap is the contract, not tidiness.
  - `contentType` string, required
  - `size` integer, required: Octets.

## Other responses

- `400`: The server could not understand the request due to invalid syntax.
- `401`: Access is unauthorized.
- `403`: Access is forbidden.
- `404`: The server cannot find the requested resource.
- `413`: Client error
- `422`: Client error
- `default`: An unexpected error response.

---

[API](https://skmtc.dev/foundermail/apis/mailbox.md) - [All operations](https://skmtc.dev/foundermail/apis/mailbox/llms.txt) - [OpenAPI document](https://skmtc.dev/foundermail/apis/mailbox/revisions/6a50628a86ed?raw)
