# Àṣẹ rírà

> API AfricaProxies: ètò, iye owó, rírà láti owó àkáǹtì àti ìtàn àṣẹ. Àwọn àyípadà ìbéèrè, àpẹẹrẹ èsì àti kóòdù curl, Python àti Node.js.

- URL: https://africaproxies.com/yo/docs/api/orders/
- Ìgbà tí a mú ohun ṣe àtúnṣe: 2026-10-15
- Olùfúnró: AfricaProxies (https://africaproxies.com)

Ṣàtòjọ ètò àti iye owó, ra ètò láti owó àkáǹtì (iṣẹ́ tuntun, dátà sí i tàbí àfikún àkókò ibùdó), kí o sì ka àṣẹ rírà rẹ àtijọ́.

**Àwọn ibi ìpè lójú ìwé yìí**

- `GET /v1/catalog/products`: Ọjà, ètò àti iye owó
- `POST /v1/orders`: Ra ètò láti owó àkáǹtì (iṣẹ́ tuntun, dátà sí i tàbí àfikún àkókò ibùdó)
- `GET /v1/orders`: Ṣàtòjọ àṣẹ rírà
- `GET /v1/orders/{orderId}`: Gba àṣẹ rírà

URL ìpìlẹ̀ `https://africaproxies.com/api/v1`. Ìmúdájú ìwọlé, àṣìṣe àti ààlà: wo [àkótán API](/yo/docs/api/).

## Ọjà, ètò àti iye owó

`GET /v1/catalog/products`

Gbogbo ọjà pẹ̀lú ètò àti iye owó rẹ̀, gẹ́gẹ́ bí owó tí a ń gba nígbà tí o bá pàṣẹ.

Ìgbàlọwọ́: kò nílò API key.

**Ìdáhùn** `200 OK`

```json
{
  "data": [
    {
      "id": "residential",
      "name": "Residential proxies",
      "description": "Residential IPs across 49 African locations for public price research, local SEO and your application tests. Prepaid traffic, billed per GB.",
      "unit": "GB",
      "plans": [
        {
          "id": "res-10",
          "productId": "residential",
          "name": "Team",
          "quantity": 10,
          "unit": "GB",
          "durationDays": null,
          "price": "5.94",
          "pricePerUnit": "0.59",
          "popular": false,
          "features": [
            "Prepaid traffic never expires",
            "Country and city where available",
            "Project credentials and traffic caps"
          ],
          "available": true,
          "countries": null
        }
      ]
    }
  ]
}
```

*curl*

```bash
curl -s "https://africaproxies.com/api/v1/catalog/products"
```

*Python*

```python
import os
import requests

API = "https://africaproxies.com/api/v1"

r = requests.get(f"{API}/catalog/products", timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://africaproxies.com/api/v1';

const res = await fetch(`${API}/catalog/products`);
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Ra ètò láti owó àkáǹtì (iṣẹ́ tuntun, dátà sí i tàbí àfikún àkókò ibùdó)

`POST /v1/orders`

A máa ń sanwó láti owó tó ti wà nínú àkáǹtì: API ń ṣe ìṣirò iye owó (iye kátálọ́ọ̀gù × `quantity`), a yọ owó kúrò nínú àkáǹtì, a ṣẹ̀dá iṣẹ́ tàbí fa àkókò rẹ̀ gùn, àṣẹ rírà sì padà bí `completed` pẹ̀lú `fulfillment` rẹ̀. Àlàyé ìwọlé proxy wà lẹ́sẹ̀kẹsẹ̀.

- **Dátà ilé tuntun**: `{ "planId": "res-10" }`.
- **Dátà 4G/5G tuntun tí ń yípadà (fún GB)**: `{ "planId": "mgb-10" }` (ètò dátà pẹ̀lú `productId: "mobile-gb"`, tí a fi ránṣẹ́ nínú `fulfillment.residentialSubscriptionId`).
- **Fi dátà kún ètò tó wà**: `{ "planId": "res-10", "options": { "subscriptionId": "res_9x2m4k" } }`: ètò rírà gbọdọ̀ jẹ́ ti ọjà ètò dátà náà.
- **Ibùdó alágbèéká tuntun**: `{ "planId": "mob-30d", "quantity": 1, "options": { "country": "AE" } }`, pẹ̀lú `carrier` bí o bá fẹ́ (wo ilé-iṣẹ́ orílẹ̀-èdè nínú [Ibùdó alágbèéká](/yo/docs/api/mobile/)). Ètò ẹkùn kan bo àwọn orílẹ̀-èdè ẹkùn rẹ̀ nìkan (bí bẹ́ẹ̀ kọ́, `422` lórí `options.country`).
- **Fa àkókò ibùdó alágbèéká gùn**: `{ "planId": "mob-7d", "options": { "portId": "mob_2v8k1q" } }` ń fi àkókò ètò kún `expiresAt`.

**Owó àkáǹtì kò tó → `402 insufficient_balance`**, pẹ̀lú iye tó kù àti àbá ìfikún owó nínú `error.details` (`missing`, `suggestedTopUp`). A kì í yọ owó nígbà àṣìṣe èyíkéyìí. Láti san ìyàtọ̀ náà, bẹ̀rẹ̀ ìfikún owó tí ó gbé ìbéèrè kan náà nínú `purchase` (`POST /v1/topups`): a ra ètò ní kété tí a fi ìfikún náà sí àkáǹtì.

Ìfìyàtọ̀: API key nínú àpẹẹrẹ `Authorization: Bearer API_KEY`.

**Àwọn àmì ohun**

| Orúkọ | Nínú | Ìpò | Féyí | Àpèjúwe |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | Rárá | Kọ́kọ́rọ́ aláìlẹ́gbẹ́ (bí UUID) láti tún POST gbìyànjú láìséwu. A pa á mọ́ fún 24 h. — ó pọ̀ jù lọ: àmì ìkọ̀wé 128 |

**Àpèjú ara ìròyìn**

| Àpáá | Ìpò | Féyí | Àpèjúwe |
| --- | --- | --- | --- |
| `planId` | string | Bẹ́ẹ̀ ni | — |
| `quantity` | integer | Rárá | 1–100, àiyípadà `1` |
| `options` | object | Rárá | — |

*Àpẹẹrẹ: Ti ilé*

```json
{
  "planId": "res-10"
}
```

*Àpẹẹrẹ: Àwọn ibùdó alágbèéká*

```json
{
  "planId": "mob-30d",
  "quantity": 1,
  "options": {
    "country": "AE",
    "carrier": "etisalat",
    "autoRenew": true
  }
}
```

*Àpẹẹrẹ: Fa àkókò ibùdó gùn*

```json
{
  "planId": "mob-7d",
  "options": {
    "portId": "mob_2v8k1q"
  }
}
```

*Àpẹẹrẹ: Dátà alágbèéká*

```json
{
  "planId": "mgb-10"
}
```

*Àpẹẹrẹ: Ibùdó ẹkùn*

```json
{
  "planId": "mob-30d",
  "options": {
    "country": "AE",
    "carrier": "etisalat"
  }
}
```

**Ìdáhùn** `201 Created`

```json
{
  "id": "ord_4f8k2m9q",
  "status": "completed",
  "productId": "residential",
  "planId": "res-10",
  "planName": "Team",
  "quantity": 1,
  "unitPrice": "5.94",
  "subtotal": "5.94",
  "discount": "0.00",
  "total": "5.94",
  "promoCode": null,
  "currency": "USD",
  "topUpId": null,
  "options": {},
  "fulfillment": {
    "residentialSubscriptionId": "res_9x2m4k",
    "mobilePortIds": []
  },
  "createdAt": "2026-10-05T14:03:11Z",
  "paidAt": "2026-10-05T14:03:11Z"
}
```

*curl*

```bash
curl -s -X POST "https://africaproxies.com/api/v1/orders" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"planId":"res-10"}'
```

*Python*

```python
import os, uuid
import requests

