# Kọ́kọ́rọ́ API àti àtòjọ IP tí a fàyè gbà

> API AfricaProxies: kọ́kọ́rọ́ API pẹ̀lú àṣẹ àti àtòjọ IP tó pọ̀ jù 10 fún proxy láìsí aṣínà, pẹ̀lú àpẹẹrẹ curl, Python àti Node.js.

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

Ṣẹ̀dá kí o sì fagilé kọ́kọ́rọ́ API pẹ̀lú àṣẹ tó ní ààlà, kí o sì ṣàkóso àtòjọ IP tí a fàyè gbà: àdírẹ́sì orísun tó pọ̀ jù lọ 10 lè lo proxy láìsí orúkọ oníṣe àti ọ̀rọ̀ aṣínà.

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

- `GET /v1/api-keys`: Ṣàtòjọ kọ́kọ́rọ́ API
- `POST /v1/api-keys`: Ṣẹ̀dá kọ́kọ́rọ́ API
- `DELETE /v1/api-keys/{keyId}`: Fagilé kọ́kọ́rọ́ API
- `GET /v1/ip-whitelist`: Ṣàtòjọ IP tí a fàyè gbà
- `POST /v1/ip-whitelist`: Fi IP tàbí àgbègbè àdírẹ́sì kún àtòjọ tí a fàyè gbà
- `DELETE /v1/ip-whitelist/{entryId}`: Yọ ìforúkọsílẹ̀ kúrò nínú àtòjọ tí a fàyè gbà

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

## Ṣàtòjọ kọ́kọ́rọ́ API

`GET /v1/api-keys`

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

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

```json
{
  "data": [
    {
      "id": "key_5n2v8q",
      "name": "Rotation script",
      "prefix": "pk_4f9a2c",
      "scopes": [
        "read",
        "proxies"
      ],
      "createdAt": "2026-10-05T14:03:11Z",
      "lastUsedAt": null
    }
  ],
  "limit": 20
}
```

*curl*

```bash
curl -s "https://africaproxies.com/api/v1/api-keys" \
  -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}/api-keys", 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}/api-keys`, {
  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());
```

## Ṣẹ̀dá kọ́kọ́rọ́ API

`POST /v1/api-keys`

A dá `secret` kíkún padà lẹ́ẹ̀kan.

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

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

| Àpáá | Ìpò | Féyí | Àpèjúwe |
| --- | --- | --- | --- |
| `name` | string | Bẹ́ẹ̀ ni | ó pọ̀ jù lọ: àmì ìkọ̀wé 60 |
| `scopes` | array of `read` · `proxies` · `billing` | Bẹ́ẹ̀ ni | — |

*Àpẹẹrẹ*

```json
{
  "name": "Rotation script",
  "scopes": [
    "read",
    "proxies"
  ]
}
```

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

```json
{
  "id": "key_5n2v8q",
  "name": "Rotation script",
  "prefix": "pk_4f9a2c",
  "scopes": [
    "read",
    "proxies"
  ],
  "createdAt": "2026-10-05T14:03:11Z",
  "lastUsedAt": null,
  "secret": "pk_4f9a2c8e1b7d3f6a9c2e5b8d1f4a7c0e"
}
```

*curl*

```bash
curl -s -X POST "https://africaproxies.com/api/v1/api-keys" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Rotation script","scopes":["read","proxies"]}'
```

*Python*

```python
import os
import requests

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

r = requests.post(f"{API}/api-keys", headers=HEADERS, json={"name": "Rotation script", "scopes": ["read", "proxies"]}, 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}/api-keys`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.API_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Rotation script', scopes: ['read', 'proxies'] }),
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Fagilé kọ́kọ́rọ́ API

`DELETE /v1/api-keys/{keyId}`

Ì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 |
| --- | --- | --- | --- | --- |
| `keyId` | path | string | Bẹ́ẹ̀ ni | — |

**Ìdáhùn** `204 No Content`

Kò sí ara: kòódì ìdáàbọ̀ ni ìdáhùn.

*curl*

```bash
curl -s -X DELETE "https://africaproxies.com/api/v1/api-keys/key_5n2v8q" \
  -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.delete(f"{API}/api-keys/key_5n2v8q", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.status_code)  # 204: done
```

*Node.js*

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

const res = await fetch(`${API}/api-keys/key_5n2v8q`, {
  method: 'DELETE',
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(res.status); // 204: done
```

## Ṣàtòjọ IP tí a fàyè gbà

`GET /v1/ip-whitelist`

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

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

```json
{
  "data": [
    {
      "id": "ipw_8c1k2m",
      "cidr": "203.0.113.24",
      "label": "Office server",
      "createdAt": "2026-10-05T14:03:11Z"
    }
  ],
  "limit": 10
}
```

*curl*

```bash
curl -s "https://africaproxies.com/api/v1/ip-whitelist" \
  -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}/ip-whitelist", 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}/ip-whitelist`, {
  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());
```

## Fi IP tàbí àgbègbè àdírẹ́sì kún àtòjọ tí a fàyè gbà

`POST /v1/ip-whitelist`

Ó gba àdírẹ́sì IPv4, IPv4 CIDR láti /24 sí /32, àdírẹ́sì IPv6 tàbí IPv6 CIDR láti /48 sí /128. A kọ àwọn àgbègbè àdírẹ́sì àdáni, loopback àti tí a yà sọ́tọ̀ (`422`). Ó bẹ̀rẹ̀ sí í ṣiṣẹ́ ní gateway láàárín 60 s.

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

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

| Àpáá | Ìpò | Féyí | Àpèjúwe |
| --- | --- | --- | --- |
| `cidr` | string | Bẹ́ẹ̀ ni | — |
| `label` | string | Rárá | ó pọ̀ jù lọ: àmì ìkọ̀wé 60 |

*Àpẹẹrẹ*

```json
{
  "cidr": "203.0.113.24",
  "label": "Office server"
}
```

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

```json
{
  "id": "ipw_8c1k2m",
  "cidr": "203.0.113.24",
  "label": "Office server",
  "createdAt": "2026-10-05T14:03:11Z"
}
```

*curl*

```bash
curl -s -X POST "https://africaproxies.com/api/v1/ip-whitelist" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cidr":"203.0.113.24","label":"Office server"}'
```

*Python*

```python
import os
import requests

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

r = requests.post(f"{API}/ip-whitelist", headers=HEADERS, json={"cidr": "203.0.113.24", "label": "Office server"}, 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}/ip-whitelist`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.API_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ cidr: '203.0.113.24', label: 'Office server' }),
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Yọ ìforúkọsílẹ̀ kúrò nínú àtòjọ tí a fàyè gbà

`DELETE /v1/ip-whitelist/{entryId}`

Ì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 |
| --- | --- | --- | --- | --- |
| `entryId` | path | string | Bẹ́ẹ̀ ni | — |

**Ìdáhùn** `204 No Content`

Kò sí ara: kòódì ìdáàbọ̀ ni ìdáhùn.

*curl*

```bash
curl -s -X DELETE "https://africaproxies.com/api/v1/ip-whitelist/ipw_8c1k2m" \
  -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.delete(f"{API}/ip-whitelist/ipw_8c1k2m", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.status_code)  # 204: done
```

*Node.js*

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

const res = await fetch(`${API}/ip-whitelist/ipw_8c1k2m`, {
  method: 'DELETE',
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(res.status); // 204: done
```

---

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è.
