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

# Recover Transaction

> POST /v1/transactions/:operationId/recover — Recover a broadcast but unsubmitted transaction

<Note>
  **Endpoint:** `POST https://api.rebelfi.io/v1/transactions/:operationId/recover`
</Note>

Recover a transaction that was broadcast to the blockchain but not properly submitted to RebelFi. Use this when you broadcast a signed transaction but forgot to call `submit-hash`, or if the `submit-hash` call failed.

### Path Parameters

| Parameter     | Type     | Required | Description                             |
| ------------- | -------- | -------- | --------------------------------------- |
| `operationId` | `number` | Yes      | Operation ID the transaction belongs to |

### Request Body

| Field           | Type     | Required | Description                                                                |
| --------------- | -------- | -------- | -------------------------------------------------------------------------- |
| `txHash`        | `string` | Yes      | On-chain transaction hash that was broadcast                               |
| `transactionId` | `number` | No       | Target transaction ID. If omitted, matches the first unsigned transaction. |

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.rebelfi.io/v1/transactions/123/recover" \
    -H "x-api-key: your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "txHash": "5UfD...xyz"
    }'
  ```

  ```typescript SDK theme={null}
  const result = await client.transactions.recover(123, {
    txHash: '5UfD...xyz'
  });
  ```
</CodeGroup>

### Example Response

```json theme={null}
{
  "success": true,
  "transactionId": 456,
  "txHash": "5UfD...xyz"
}
```

### Errors

| Code                       | Description                                    |
| -------------------------- | ---------------------------------------------- |
| `OPERATION_NOT_FOUND`      | Operation ID doesn't exist                     |
| `TRANSACTION_NOT_FOUND`    | No matching transaction found in the operation |
| `INVALID_OPERATION_STATUS` | Operation is not in a recoverable state        |

<Tip>
  Recovery is useful when your application crashes after broadcasting but before calling `submit-hash`. The transaction is already on-chain — recovery links it back to the operation so RebelFi can track confirmation.
</Tip>
