---
title: "Sets/updates attachment custom file name"
description: "PATCH /attachments/{attachment_id} — Once the custom file name is set it cannot be unset to nil/empty string"
canonical_url: https://developer.onepagecrm.com/api/reference/attachments/patch-attachments-attachment_id/
source: Markdown mirror of https://developer.onepagecrm.com/api/reference/attachments/patch-attachments-attachment_id/
---

`PATCH /attachments/{attachment_id}`

Once the custom file name is set it cannot be unset to nil/empty string

Resource: [Attachments](https://developer.onepagecrm.com/api/reference/attachments/) · [API Reference](https://developer.onepagecrm.com/api/reference/)

## Request

```bash
curl -X PATCH "https://app.onepagecrm.com/api/v3/attachments/{attachment_id}" \
  -u $user_id:$api_key \
  -H "Content-Type: application/json" \
  -d '{
    "attachment": {
      "custom_filename": "another_mario.jpg"
    }
  }'
```

Authentication is HTTP Basic — `user_id` as username, `api_key` as password.
See https://developer.onepagecrm.com/api/authentication/.

## Path parameters

| Name | Type | Description |
| --- | --- | --- |
| `attachment_id` | string | Attachment ID |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `attachment` | object |  |  |

## Responses

### 200

OK

```json
{
  "status": 0,
  "message": "OK",
  "timestamp": 1528373119,
  "data": {
    "id": "5afc1ea9d556730b780096db",
    "filename": "mario.jpg",
    "custom_filename": "another_mario.jpg",
    "pinned": true,
    "pinned_at": "2022-01-24T10:42:39Z",
    "size": 3841,
    "storage_provider": "amazon",
    "url": "https://{foo.bar}/mario.jpg",
    "url_expires_at": "2018-05-16T13:06:53Z",
    "thumbnail": {
      "url": "https://{foo.bar}/mario-thumbnail.jpg"
    }
  }
}
```

Standard error responses: 400, 401, 403, 404, 409, 500 — shared across the API. See https://developer.onepagecrm.com/api/errors/.

## Related guides

- [Authentication](https://developer.onepagecrm.com/api/authentication/)
- [Errors](https://developer.onepagecrm.com/api/errors/)
- [Rate limits](https://developer.onepagecrm.com/api/rate-limits/)