API = "https://africaproxies.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}", "Idempotency-Key": str(uuid.uuid4())}

r = requests.post(f"{API}/orders", headers=HEADERS, json={"planId": "res-10"}, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
import { randomUUID } from 'node:crypto';

const API = 'https://africaproxies.com/api/v1';

const res = await fetch(`${API}/orders`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.API_KEY}`, 'Idempotency-Key': randomUUID(), 'Content-Type': 'application/json' },
  body: JSON.stringify({ planId: 'res-10' }),
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Ṣàtòjọ àṣẹ rírà

`GET /v1/orders`

Ìfìyàtọ̀: API key nínú àpẹẹrẹ `Authorization: Bearer API_KEY`.

**Àwọn àmì ohun**

| Orúkọ | Nínú | Ìpò | Féyí | Àpèjúwe |
| --- | --- | --- | --- | --- |
| `page` | query | integer | Rárá | ≥ 1, àiyípadà `1` |
| `perPage` | query | integer | Rárá | 1–100, àiyípadà `20` |
| `status` | query | `completed` · `cancelled` | Rárá | A ṣẹ̀dá àṣẹ rírà tí a ti san fún (a yọ owó nínú àkáǹtì). `completed` — a ti sanwó, a sì ti pèsè iṣẹ́ (àlàyé ìwọlé wà lẹ́sẹ̀kẹsẹ̀). |
| `productId` | query | string | Rárá | Àmì ọjà láti inú kátálọ́ọ̀gù. Àwọn iye AfricaProxies: `residential` (GB), `mobile` (ibùdó 4G/5G tí a yà sọ́tọ̀) àti `mobile-gb` (dátà 4G/5G tí ń yípadà fún GB). Ètò oníbàárà gbọdọ̀ lè bójú tó iye tí kò mọ̀. |

**Ìdáhùn** `200 OK`

```json
{
  "data": [
    {
      "id": "ord_4f8k2m9q",
      "status": "completed",
      "productId": "residential",
      "planId": "res-10",
      "planName": "Team",
      "quantity": 1,
      "unitPrice": "5.94",
      "subtotal": "5.94",
      "discount": "0.00",
      "total": "5.94",
      "promoCode": null,
      "currency": "USD",
      "topUpId": null,
      "options": {},
      "fulfillment": {
        "residentialSubscriptionId": "res_9x2m4k",
        "mobilePortIds": []
      },
      "createdAt": "2026-10-05T14:03:11Z",
      "paidAt": "2026-10-05T14:03:11Z"
    }
  ],
  "pagination": {
    "page": 1,
    "perPage": 20,
    "total": 1,
    "totalPages": 1
  }
}
```

*curl*

```bash
curl -s "https://africaproxies.com/api/v1/orders" \
  -H "Authorization: Bearer $API_KEY"
```

*Python*

```python
import os
import requests

API = "https://africaproxies.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.get(f"{API}/orders", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://africaproxies.com/api/v1';

const res = await fetch(`${API}/orders`, {
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Gba àṣẹ rírà

`GET /v1/orders/{orderId}`

Ìfìyàtọ̀: API key nínú àpẹẹrẹ `Authorization: Bearer API_KEY`.

**Àwọn àmì ohun**

| Orúkọ | Nínú | Ìpò | Féyí | Àpèjúwe |
| --- | --- | --- | --- | --- |
| `orderId` | path | string | Bẹ́ẹ̀ ni | — |

**Ìdáhùn** `200 OK`

```json
{
  "id": "ord_4f8k2m9q",
  "status": "completed",
  "productId": "residential",
  "planId": "res-10",
  "planName": "Team",
  "quantity": 1,
  "unitPrice": "5.94",
  "subtotal": "5.94",
  "discount": "0.00",
  "total": "5.94",
  "promoCode": null,
  "currency": "USD",
  "topUpId": null,
  "options": {},
  "fulfillment": {
    "residentialSubscriptionId": "res_9x2m4k",
    "mobilePortIds": []
  },
  "createdAt": "2026-10-05T14:03:11Z",
  "paidAt": "2026-10-05T14:03:11Z"
}
```

*curl*

```bash
curl -s "https://africaproxies.com/api/v1/orders/ord_4f8k2m9q" \
  -H "Authorization: Bearer $API_KEY"
```

*Python*

```python
import os
import requests

API = "https://africaproxies.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.get(f"{API}/orders/ord_4f8k2m9q", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://africaproxies.com/api/v1';

const res = await fetch(`${API}/orders/ord_4f8k2m9q`, {
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

---

AfricaProxies: AfricaProxies jẹ́ olùpèsè proxy IP ilé fún Áfíríkà gúúsù Sàhárà; a ń sanwó pẹ̀lú krípító láìgbé ẹ̀rí ìdánimọ̀ sókè.
