> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pazy.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Expense attachment events

> The expense.attachment.updated event, and how to download the receipt or document it refers to

## `expense.attachment.updated`

Fired whenever a document is attached to or removed from an expense, whether that's the receipt or a supporting file. Link-type attachments raise no event, because there is no file to download.

This is the event to use if you need receipts. A card or UPI receipt is almost always uploaded **after** the payment, so [`expense.transaction.status_changed`](/webhooks/events/expense-transaction) has already been delivered by then. Receipts aren't mandatory at approval time either.

### Actions and types

| `action` | Meaning |
| - | - |
| `ATTACHMENT_ADDED` | The document was attached |
| `ATTACHMENT_DELETED` | The document was removed, or a receipt was replaced |

| `attachmentType` | Meaning |
| - | - |
| `RECEIPT` | The expense's receipt. There is one per expense. Replacing it fires `ATTACHMENT_DELETED`, then `ATTACHMENT_ADDED` |
| `SUPPORTING_DOCUMENT` | Any additional file attached to the expense |

### Fields

| Field | Type | Description |
| - | - | - |
| `id` | string | The expense id |
| `action` | string | `ATTACHMENT_ADDED` or `ATTACHMENT_DELETED` |
| `attachmentType` | string | `RECEIPT` or `SUPPORTING_DOCUMENT` |
| `documentKey` | string | Pass it to the download API to fetch the file. Always present |
| `name` | string \| null | Original file name |
| `mimeType` | string \| null | For example `application/pdf` |
| `actor` | object \| null | `{ id, name }`, who attached or removed it. `name` can be `null` |
| `createdAt` | string (ISO 8601) \| null | When the change happened |

### Example

```json theme={null}
{
  "id": "expc565tCAdkzPhHpFXUqT6H",
  "action": "ATTACHMENT_ADDED",
  "attachmentType": "RECEIPT",
  "documentKey": "8a8eb752-5644-4bc3-86a1-4c3de24362da.png",
  "name": "restaurant-bill.png",
  "mimeType": "image/png",
  "actor": { "id": "usr_9f2c", "name": "Priya Sharma" },
  "createdAt": "2026-08-10T18:42:11.000Z"
}
```

## Download the file

Pass `documentKey` as `fileKey` to the [File Download API](/apis/download-file), authenticated with your API key. No other call is needed.

| `attachmentType` | Request |
| - | - |
| `RECEIPT` | `GET /v1.0/download/expense?fileKey=<documentKey>` |
| `SUPPORTING_DOCUMENT` | `GET /v1.0/download/expense-attachment?fileKey=<documentKey>` |

```bash theme={null}
curl -X GET "https://api.pazy.io/v1.0/download/expense?fileKey=8a8eb752-5644-4bc3-86a1-4c3de24362da.png" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -o restaurant-bill.png
```

The response is the file itself, with a `Content-Type` header and a `Content-Disposition` filename.

<Warning>
  A `documentKey` stops working once its document is removed or replaced, and the download then returns `404`. Fetch the file when the event arrives, rather than saving keys to download later.
</Warning>

For a complete walkthrough, see [Collect expense receipts with webhooks](/guides/collect-expense-receipts-with-webhooks).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.