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

# Get Operations

> Retrieve a paginated list of distributor operations (cash-in and cash-out transactions)

## Endpoint

```
GET /api/v1/distributors/{distributorID}/operations
```

## Authentication

<ParamField header="Authorization" type="string" required>
  Bearer token with your API key. Must have **Read Transactions** permission.
</ParamField>

## Path Parameters

<ParamField path="distributorID" type="string" required>
  The unique identifier of the distributor. Must match the distributor ID associated with the API key.
</ParamField>

## Query Parameters

<ParamField query="limit" type="integer" default="100">
  Maximum number of operations to return. Maximum value: 1000.
</ParamField>

<ParamField query="offset" type="integer" default="0">
  Number of operations to skip for pagination.
</ParamField>

## Response

Returns an array of operation objects, sorted by creation date (newest first).

<ResponseField name="operations" type="array">
  <Expandable title="Operation Object">
    <ResponseField name="operationID" type="string">
      Unique identifier for the operation
    </ResponseField>

    <ResponseField name="distributorID" type="string">
      Distributor identifier
    </ResponseField>

    <ResponseField name="operationType" type="string">
      Type of operation: `cash-in` or `cash-out-fulfillment`
    </ResponseField>

    <ResponseField name="amount" type="string">
      Transaction amount as decimal string
    </ResponseField>

    <ResponseField name="phoneTo" type="string">
      Recipient phone number (for cash-in to individual)
    </ResponseField>

    <ResponseField name="merchantTo" type="string">
      Recipient merchant ID (for cash-in to merchant)
    </ResponseField>

    <ResponseField name="merchantName" type="string">
      Recipient merchant name (for cash-in to merchant)
    </ResponseField>

    <ResponseField name="merchantShortCode" type="integer">
      Recipient merchant short code (for cash-in to merchant)
    </ResponseField>

    <ResponseField name="memo" type="string">
      Optional reference note or description
    </ResponseField>

    <ResponseField name="phoneFrom" type="string">
      Sender phone number (for cash-out operations)
    </ResponseField>

    <ResponseField name="walletOperationID" type="string">
      Associated wallet operation identifier
    </ResponseField>

    <ResponseField name="cashOutFulfillmentType" type="string | null">
      Fulfillment type for cash-out (e.g., "cash")
    </ResponseField>

    <ResponseField name="cashOutFulfillmentID" type="string | null">
      Receipt/reference ID for cash-out
    </ResponseField>

    <ResponseField name="sequenceNumber" type="integer | null">
      Blockchain sequence number (if submitted)
    </ResponseField>

    <ResponseField name="blockchainID" type="string">
      Blockchain transaction identifier
    </ResponseField>

    <ResponseField name="lastError" type="string | null">
      Last error message if operation failed
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO 8601 timestamp of creation
    </ResponseField>

    <ResponseField name="updatedAt" type="string">
      ISO 8601 timestamp of last update
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.yourdomain.com/api/v1/distributors/36e48800-22ce-4ea0-b37a-198f7978cd53/operations?limit=10&offset=0" \
    -H "Authorization: Bearer uwk_YOUR_API_KEY_HERE"
  ```

  ```javascript Node.js theme={null}
  const axios = require('axios');

  const response = await axios.get(
    'https://api.yourdomain.com/api/v1/distributors/36e48800-22ce-4ea0-b37a-198f7978cd53/operations',
    {
      params: {
        limit: 10,
        offset: 0
      },
      headers: {
        'Authorization': 'Bearer uwk_YOUR_API_KEY_HERE'
      }
    }
  );

  console.log('Operations:', response.data);
  ```

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

  response = requests.get(
      'https://api.yourdomain.com/api/v1/distributors/36e48800-22ce-4ea0-b37a-198f7978cd53/operations',
      params={'limit': 10, 'offset': 0},
      headers={'Authorization': 'Bearer uwk_YOUR_API_KEY_HERE'}
  )

  print('Operations:', response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Success theme={null}
  [
    {
      "operationID": "op_8b7c9d3e-4f5a-6b7c-8d9e-0f1a2b3c4d5e",
      "distributorID": "36e48800-22ce-4ea0-b37a-198f7978cd53",
      "operationType": "cash-in",
      "amount": "5000.00",
      "phoneTo": "+234 8123456781",
      "memo": "Cash deposit - Receipt #1234",
      "walletOperationID": "wo_1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
      "sequenceNumber": 12345678,
      "blockchainID": "tx_abc123...",
      "lastError": null,
      "createdAt": "2026-02-12T10:30:00Z",
      "updatedAt": "2026-02-12T10:30:15Z"
    },
    {
      "operationID": "op_7a6b5c4d-3e2f-1a0b-9c8d-7e6f5a4b3c2d",
      "distributorID": "36e48800-22ce-4ea0-b37a-198f7978cd53",
      "operationType": "cash-in",
      "amount": "25000.00",
      "merchantTo": "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
      "merchantName": "ABC Store",
      "merchantShortCode": 100000,
      "memo": "Monthly deposit",
      "sequenceNumber": 12345680,
      "blockchainID": "tx_ghi789...",
      "lastError": null,
      "createdAt": "2026-02-12T11:00:00Z",
      "updatedAt": "2026-02-12T11:00:20Z"
    },
    {
      "operationID": "op_9c8d0e4f-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
      "distributorID": "36e48800-22ce-4ea0-b37a-198f7978cd53",
      "operationType": "cash-out-fulfillment",
      "amount": "3000.00",
      "phoneFrom": "+234 8123456781",
      "walletOperationID": "wo_2b3c4d5e-6f7a-8b9c-0d1e-2f3a4b5c6d7e",
      "cashOutFulfillmentType": "cash",
      "cashOutFulfillmentID": "receipt-12345",
      "sequenceNumber": 12345679,
      "blockchainID": "tx_def456...",
      "lastError": null,
      "createdAt": "2026-02-12T09:15:00Z",
      "updatedAt": "2026-02-12T09:15:20Z"
    }
  ]
  ```

  ```json 403 Forbidden - Missing Permission theme={null}
  {
    "type": "/problems/access-forbidden",
    "status": 403,
    "title": "Access Forbidden",
    "detail": "API key does not have Read Transactions permission"
  }
  ```
</ResponseExample>

## Pagination Example

```javascript theme={null}
async function getAllOperations(distributorID, apiKey) {
  const allOperations = [];
  let offset = 0;
  const limit = 100;
  let hasMore = true;

  while (hasMore) {
    const response = await axios.get(
      `https://api.yourdomain.com/api/v1/distributors/${distributorID}/operations`,
      {
        params: { limit, offset },
        headers: { 'Authorization': `Bearer ${apiKey}` }
      }
    );

    const operations = response.data;
    allOperations.push(...operations);

    // If we got fewer results than the limit, we've reached the end
    hasMore = operations.length === limit;
    offset += limit;
  }

  return allOperations;
}
```

## Filtering Operations

While the API doesn't provide built-in filtering, you can filter results client-side:

```javascript theme={null}
// Get only cash-in operations
const cashIns = operations.filter(op => op.operationType === 'cash-in');

// Get operations from the last 24 hours
const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000);
const recentOps = operations.filter(op => 
  new Date(op.createdAt) > yesterday
);

// Get operations for a specific phone number
const userOps = operations.filter(op => 
  op.phoneTo === '+234 8123456781' || op.phoneFrom === '+234 8123456781'
);
```
