# Related counterparties

List counterparties associated with this payment method.

Returns the shared-association rows for the instrument. Exclusive instruments typically have none here; the owner is counterparty_id on the payment method itself.


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

## Path parameters

| Name | Type | Required | Description | Allowed values | Example |
| --- | --- | --- | --- | --- | --- |
| `code` | string, max 50 | required | Payment method code (`code`). |  | `PM-001` |



## 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 payment_methods:read` | `403` | The key does not include payment_methods: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. |
| `Tenant ID required` | `400` | The authenticated credential is not bound to a 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/payment-methods/PM-001/counterparties \
  --header 'accept: application/json' \
  --header 'authorization: Bearer uk_live_YOUR_API_KEY'
```

## Request (Python)

```python
import requests

url = "https://api.invunion.com/api/v1/payment-methods/PM-001/counterparties"
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/payment-methods/PM-001/counterparties")
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/payment-methods/PM-001/counterparties", {
  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/payment-methods/PM-001/counterparties", 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/payment-methods/PM-001/counterparties", {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "Authorization": "Bearer uk_live_YOUR_API_KEY"
  },
});
console.log(await response.json());
```

## Success (200)

```json
{
  "success": true,
  "data": [
    {
      "counterparty_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "counterparty_name": "Leones Cars",
      "counterparty_code": "CPT-042"
    },
    {
      "counterparty_id": "4b7a91c2-18e4-4d6f-a8c1-9e2d5f0b73a1",
      "counterparty_name": "Grove Street Garage",
      "counterparty_code": "CPT-043"
    }
  ]
}
```
