# Check Transaction Status

## Check Status API

After the user signs a transaction in his wallet, you should periodically call this endpoint to check the status of the transaction.

{% tabs %}
{% tab title="Typescript (SDK)" %}

```typescript
const transaction = await rango.checkStatus({
    requestId: "b3a12c6d-86b8-4c21-97e4-809151dd4036", // bestRoute.requestId
    step: 1,
    txId: "0xfa88b705a5b4049adac7caff50c887d9600ef023ef1a937f8f8b6f44e90042b5"
})
```

{% endtab %}

{% tab title="Node.js (Axios)" %}

```typescript
const response = await axios.post(
  'https://api.rango.exchange/tx/check-status',
  {
    'requestId': 'b3a12c6d-86b8-4c21-97e4-809151dd4036',
    'txId': '0xfa88b705a5b4049adac7caff50c887d9600ef023ef1a937f8f8b6f44e90042b5',
    'step': 1
  },
  {
    params: {
      'apiKey': 'c6381a79-2817-4602-83bf-6a641a409e32'
    },
    headers: {
      'content-type': 'application/json'
    }
  }
);
```

{% endtab %}

{% tab title="Bash (cURL)" %}

```bash
curl --request POST \
     --url 'https://api.rango.exchange/tx/check-status?apiKey=c6381a79-2817-4602-83bf-6a641a409e32' \
     --header 'content-type: application/json' \
     --data '
{
  "requestId": "b3a12c6d-86b8-4c21-97e4-809151dd4036",
  "txId": "0xfa88b705a5b4049adac7caff50c887d9600ef023ef1a937f8f8b6f44e90042b5",
  "step": 1
}
'
```

{% endtab %}
{% endtabs %}

{% embed url="<https://rango-api.readme.io/reference/checktxstatus>" %}
Check Transaction Status Swagger
{% endembed %}

{% hint style="info" %}

