# Attach a file (base64, at most 20 MB, 25 MB and 20 files per message) to a draft

`POST /workspace/inbox/drafts/{id}/attachments` · Rivier · inbox

Attach a file (base64, at most 20 MB, 25 MB and 20 files per message) to a draft. Programs are refused whatever they are called; a scanner, when connected, can refuse more. The file is stored in the Library.

- Scope: inbox:write
- Graphql: Mutation.inboxAttachmentAdd
- Sdk: inbox.attachment.add
- Cli: inbox attachment add

## Parameters

- `id` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 300
    },
    "contentType": {
      "type": "string",
      "maxLength": 120
    },
    "dataBase64": {
      "type": "string",
      "minLength": 4,
      "maxLength": 28000000
    },
    "inline": {
      "type": "boolean"
    },
    "contentId": {
      "type": "string",
      "minLength": 3,
      "maxLength": 200
    }
  },
  "required": [
    "name",
    "dataBase64"
  ],
  "additionalProperties": false
}
```

## Responses

- `201`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/workspace/inbox/drafts/{id}/attachments' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "dataBase64": "string"
}'
```
