# Get an affiliate

`GET /api/market/affiliates/{address}`

Any address of the network is an affiliate (no registration). Its totals and its newest referred purchases: purchases broadcast here whose referral applied. `registered` is informational, kept for compatibility.

#### Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `address` | string | yes | The affiliate's mainnet address. |

#### Example request

```bash title="cURL"
curl 'https://raresats.net/api/market/affiliates/bc1p4qhjn9zdvkux4e44uhx8tc55attvtyu358kutcqkudyccelu0was9fqzwh'
```
```js title="JavaScript"
const response = await fetch('https://raresats.net/api/market/affiliates/bc1p4qhjn9zdvkux4e44uhx8tc55attvtyu358kutcqkudyccelu0was9fqzwh');
const data = await response.json();
```
```python title="Python"
import requests

data = requests.get("https://raresats.net/api/market/affiliates/bc1p4qhjn9zdvkux4e44uhx8tc55attvtyu358kutcqkudyccelu0was9fqzwh").json()
```

#### Response `200`

| Field | Type | Description |
| --- | --- | --- |
| `address` | string | The affiliate's address, normalized. |
| `registered` | boolean | Informational, kept for compatibility: whether the address used the optional registration. Not needed to be paid: any address is an affiliate. |
| `registered_at` | integer \| null | When it used the optional registration (unix seconds), or `null`. |
| `share_bps` | integer | The affiliate's share of the platform fee in force, basis points. |
| `totals` | object |  |
| `totals.purchases` | integer | Referred purchases broadcast through the marketplace (pending or confirmed). |
| `totals.confirmed` | integer | Of those, confirmed. |
| `totals.pending` | integer | Of those, in the mempool. |
| `totals.earned` | integer | Sats paid to the affiliate in confirmed purchases. |
| `totals.pending_earned` | integer | Sats in purchases still in the mempool. |
| `totals.volume` | integer | Summed listing prices of the referred purchases. |
| `purchases` | array of object | The 25 newest referred purchases, newest first. |
| `purchases[].txid` | string | The purchase transaction. |
| `purchases[].items` | integer | Listings bought. |
| `purchases[].prices` | integer | Their summed prices. |
| `purchases[].platform_fee` | integer | The platform fee the buyer paid. |
| `purchases[].affiliate_fee` | integer | The affiliate's output. |
| `purchases[].status` | string | `pending` or `confirmed`. |
| `purchases[].time` | integer | Unix seconds. |

```json title="Response"
{
  "address": "bc1p4qhjn9zdvkux4e44uhx8tc55attvtyu358kutcqkudyccelu0was9fqzwh",
  "registered": false,
  "registered_at": null,
  "share_bps": 5000,
  "totals": {
    "purchases": 1,
    "confirmed": 1,
    "pending": 0,
    "earned": 757,
    "pending_earned": 0,
    "volume": 60546
  },
  "purchases": [
    {
      "txid": "6897451c42f02de2594abfdd6a5d4fcf4794a62cbbd9fbec1ec983893ddc5df4",
      "items": 1,
      "prices": 60546,
      "platform_fee": 1514,
      "affiliate_fee": 757,
      "status": "confirmed",
      "time": 1790952985
    }
  ]
}
```

#### Errors

`{error, code}`; see [Errors](https://raresats.net/docs/errors.md) for every code.

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `bad_address` | An address is not a mainnet address (or not one at all). |
| 400 | `bad_path` | The path is not valid percent-encoding. |

```json title="Error (400)"
{"error": "not a mainnet address", "code": "bad_address"}
```

Any address of the network is an affiliate. `registered` is informational, kept for compatibility: whether the address used the optional [registration](https://raresats.net/docs/register-affiliate.md), which is not needed to be paid. Only purchases whose referral **applied** count: an affiliate output is in the transaction. A referral that was `ignored_self`, `invalid` or `below_minimum` paid nothing and is not listed. The registering wallets' addresses are kept private. How the programme works: [Affiliates](https://raresats.net/docs/guide-affiliates.md).
