<!-- source: https://secondlayer.tools/docs/api-reference#get-bitcoin-outspend -->

## Bitcoin output spend status

`GET /v1/bitcoin/outspend/{txid}/{vout}`

Whether one Bitcoin output is spent, and by which transaction, read live from this instance's Bitcoin node. A spend in the mempool shows on the next read, with `mempool: true`. A confirmed spend names its block. The spender of a confirmed spend is found by reading blocks back from the tip, up to 144 of them. A spend deeper than that answers `spent: true` with a null `spending_txid` and a `note`. Answers can change with the mempool and with reorgs, so they are cached for 2 seconds at most. Hosted: one row per answer, 20 requests per second per key. Self-host needs Bitcoin Core 24 or later with `txindex=1` at `BITCOIN_RPC_URL`.

### Path parameters

| Name | Type | Description |
| --- | --- | --- |
| `txid` | string, required | The txid of the transaction that created the output, display order: 64 hex characters, `0x` optional. |
| `vout` | integer, required | The output's index in that transaction, from 0. |

### Returns

One `BitcoinOutspend` object.

### Responses

- `200` The output's spend status
- `400` The txid is not 64 hex characters, or vout is not a non-negative integer (`VALIDATION_ERROR`)
- `401` This bind requires the instance token, and it was missing or wrong
- `404` No transaction with that txid, no output at that index, or an `OP_RETURN` output, which can never be spent
- `429` Rate limited; retry after `Retry-After` seconds
- `502` The Bitcoin node could not be read, or lacks a method this needs (`BITCOIN_SOURCE_ERROR`)
- `503` `BITCOIN_UNAVAILABLE`: this instance has no Bitcoin node (`BITCOIN_RPC_URL` unset). `BITCOIN_BUSY`: block reads are at capacity; retry after `Retry-After` seconds

### Example

```bash
curl https://api.secondlayer.tools/v1/bitcoin/outspend/f80a188d012dbb733748db003b987cc98fc4a636cbd071734decb298c1bad80b/0 \
  -H "Authorization: Bearer $SECONDLAYER_API_KEY"
```

```json
{
  "txid": "f80a188d012dbb733748db003b987cc98fc4a636cbd071734decb298c1bad80b",
  "vout": 0,
  "spent": true,
  "spending_txid": "3b7a6f0c2d9e1a4b5c8d7e6f0a1b2c3d4e5f60718293a4b5c6d7e8f9a0b1c2d3",
  "spending_vin": 0,
  "confirmed": true,
  "mempool": false,
  "block_height": 968470,
  "block_hash": "00000000000000000001c3b0d1a9f5e2e5b2a9c2d0f6c7e1b8a4d3c2b1a09f8e"
}
```
