> This page is for Afterpay Partner API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.afterpay.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.afterpay.com/_mcp/server.

# Retrieving Settlement Batch Files

The following example shows retrieving a settlement batch file by date.

1. Use the [Get Settlement Batches by Date](https://afterpay.docs.buildwithfern.com/afterpay-partner-api/guides/technical-guides/welcome/introduction) endpoint to correctly retrieve the settlement batch files associated with the given settlement date.

```curl
curl --location 'https://agencyapi.afterpay.com/v1/settlement/batches/date/{YYYY-MM-DD}' \
--header 'X-Afterpay-Request-Signature: <Request Signature>' \
--header 'X-Afterpay-Request-Date: <Request Date>' \
--header 'X-Afterpay-Request-Apikey: <API Key>' \
--header 'Content-Type: application/json' \
```

2. Once you have retrieved the relevant settlement batch IDs, use the [Get Settlement Batch Files](https://afterpay.docs.buildwithfern.com/afterpay-partner-api/guides/technical-guides/welcome/introduction) endpoint to retrieve the associated settlement and aggregation files.

```curl
curl --location 'https://agencyapi.afterpay.com/v1/settlement/batch?ids={settlement_batch_id}' \
--header 'X-Afterpay-Request-Signature: <Request Signature>' \
--header 'X-Afterpay-Request-Date: <Request Date>' \
--header 'X-Afterpay-Request-Apikey: <API Key>' \
--header 'Content-Type: application/json' \
```