# POST /api/v1/notes/{note_id}/attachments/upload-url

> Get upload URL for note attachment

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

## Description

Generate a presigned URL to upload a file to S3 for a note.

## Authentication

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

## Parameters

- `note_id` (path, string, required)

## Request body

Schema: `NoteAttachmentUploadUrlRequest`

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

## Responses

### 201 — Successful Response

### 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/upload-url' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "file_name": "string",
  "mime_type": "string",
  "file_size": 0
}'
```

### JavaScript

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

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

## See also

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