# POST /api/v1/notes/{note_id}/attachments

> Register note attachment

- **Tag:** notes
- **Operation ID:** `create_attachment_api_v1_notes__note_id__attachments_post`

## Description

Register a new attachment for a note after successful S3 upload.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Parameters

- `note_id` (path, string, required)

## Request body

Schema: `NoteAttachmentCreateRequest`

- `file_name` (string · required)
- `file_size` (integer · required)
- `mime_type` (string · required)
- `s3_key` (string · required)

## Responses

### 201 — Successful Response

Schema: `AttachmentResponse`

- `id` (string · required)
- `note_id` (string · required)
- `file_name` (string · required)
- `file_size` (integer · required)
- `mime_type` (string · required)
- `uploaded_by` (string · required)
- `created_at` (string · date-time · required)

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 404 — Not Found - Resource does not exist

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/notes/{note_id}/attachments' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "file_name": "string",
  "file_size": 0,
  "mime_type": "string",
  "s3_key": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/notes/{note_id}/attachments', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "file_name": "string",
  "file_size": 0,
  "mime_type": "string",
  "s3_key": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {
  "file_name": "string",
  "file_size": 0,
  "mime_type": "string",
  "s3_key": "string"
}

response = httpx.post("https://api.ondayzero.com/api/v1/notes/{note_id}/attachments", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/notes/create-attachment
- OpenAPI slice: https://www.ondayzero.com/docs/reference/notes/create-attachment/openapi.json
- Other endpoints in **notes**: https://www.ondayzero.com/docs/reference/notes
