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

# Check Transfer Status

> Check the status of a money transfer

## Overview

Check the current status of a money transfer using its transfer ID. This endpoint provides detailed information about the transfer state, including whether it's completed, in progress, or encountered an error.

## Endpoint

```http theme={null}
GET /api/status/:id
```

## Path Parameters

<ParamField path="id" type="string" required>
  The unique money transfer ID returned when the transfer was created
</ParamField>

## Authentication

<ParamField header="API-KEY" type="string" required>
  Your CashQ API Key for authentication
</ParamField>

## Request Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET 'https://api.cashqbot.com/api/status/123456789' \
    -H 'API-KEY: your_api_key_here'
  ```

  ```javascript Node.js theme={null}
  const transferId = '123456789';

  const response = await fetch(
    `https://api.cashqbot.com/api/status/${transferId}`,
    {
      method: 'GET',
      headers: {
        'API-KEY': 'your_api_key_here'
      }
    }
  );

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  transfer_id = '123456789'

  response = requests.get(
      f'https://api.cashqbot.com/api/status/{transfer_id}',
      headers={'API-KEY': 'your_api_key_here'}
  )

  data = response.json()
  print(data)
  ```

  ```php PHP theme={null}
  <?php
  $transferId = '123456789';

  $ch = curl_init();

  curl_setopt($ch, CURLOPT_URL, "https://api.cashqbot.com/api/status/{$transferId}");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'API-KEY: your_api_key_here'
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  $data = json_decode($response, true);
  print_r($data);
  ?>
  ```
</CodeGroup>

## Response

<ResponseField name="status" type="object">
  Status information for the transfer

  <Expandable title="Status properties">
    <ResponseField name="result" type="object">
      Detailed transfer status information

      <Expandable title="Result properties">
        <ResponseField name="id" type="string">
          The transfer ID
        </ResponseField>

        <ResponseField name="state" type="integer">
          General transfer status code (see [Status Codes](/api-reference/status-codes))
        </ResponseField>

        <ResponseField name="substate" type="integer">
          Additional status detail code
        </ResponseField>

        <ResponseField name="final" type="integer">
          Indicates if the status is final

          * `0`: Status may change (transfer in progress)
          * `1`: Status is final (transfer completed or failed)
        </ResponseField>

        <ResponseField name="code" type="integer">
          Response code
        </ResponseField>

        <ResponseField name="attribute" type="array">
          Additional status attributes, such as provider error information
        </ResponseField>

        <ResponseField name="server_time" type="string | null">
          Server timestamp
        </ResponseField>

        <ResponseField name="trans" type="string | null">
          Transaction reference
        </ResponseField>

        <ResponseField name="sum_prov" type="string | null">
          Provider sum
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Response Examples

<ResponseExample>
  ```json In Progress theme={null}
  {
    "status": {
      "result": {
        "server_time": null,
        "code": 0,
        "substate": 0,
        "id": "123456789",
        "state": 40,
        "attribute": [],
        "trans": null,
        "sum_prov": null,
        "final": 0
      }
    }
  }
  ```

  ```json Success theme={null}
  {
    "status": {
      "result": {
        "server_time": "2024-01-15T10:30:00Z",
        "code": 0,
        "substate": 0,
        "id": "123456789",
        "state": 60,
        "attribute": [],
        "trans": "TXN123456",
        "sum_prov": "5.00",
        "final": 1
      }
    }
  }
  ```

  ```json Error with Provider Info theme={null}
  {
    "status": {
      "result": {
        "server_time": "2024-01-15T10:30:00Z",
        "code": 0,
        "substate": 5,
        "id": "123456789",
        "state": 80,
        "attribute": [
          {
            "name": "provider-error-text",
            "value": "Insufficient funds"
          },
          {
            "name": "provider-error-code",
            "value": "100"
          }
        ],
        "trans": null,
        "sum_prov": null,
        "final": 1
      }
    }
  }
  ```

  ```json Transfer Not Found theme={null}
  {
    "payment_response": {
      "payment_id": null,
      "state": "-2",
      "substate": "0",
      "code": "0",
      "id": "123456789"
    },
    "error": "",
    "success": true
  }
  ```
</ResponseExample>

## Understanding Transfer States

### Key Status Codes

| State | Substate | Final | Description             |
| ----- | -------- | ----- | ----------------------- |
| 0     | 0-2      | No    | New transfer            |
| 40    | 1-3      | No    | Processing              |
| 60    | -        | Yes   | **Success** (completed) |
| 80    | -        | Yes   | **Error** (failed)      |
| -2    | 0        | Yes   | Transfer not found      |

<Info>
  See the complete [Status Codes Reference](/api-reference/status-codes) for all possible states and substates.
</Info>

### Final Status

The `final` field indicates whether the transfer has reached a terminal state:

* **`final: 0`** - Transfer is still in progress, status may change
* **`final: 1`** - Transfer is complete (success or failure), status won't change

## Polling Best Practices

<AccordionGroup>
  <Accordion title="Use exponential backoff">
    Start with short intervals (1 second) and gradually increase to avoid excessive API calls.

    ```javascript theme={null}
    const delay = Math.min(1000 * Math.pow(1.5, attempt), 10000);
    ```
  </Accordion>

  <Accordion title="Check the final field">
    Stop polling when `final: 1` to avoid unnecessary requests.
  </Accordion>

  <Accordion title="Set a maximum timeout">
    Don't poll indefinitely. Set a reasonable maximum number of attempts or time limit.
  </Accordion>

  <Accordion title="Handle all states">
    Account for success (state 60), failure (state 80), and not found (state -2).
  </Accordion>
</AccordionGroup>

## Error Responses

| Error Code              | Description                | Solution                         |
| ----------------------- | -------------------------- | -------------------------------- |
| `authentication_error`  | Invalid or missing API key | Verify your API key              |
| `transfer_not_found`    | Transfer ID doesn't exist  | Check the transfer ID is correct |
| `internal_server_error` | Server error occurred      | Retry the request                |

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Money Transfer" icon="money-bill-transfer" href="/api-reference/transfer">
    Create a transfer and get the ID for status checking
  </Card>

  <Card title="Status Codes" icon="list" href="/api-reference/status-codes">
    Complete reference of all status codes
  </Card>
</CardGroup>
