# Related invoices

List invoices billed to this counterparty.

Keyset-paginated list of invoices for the counterparty, newest invoice_date first. Each invoice includes matched transactions and credit-note allocations when present.


- HTTP method: `GET`
- Path: `/api/v1/counterparties/:code/invoices`
- URL: `https://api.invunion.com/api/v1/counterparties/:code/invoices`
- Required scope: `counterparties:read`
- HTML docs: https://www.invunion.com/knowledge-base/api/list-counterparty-invoices/
- Markdown docs: https://www.invunion.com/knowledge-base/api/list-counterparty-invoices.md

## Path parameters

| Name | Type | Required | Description | Allowed values | Example |
| --- | --- | --- | --- | --- | --- |
| `code` | string, max 50 | required | Counterparty code (`account_code`). |  | `CPT-042` |

## Query parameters

| Name | Type | Required | Description | Allowed values | Example |
| --- | --- | --- | --- | --- | --- |
| `pageSize` | integer | optional | Page size. Default 50, maximum 200. |  | `50` |
| `cursor` | string, no maximum | optional | Opaque cursor from the previous nextCursor. Keyset pagination. |  | `MjAyNi0wOS0wMV9fOWIxZGViNGQtM2I3ZC00YmFkLTliZGQtMmIwZDdiM2RjYjZk` |


## Errors

| Error | HTTP code | Description |
| --- | --- | --- |
| `Missing Bearer token` | `401` | The Authorization header is missing or is not a Bearer token. |
| `Invalid or revoked API key` | `401` | The API key is unknown, malformed, expired, or has been revoked. |
| `API key is missing scope counterparties:read` | `403` | The key does not include counterparties:read. A write scope does not imply the matching read scope. |
| `Too many requests, please try again later` | `429` | Wait and retry. The Retry-After header is the number of seconds to wait. |
| `Counterparty not found` | `404` | No counterparty with this code exists in the authenticated tenant. |
| `Internal server error` | `500` | Unexpected server error. The JSON body includes correlationId. Retry with backoff. |

## Request (curl)

```bash
curl --request GET \
  --url https://api.invunion.com/api/v1/counterparties/CPT-042/invoices?pageSize=50 \
  --header 'accept: application/json' \
  --header 'authorization: Bearer uk_live_YOUR_API_KEY'
```

## Request (Python)

```python
import requests

url = "https://api.invunion.com/api/v1/counterparties/CPT-042/invoices?pageSize=50"
headers = {
    "Accept": "application/json",
    "Authorization": "Bearer uk_live_YOUR_API_KEY",
}
response = requests.get(url, headers=headers)
print(response.json())
```

## Request (Ruby)

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

uri = URI("https://api.invunion.com/api/v1/counterparties/CPT-042/invoices?pageSize=50")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Accept'] = 'application/json'
request['Authorization'] = 'Bearer uk_live_YOUR_API_KEY'
response = http.request(request)
puts response.body
```

## Request (JavaScript)

```javascript
const response = await fetch("https://api.invunion.com/api/v1/counterparties/CPT-042/invoices?pageSize=50", {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "Authorization": "Bearer uk_live_YOUR_API_KEY"
  },
});
const data = await response.json();
```

## Request (Go)

```go
package main

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

func main() {
	req, err := http.NewRequest("GET", "https://api.invunion.com/api/v1/counterparties/CPT-042/invoices?pageSize=50", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Accept", "application/json")
	req.Header.Set("Authorization", "Bearer uk_live_YOUR_API_KEY")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
```

## Request (Node)

```javascript
const response = await fetch("https://api.invunion.com/api/v1/counterparties/CPT-042/invoices?pageSize=50", {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "Authorization": "Bearer uk_live_YOUR_API_KEY"
  },
});
console.log(await response.json());
```

## Success (200)

```json
{
  "success": true,
  "data": {
    "items": [
      {
        "id": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
        "invoice_number": "INV-2026-0042",
        "invoice_date": "2026-09-01",
        "invoice_type": "issued",
        "kind": "invoice",
        "status": "partial",
        "currency": "EUR",
        "amount_incl_vat": 2500,
        "settled_amount": 1000,
        "open_amount": 1500,
        "matched_transactions": [
          {
            "match_id": "1c9e6679-7425-40de-944b-e07fc1f90ae7",
            "transaction_id": "2d0e6679-7425-40de-944b-e07fc1f90ae7",
            "transaction_code": "TX-8891",
            "matched_amount": 1000,
            "match_type": "manual"
          }
        ],
        "credit_notes": []
      },
      {
        "id": "8ead24f5-4b17-4092-db14-21508c3ea6d4",
        "invoice_number": "INV-2026-0038",
        "invoice_date": "2026-08-15",
        "invoice_type": "issued",
        "kind": "invoice",
        "status": "unpaid",
        "currency": "EUR",
        "amount_incl_vat": 800,
        "settled_amount": 0,
        "open_amount": 800,
        "matched_transactions": [],
        "credit_notes": []
      }
    ],
    "nextCursor": null,
    "hasMore": false
  }
}
```
