# Output spend status

`GET https://api.rarebl.com/open/tx/outspends`

For each output of a UTXO transaction, whether it is spent, by which transaction, and whether the spend is still in the mempool.

**Rate class:** read (5 requests per second, burst 20, per IP). **Available since:** Open API v2.

## Request

Send the parameters as query parameters (GET) or as a JSON object (POST with `Content-Type: application/json`). They are identical either way. No API key is needed: `X-API-KEY` is reserved and ignored.

Example: `curl "https://api.rarebl.com/open/tx/outspends?chain=btc&id=9dedeb8092d6f026d235e3beb24337ba5657635a38cc949f70c0f28ea15e30db"`

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `chain` | string | Yes | A UTXO chain. One of: btc, ltc, bch, dash. |
| `id` | string | Yes | The transaction hash. 64 hex characters. |

## Responses

### API200 (HTTP 200): OK

Output 0 is unspent, output 1 is spent.

```json
{
  "status": 1,
  "code": "API200",
  "message": "success",
  "data": {
    "outputs": [
      {
        "n": 0,
        "spent": false,
        "spentBy": null,
        "inMempool": false
      },
      {
        "n": 1,
        "spent": true,
        "spentBy": "15f0189bea2a90b1b7232e96e9d9728ac72187133ce2ad33f2ee464f45cb8fa8",
        "inMempool": false
      }
    ]
  },
  "go": null,
  "meta": {
    "requestid": "0123456789abcdef",
    "notices": []
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `data.outputs[]` | object[] | `{n, spent: true\|false\|null, spentBy: txid\|null, inMempool: bool}`. `spent` is null when it cannot be told. |

### API400 (HTTP 400): Bad Request

A parameter is missing or malformed. `data.param` names it (here `id`).

```json
{
  "status": 0,
  "code": "API400",
  "message": "Transaction id must be a 64-character hash.",
  "data": {
    "param": "id"
  },
  "go": null,
  "meta": {
    "requestid": "0123456789abcdef",
    "notices": []
  }
}
```

### API404 (HTTP 404): Not Found

The transaction does not exist.

```json
{
  "status": 0,
  "code": "API404",
  "message": "Transaction not found.",
  "data": null,
  "go": null,
  "meta": {
    "requestid": "0123456789abcdef",
    "notices": []
  }
}
```

### API429 (HTTP 429): Too Many Requests

Rate limited (read class: 5 requests per second, burst 20, per IP). A `Retry-After` header says how long to wait, in seconds.

```json
{
  "status": 0,
  "code": "API429",
  "message": "Too many requests. Please retry shortly.",
  "data": null,
  "go": null,
  "meta": {
    "requestid": "0123456789abcdef",
    "notices": []
  }
}
```

### API502 (HTTP 502): Bad Gateway

The node is unavailable, still syncing or timed out. Retry later with a short back-off.

```json
{
  "status": 0,
  "code": "API502",
  "message": "The node is unavailable or timed out. Please try again.",
  "data": null,
  "go": null,
  "meta": {
    "requestid": "0123456789abcdef",
    "notices": []
  }
}
```

## Notes

- Check this before you spend an output, to be sure it is still unspent.
- UTXO chains only.
