> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blockradar.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Transactions

> Fetch, monitor, and manage all on-chain activity across your wallets

<Note>
  In a nutshell<br />
  Every deposit, withdrawal, swap, or sweep that flows through Blockradar creates a transaction record. The Transactions API is your activity log — use it to fetch history, investigate specific payments, trigger missed webhooks, cancel pending transactions, or retry failed ones.
</Note>

## Prerequisites

<Steps>
  <Step title="API Key">
    Get your API key from the [Blockradar Dashboard](https://dashboard.blockradar.co). Navigate to **Developers** to generate one.
  </Step>

  <Step title="Wallet Created">
    You'll need a `walletId` to query transactions. Create one via the dashboard or API.
  </Step>
</Steps>

## How It Works

When any on-chain event occurs on a Blockradar wallet: a deposit arriving, a withdrawal being submitted, a sweep being triggered, Blockradar creates a transaction record and fires a webhook. The Transactions API gives you programmatic access to all of these records.

<CardGroup cols={2}>
  <Card title="Fetch History" icon="clock-rotate-left">
    Retrieve all transactions for a wallet or filter by address, asset, status, or date range.
  </Card>

  <Card title="Investigate Payments" icon="magnifying-glass">
    Look up a specific transaction by ID to check its status, hash, and metadata.
  </Card>

  <Card title="Replay Webhooks" icon="rotate">
    Resend a webhook for a transaction your system may have missed or failed to process.
  </Card>

  <Card title="Cancel or Retry" icon="arrow-rotate-left">
    Cancel a stuck pending transaction or retry a failed one without re-submitting from scratch.
  </Card>
</CardGroup>

## Transaction States

| Status      | Description                                                    |
| ----------- | -------------------------------------------------------------- |
| `PENDING`   | Transaction submitted to the blockchain, awaiting confirmation |
| `SUCCESS`   | Transaction confirmed and settled                              |
| `FAILED`    | Transaction failed on-chain or was rejected                    |
| `CANCELLED` | Transaction was cancelled before it was broadcast              |

## Fetching Transactions

### Get all transactions for a wallet

```bash theme={null}
GET /v1/wallets/{walletId}/transactions
```

You can filter by address, asset, type, status, and date range using query parameters.

### Get a single transaction

```bash theme={null}
GET /v1/wallets/{walletId}/transactions/{transactionId}
```

### Example

```javascript theme={null}
const transactions = await fetch(
  `https://api.blockradar.co/v1/wallets/${walletId}/transactions?status=SUCCESS&limit=50`,
  {
    headers: { 'x-api-key': apiKey }
  }
).then(r => r.json());

console.log(transactions.data);
```

## Replaying a Missed Webhook

If your system missed or failed to process a webhook, you can trigger a resend without waiting for another on-chain event.

```bash theme={null}
POST /v1/wallets/{walletId}/transactions/{transactionId}/resend-webhook
```

This is useful for reconciliation flows and recovering from downtime.

## Cancelling a Pending Transaction

If a transaction is stuck in `PENDING` and hasn't been broadcast yet, you can cancel it.

```bash theme={null}
POST /v1/wallets/{walletId}/transactions/{transactionId}/cancel
```

<Warning>
  Cancellation is only possible before a transaction is broadcast to the blockchain. Once it's on-chain, it cannot be cancelled.
</Warning>

## Retrying a Failed Transaction

If a transaction failed due to insufficient gas or a temporary node issue, you can retry it.

```bash theme={null}
POST /v1/wallets/{walletId}/transactions/{transactionId}/retry
```

## Best Practices

* **Use webhooks as your primary signal** — don't poll the Transactions API for real-time updates. Use it for reconciliation, investigations, and history.
* **Store transaction IDs** — save the Blockradar transaction ID alongside your internal records so you can look up status at any time.
* **Replay webhooks after downtime** — if your webhook endpoint was unavailable, use the resend endpoint to recover missed events rather than re-processing manually.

## API Reference

| Endpoint                                                                  | Description                         |
| ------------------------------------------------------------------------- | ----------------------------------- |
| [Get Transactions](/en/api-reference/transactions/get-transactions)       | Fetch all transactions for a wallet |
| [Get Transaction](/en/api-reference/transactions/get-transaction)         | Fetch a single transaction by ID    |
| [Resend Webhook](/en/api-reference/transactions/resend-webhook)           | Replay a webhook for a transaction  |
| [Trigger Asset Sweep](/en/api-reference/transactions/trigger-asset-sweep) | Manually trigger a sweep            |
| [Cancel Transaction](/en/api-reference/transactions/cancel-transaction)   | Cancel a pending transaction        |
| [Retry Transaction](/en/api-reference/transactions/retry-transaction)     | Retry a failed transaction          |