* This endpoint is not suitable for checking approve transaction and it is only for the main  transaction. For checking approval transaction status, please [check this section](https://docs.rango.exchange/api-integration/main-api-multi-step/create-transaction#check-approval-status).
* In on-chain transactions, you could also check transaction status by checking transaction receipt (via RPC) if you prefer. But in cross-chain swaps (e.g. bridges), you could use this method to make sure outbound transaction (transaction on destination chain) succeeds without any problem.
  {% endhint %}

### Check Transaction Status Request&#x20;

{% tabs %}
{% tab title="API Definition" %}

* **`requestId`** <mark style="color:red;">\*</mark> String
  * Description: The unique ID which is generated in the best route endpoint.
  * Example: `b3a12c6d-86b8-4c21-97e4-809151dd4036`
* **`step`** <mark style="color:red;">\*</mark> Number
  * Description: The current step number in a multi-step route, starting from 1.
  * Example: `1`
* **`txId`** <mark style="color:red;">\*</mark> String
  * Description: Transaction hash returned by wallet
  * Example: `0xfa88b705a5b4049adac7caff50c887d9600ef023ef1a937f8f8b6f44e90042b5`
    {% endtab %}

{% tab title="SDK Models (Typescript)" %}

```typescript
export type CheckTxStatusRequest = {
  requestId: string
  step: number
  txId: string
}
```

{% endtab %}
{% endtabs %}

### Check Transaction Status Response&#x20;

{% tabs %}
{% tab title="API Definition" %}

* **`status`**
  * Description: Status of the transaction, while the status is `running` or `null`, the client should retry until it turns into `success` or `failed`.
* **`timestamp`**
  * Description: The timestamp of the executed transaction. Beware that timestamp can be null even if the status is successful or failed, e.g. `1690190660000`
* **`extraMessage`**
  * Description: A message in case of failure, that could be shown to the user.
* **`outputAmount`**
  * Description: The human readable output amount for the transaction, e.g. 0.28.
* **`outputToken`**
  * Description: The output token for this step.
* **`newTx`**
  * Description: if a transaction needs more than one-step transaction to be signed by the user, the next step transaction will be returned in this field. \
    It's only used for the Voyager bridge at the moment, and you could simply avoid swappers with this requirement by passing `disableMultiStepTx` equals to `true` in get best route method
* **`diagnosisUrl`**
  * Description: In some special cases (e.g. Wormhole), the user should follow some steps outside Rango to get its assets back (to refund). You could show this link to the user to help him.\
    Sample value: <https://rango.exchange/diagnosis/wormhole?iframe=1>
* **`explorerUrl`**
  * Description: List of explorer URLs for the transactions that happened in this step.
* **`referrals`**
  * Description: List of referral reward for the dApp and Rango.
* **`steps`**
  * Description: In certain special cases (specifically for the Wormhole Bridge), the user must sign multiple transactions for a step to be successful. In these instances, you can use the steps data to display the internal steps of a single swap to the user for informational purposes.
    {% endtab %}

{% tab title="SDK Models (Typescript)" %}

```typescript
export type TransactionStatusResponse = {
  status: TransactionStatus | null
  timestamp: number | null
  extraMessage: string | null
  outputAmount: string | null
  outputToken: Token | null
  outputType: null | 'REVERTED_TO_INPUT' | 'MIDDLE_ASSET_IN_SRC' | 'MIDDLE_ASSET_IN_DEST' | 'DESIRED_OUTPUT'
  newTx: Transaction | null
  diagnosisUrl: string | null
  explorerUrl: SwapExplorerUrl[] | null
  referrals: TransactionStatusReferral[] | null
  steps: SwapperStatusStep[] | null
}

export enum TransactionStatus {
  FAILED = 'failed',
  RUNNING = 'running',
  SUCCESS = 'success',
}

export type SwapExplorerUrl = {
  description: string | null
  url: string
}

export type TransactionStatusReferral = {
  blockChain: string
  address: string | null
  symbol: string
  decimals: number
  amount: string
}

export type SwapperStatusStep = {
  name: string
  state: 'PENDING' | 'CREATED' | 'WAITING' | 'SIGNED' | 'SUCCESSED' | 'FAILED'
  current: boolean
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
  "status": "success",
  "extraMessage": null,
  "failedType": null,
  "timestamp": 1725780628000,
  "outputAmount": "0.001961697012221780",
  "explorerUrl": [
    {
      "url": "https://lineascan.build/tx/0xac125a7cc5fa1b99888b406bad06f5e5db29eb0aa24bcce7004a4108ac68dd0f",
      "description": "Swap"
    }
  ],
  "referrals": [
    {
      "amount": "3000000000000",
      "blockChain": "LINEA",
      "symbol": "ETH",
      "address": null,
      "decimals": 18,
      "type": "RANGO"
    },
    {
      "amount": "2000000000000",
      "blockChain": "LINEA",
      "symbol": "ETH",
      "address": null,
      "decimals": 18,
      "type": "AFFILIATE"
    }
  ],
  "newTx": null,
  "diagnosisUrl": null,
  "steps": null,
  "outputToken": {
    "blockchain": "LINEA",
    "symbol": "EZETH",
    "image": "https://tokens.pancakeswap.finance/images/linea/0x2416092f143378750bb29b79eD961ab195CcEea5.png",
    "address": "0x2416092f143378750bb29b79ed961ab195cceea5",
    "usdPrice": 2328.63,
    "decimals": 18,
    "name": null,
    "isPopular": false,
    "isSecondaryCoin": false,
    "coinSource": null,
    "coinSourceUrl": null,
    "supportedSwappers": []
  },
  "outputType": "DESIRED_OUTPUT",
  "bridgeExtra": {
    "requireRefundAction": false,
    "srcTx": "0xac125a7cc5fa1b99888b406bad06f5e5db29eb0aa24bcce7004a4108ac68dd0f",
    "destTx": null
  },
  "error": null,
  "errorCode": null,
  "traceId": null
}

```

{% endtab %}
{% endtabs %}
