## Afriex SDK

### TypeScript

```typescript
const response = await afriex.transactions.list({
  page: 0,
  limit: 20,
  status: ["PENDING", "PROCESSING"],
  currency: ["USD", "NGN"],
  fromDate: "2026-01-01T00:00:00.000Z",
  toDate: "2026-01-31T23:59:59.999Z",
});

console.log(response.data); // Transaction[]
```

### CURL

```bash
curl --request GET \
  --url 'https://sandbox.api.afriex.com/api/v1/transaction?limit=10' \
  --header 'x-api-key: <api-key>'
```

### Python

```python
import requests

url = "https://sandbox.api.afriex.com/api/v1/transaction?limit=10"

headers = {"x-api-key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
```

### JavaScript (Fetch)

```javascript
const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};

fetch('https://sandbox.api.afriex.com/api/v1/transaction?limit=10', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://sandbox.api.afriex.com/api/v1/transaction?limit=10",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "x-api-key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>
```

### Go

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

url := "https://sandbox.api.afriex.com/api/v1/transaction?limit=10"
	
	req, _ := http.NewRequest("GET", url, nil)
	
	req.Header.Add("x-api-key", "<api-key>")
	
	res, _ := http.DefaultClient.Do(req)
	
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

### Java (Unirest)

```java
HttpResponse<String> response = Unirest.get("https://sandbox.api.afriex.com/api/v1/transaction?limit=10")
  .header("x-api-key", "<api-key>")
  .asString();
```

### Ruby

```ruby
require 'uri'
require 'net/http'

url = URI("https://sandbox.api.afriex.com/api/v1/transaction?limit=10")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'

response = http.request(request)
puts response.read_body
```

### Response Format

```json
{
  "data": [
    {
      "status": "SUCCESS",
      "type": "SWAP",
      "channel": "WALLET",
      "sourceAmount": "10",
      "sourceCurrency": "USD",
      "destinationAmount": "14101.041",
      "destinationCurrency": "NGN",
      "destinationId": "",
      "customerId": "68e6717848e1f632e9686460",
      "transactionId": "69d3c79531c0234586ad5ee0",
      "meta": {
        "reference": "ref-swap-minimal-002",
        "idempotencyKey": "idem-swap-minimal-002"
      },
      "createdAt": "2026-04-06T14:47:49.166Z",
      "updatedAt": "2026-04-06T14:47:49.166Z"
    },
    {
      "status": "PENDING",
      "type": "WITHDRAW",
      "channel": "BANK_ACCOUNT",
      "sourceAmount": "3.28847",
      "sourceCurrency": "USD",
      "destinationAmount": "5000",
      "destinationCurrency": "NGN",
      "destinationId": "690df3281c11eea59108fcaf",
      "customerId": "69528240ba52c13b669fb239",
      "transactionId": "69d60071ab82306f11b03393",
      "meta": {
        "reference": "ref-withdraw-001",
        "idempotencyKey": "idem-withdraw-001"
      },
      "createdAt": "2026-04-08T07:14:57.444Z",
      "updatedAt": "2026-04-08T07:14:57.444Z"
    }
  ],
  "total": 285,
  "page": 0
}
```

### Authorizations

- **x-api-key**: Static business API key issued from the dashboard. A business can provision multiple API keys, each scoped to a configurable set of permissions (e.g. read transactions, create deposits, etc). Permissions are chosen per key at creation time in the dashboard and may be revoked by deleting the key. Requests made with a key that does not include the permission required by the target endpoint will be rejected with a `403 Forbidden` response; an unrecognised, malformed or revoked key returns `401 Unauthorized`. Manage your keys and their permissions under Developer → API keys in the dashboard.
