> 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.

# Get Settlement Batches

GET https://agencyapi.afterpay.com/v1/settlement/batches

Returns a list of settlement batches, sorted by creation date in ascending order.

Reference: https://developers.afterpay.com/afterpay-partner-api/api-reference/reference-partner-api/settlements/get-settlement-batches

## Servers

- `https://agencyapi.afterpay.com` (Production, default)
- `https://agencyapi.sandbox.afterpay.com` (Sandbox)

## Request

### Query parameters

- `limit` (integer, optional) — Maximum number of rows to return. Defaults to 15 if not specified.
- `last_known` (string, optional) — A settlement batch ID. Results will contain all settlement batches whose creation date is greater than that of the last_known ID.

### Headers

- `Accept` (string, required, default: application/json) — Specifies media types that are acceptable for the response.

## Response

### 200

Successful response with a list of settlement batches.

- `settlement_batches` (list of BatchSettlementSettlementBatchesItems, optional)
- `meta_data` (BatchSettlementMetaData, optional)

## Errors

### 401 Unauthorized Error

Unauthorized, HMAC verification failed

- `timestamp` (string, optional) — Timestamp of the response.
- `status` (integer, optional) — The HTTP status code.
- `error` (string, optional) — Name of the error that occurred.
- `message` (string, optional) — A human-readable message which provides more details about the error.
- `path` (string, optional) — The attempted endpoint.

### 503 Service Unavailable Error

Service unavailable.

- `timestamp` (string, optional) — Timestamp of the response.
- `status` (integer, optional) — The HTTP status code.
- `error` (string, optional) — Name of the error that occurred.
- `message` (string, optional) — A human-readable message which provides more details about the error.
- `path` (string, optional) — The attempted endpoint.

## Types

### BatchSettlementSettlementBatchesItems

- `id` (string, optional) — Settlement batch ID.
- `created_at` (string, optional) — Creation date of the settlement batch ID.

### BatchSettlementMetaData

- `more_data` (boolean, optional) — Whether there is more settlement batches beyond the limit provided.
- `computed_at` (string, optional) — Timestamp of the query computation.

## Examples

**Response**

```json
{
  "settlement_batches": [
    {
      "id": "2020-07-10Z_a8xhc6DJF3h48377DCV",
      "created_at": "2020-07-10T22:53:46Z"
    }
  ],
  "meta_data": {
    "more_data": true,
    "computed_at": "2024-02-21T18:53:26Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://agencyapi.afterpay.com/v1/settlement/batches"

querystring = {"limit":"100","last_known":"785389121238"}

headers = {
    "Accept": "application/json",
    "User-Agent": "User-Agent"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://agencyapi.afterpay.com/v1/settlement/batches?limit=100&last_known=785389121238';
const options = {
  method: 'GET',
  headers: {Accept: 'application/json', 'User-Agent': 'User-Agent'}
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://agencyapi.afterpay.com/v1/settlement/batches?limit=100&last_known=785389121238"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("User-Agent", "User-Agent")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://agencyapi.afterpay.com/v1/settlement/batches?limit=100&last_known=785389121238")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Accept"] = 'application/json'
request["User-Agent"] = 'User-Agent'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://agencyapi.afterpay.com/v1/settlement/batches?limit=100&last_known=785389121238")
  .header("Accept", "application/json")
  .header("User-Agent", "User-Agent")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://agencyapi.afterpay.com/v1/settlement/batches?limit=100&last_known=785389121238', [
  'headers' => [
    'Accept' => 'application/json',
    'User-Agent' => 'User-Agent',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://agencyapi.afterpay.com/v1/settlement/batches?limit=100&last_known=785389121238");
var request = new RestRequest(Method.GET);
request.AddHeader("Accept", "application/json");
request.AddHeader("User-Agent", "User-Agent");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Accept": "application/json",
  "User-Agent": "User-Agent"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://agencyapi.afterpay.com/v1/settlement/batches?limit=100&last_known=785389121238")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```