# Maɓallan API da jerin IP da aka amince da su

> API na AfricaProxies: maɓallan API masu izini da jerin IP har 10 don proxy ba kalmar sirri, da misalan curl, Python da Node.js.

- URL: https://africaproxies.com/ha/docs/api/api-keys/
- An sabunta ƙarshe: 2026-10-15
- Mai wallafa: AfricaProxies (https://africaproxies.com)

Ƙirƙira da soke maɓallan API masu iyakacin izini, ka sarrafa jerin IP da aka amince da su: har adiresoshin tushe 10 za su iya amfani da proxy ba tare da sunan mai amfani da kalmar sirri ba.

**Wuraren kira a wannan shafin**

- `GET /v1/api-keys`: Jera maɓallan API
- `POST /v1/api-keys`: Ƙirƙiri maɓallin API
- `DELETE /v1/api-keys/{keyId}`: Soke maɓallin API
- `GET /v1/ip-whitelist`: Jera jerin IP da aka amince da su
- `POST /v1/ip-whitelist`: Ƙara IP ko zangon adiresoshi ga jerin da aka amince da su
- `DELETE /v1/ip-whitelist/{entryId}`: Cire shigarwa daga jerin da aka amince da su

URL na asali `https://africaproxies.com/api/v1`. Tabbatar da shiga, kurakurai da iyaka: duba [bayanin API](/ha/docs/api/).

## Jera maɓallan API

`GET /v1/api-keys`

Authentication: API madaidaiciya a cikin `Authorization: Bearer API_KEY` taken.

**Amsa** `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());
```

## Ƙirƙiri maɓallin API

`POST /v1/api-keys`

Ana mayar da cikakken `secret` sau ɗaya.

Authentication: API madaidaiciya a cikin `Authorization: Bearer API_KEY` taken.

**Sashin buƙata**

| Fasali | Nau'i | Abin bukata | Bayani |
| --- | --- | --- | --- |
| `name` | string | I | iyakar haruffa 60 |
| `scopes` | array of `read` · `proxies` · `billing` | I | — |

*Misali*

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

**Amsa** `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());
```

## Soke maɓallin API

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

Authentication: API madaidaiciya a cikin `Authorization: Bearer API_KEY` taken.

**Ma'aunin aiki**

| Suna | A cikin | Nau'i | Abin bukata | Bayani |
| --- | --- | --- | --- | --- |
| `keyId` | path | string | I | — |

**Amsa** `204 No Content`

Babu jiki: lambar yanayi ita ce amsa.

*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
```

## Jera jerin IP da aka amince da su

`GET /v1/ip-whitelist`

Authentication: API madaidaiciya a cikin `Authorization: Bearer API_KEY` taken.

**Amsa** `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());
```

## Ƙara IP ko zangon adiresoshi ga jerin da aka amince da su

`POST /v1/ip-whitelist`

Yana karɓar adireshin IPv4, IPv4 CIDR daga /24 zuwa /32, adireshin IPv6 ko IPv6 CIDR daga /48 zuwa /128. Ana ƙin zangon sirri, loopback da waɗanda aka keɓe (`422`). Yana aiki a ƙofar haɗi cikin 60 s.

Authentication: API madaidaiciya a cikin `Authorization: Bearer API_KEY` taken.

**Sashin buƙata**

| Fasali | Nau'i | Abin bukata | Bayani |
| --- | --- | --- | --- |
| `cidr` | string | I | — |
| `label` | string | A'a | iyakar haruffa 60 |

*Misali*

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

**Amsa** `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());
```

## Cire shigarwa daga jerin da aka amince da su

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

Authentication: API madaidaiciya a cikin `Authorization: Bearer API_KEY` taken.

**Ma'aunin aiki**

| Suna | A cikin | Nau'i | Abin bukata | Bayani |
| --- | --- | --- | --- | --- |
| `entryId` | path | string | I | — |

**Amsa** `204 No Content`

Babu jiki: lambar yanayi ita ce amsa.

*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 mai samar da proxy na IP na gida ne ga Afirka kudu da Sahara; ana biya da kirifto ba tare da loda katin shaida ba.
