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

# List treasury accounts

GET https://api.useroot.com/api/treasury/accounts

Returns a paginated list of main treasury accounts onboarded for your organization.

Each item includes account identifier, display label, optional last-four digits, and currency. Balance and transaction detail are available on the account-scoped endpoints.

**Query parameters**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `cursor` | String | No | Pagination cursor from `next_cursor` in a prior response. |
| `limit` | Integer | No | Page size. |
| `order` | String | No | Sort order by account creation time: `asc` or `desc`. |

**Success Responses**

| Status Code | Description |
|-------------|-------------|
| 200 | OK — paginated list of treasury accounts |

**Error Responses**

| Status Code | Error Code | Description |
|-------------|------------|-------------|
| 400 | VALIDATION_ERROR | Invalid query parameters |
| 401 | AUTHENTICATION_ERROR | Authentication credentials are invalid or missing |
| 403 | AUTHORIZATION_ERROR | You do not have permission to perform this action |

Reference: https://useroot.docs.buildwithfern.com/api-reference/treasury-api/list-treasury-accounts

## Authentication

- `x-api-key` header (required) — RootPay API key sent in the x-api-key header. Keys are environment-scoped: live_* for production, test_* for sandbox.

## Request

### Query parameters

- `cursor` (string, optional, nullable) — Cursor for pagination. Use the next_cursor from the previous response to get the next page.
- `limit` (integer, optional, default: 50) — Number of items to return per page. Maximum is 500.
- `order` (enum, optional) — Sort order for results by creation time.
  - Allowed values: `desc`, `asc`

## Response

### 200

Successful Response

- `data` (list of object, required)
  - `id` (string, required) — Main operating account ID.
  - `label` (string, required)
  - `currency_code` (string, required)
  - `created_at` (datetime, required)
  - `updated_at` (datetime, required)
  - `last_four_digits` (string, optional, nullable)
- `has_more` (boolean, required)
- `total_count` (integer, optional, nullable, default: 0)
- `next_cursor` (string, optional, nullable)
- `previous_cursor` (string, optional, nullable)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "data": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "label": "Operating Account - Main",
      "currency_code": "USD",
      "created_at": "2024-01-15T09:30:00Z",
      "updated_at": "2024-01-15T09:30:00Z",
      "last_four_digits": "1234"
    }
  ],
  "has_more": true,
  "total_count": 1,
  "next_cursor": "3fa85f64-5717-4562-b3fc-2c963f66afb0",
  "previous_cursor": "3fa85f64-5717-4562-b3fc-2c963f66af9f"
}
```

**SDK Code**

```python
import requests

url = "https://api.useroot.com/api/treasury/accounts"

payload = {}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.get(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.useroot.com/api/treasury/accounts';
const options = {
  method: 'GET',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/treasury/accounts"

	payload := strings.NewReader("{}")

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

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	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://api.useroot.com/api/treasury/accounts")

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

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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://api.useroot.com/api/treasury/accounts")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.useroot.com/api/treasury/accounts', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/treasury/accounts");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/treasury/accounts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```