Appearance
User - IP Pools
Base URL:
https://your-domain.com
Admin endpoints for managing IP address pools. All endpoints require admin/staff authentication.
Fetch All IP Pools
Retrieve all IP pools configured in the system.
| Property | Value |
|---|---|
| Endpoint | Fetch All IP Pools |
| Method | GET |
| URL | /api/v1/ip-pools |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Success Response (200 OK):
json
{
"success": true,
"data": [
{
"id": 1,
"name": "Pool-A",
"start_ip": "192.168.1.1",
"end_ip": "192.168.1.254",
"total_ips": 254,
"used_ips": 150,
"available_ips": 104
}
]
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/ip-pools" \
-H "Accept: application/json" \
-H "Authorization: Bearer your-auth-token"php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$response = $client->request('GET', '/api/v1/ip-pools', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const response = await fetch(`${BASE_URL}/api/v1/ip-pools`, {
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
response = requests.get(
f"{BASE_URL}/api/v1/ip-pools",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
endpoint := baseURL + "/api/v1/ip-pools"
req, _ := http.NewRequest("GET", endpoint, nil)
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let response = client
.get(format!("{BASE_URL}/api/v1/ip-pools"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Fetch IP Pool
Retrieve details of a specific IP pool.
| Property | Value |
|---|---|
| Endpoint | Fetch IP Pool |
| Method | GET |
| URL | /api/v1/ip-pools/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 1,
"name": "Pool-A",
"start_ip": "192.168.1.1",
"end_ip": "192.168.1.254",
"total_ips": 254,
"used_ips": 150,
"available_ips": 104
}
}Code Examples:
bash
curl -X GET "https://your-domain.com/api/v1/ip-pools/1" \
-H "Accept: application/json" \
-H "Authorization: Bearer your-auth-token"php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$ipPoolId = 1;
$response = $client->request('GET', "/api/v1/ip-pools/{$ipPoolId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const ipPoolId = 1;
const response = await fetch(`${BASE_URL}/api/v1/ip-pools/${ipPoolId}`, {
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
ip_pool_id = 1
response = requests.get(
f"{BASE_URL}/api/v1/ip-pools/{ip_pool_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
ipPoolId := 1
endpoint := baseURL + "/api/v1/ip-pools/" + strconv.Itoa(ipPoolId)
req, _ := http.NewRequest("GET", endpoint, nil)
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let ip_pool_id = 1;
let response = client
.get(format!("{BASE_URL}/api/v1/ip-pools/{ip_pool_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Create IP Pool
Create a new IP address pool.
| Property | Value |
|---|---|
| Endpoint | Create IP Pool |
| Method | POST |
| URL | /api/v1/ip-pools |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "Pool-A",
"start_ip": "192.168.1.1",
"end_ip": "192.168.1.254"
}| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Pool name |
start_ip | string | Yes | Starting IP address |
end_ip | string | Yes | Ending IP address |
Success Response (201 Created):
json
{
"success": true,
"message": "IP Pool created successfully",
"data": {
"id": 1
}
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/ip-pools" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-auth-token" \
-d '{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "Pool-A",
"start_ip": "192.168.1.1",
"end_ip": "192.168.1.254"
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$response = $client->request('POST', '/api/v1/ip-pools', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
'name' => 'Pool-A',
'start_ip' => '192.168.1.1',
'end_ip' => '192.168.1.254',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const response = await fetch(`${BASE_URL}/api/v1/ip-pools`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
isp_id: 1,
branch_id: 1,
user_id: 1,
name: 'Pool-A',
start_ip: '192.168.1.1',
end_ip: '192.168.1.254',
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
response = requests.post(
f"{BASE_URL}/api/v1/ip-pools",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "Pool-A",
"start_ip": "192.168.1.1",
"end_ip": "192.168.1.254",
},
)
data = response.json()
print(data)go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
endpoint := baseURL + "/api/v1/ip-pools"
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "Pool-A",
"start_ip": "192.168.1.1",
"end_ip": "192.168.1.254",
})
req, _ := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
use serde_json::json;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let response = client
.post(format!("{BASE_URL}/api/v1/ip-pools"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
"name": "Pool-A",
"start_ip": "192.168.1.1",
"end_ip": "192.168.1.254"
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Update IP Pool
Update an existing IP pool.
| Property | Value |
|---|---|
| Endpoint | Update IP Pool |
| Method | PUT |
| URL | /api/v1/ip-pools/{id} |
| Authentication | Bearer Token |
Request Body:
json
{
"name": "Pool-Updated"
}Success Response (200 OK):
json
{
"success": true,
"message": "IP Pool updated successfully"
}Code Examples:
bash
curl -X PUT "https://your-domain.com/api/v1/ip-pools/1" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-auth-token" \
-d '{
"name": "Pool-Updated"
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$ipPoolId = 1;
$response = $client->request('PUT', "/api/v1/ip-pools/{$ipPoolId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'name' => 'Pool-Updated',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const ipPoolId = 1;
const response = await fetch(`${BASE_URL}/api/v1/ip-pools/${ipPoolId}`, {
method: 'PUT',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
name: 'Pool-Updated',
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
ip_pool_id = 1
response = requests.put(
f"{BASE_URL}/api/v1/ip-pools/{ip_pool_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"name": "Pool-Updated",
},
)
data = response.json()
print(data)go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
ipPoolId := 1
endpoint := baseURL + "/api/v1/ip-pools/" + strconv.Itoa(ipPoolId)
payload, _ := json.Marshal(map[string]any{
"name": "Pool-Updated",
})
req, _ := http.NewRequest("PUT", endpoint, bytes.NewBuffer(payload))
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
use serde_json::json;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let ip_pool_id = 1;
let response = client
.put(format!("{BASE_URL}/api/v1/ip-pools/{ip_pool_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"name": "Pool-Updated"
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Delete IP Pool
Delete an IP pool from the system.
| Property | Value |
|---|---|
| Endpoint | Delete IP Pool |
| Method | DELETE |
| URL | /api/v1/ip-pools/{id} |
| Authentication | Bearer Token |
Success Response (200 OK):
json
{
"success": true,
"message": "IP Pool deleted successfully"
}Code Examples:
bash
curl -X DELETE "https://your-domain.com/api/v1/ip-pools/1" \
-H "Accept: application/json" \
-H "Authorization: Bearer your-auth-token"php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$ipPoolId = 1;
$response = $client->request('DELETE', "/api/v1/ip-pools/{$ipPoolId}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const ipPoolId = 1;
const response = await fetch(`${BASE_URL}/api/v1/ip-pools/${ipPoolId}`, {
method: 'DELETE',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
ip_pool_id = 1
response = requests.delete(
f"{BASE_URL}/api/v1/ip-pools/{ip_pool_id}",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
)
data = response.json()
print(data)go
package main
import (
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
ipPoolId := 1
endpoint := baseURL + "/api/v1/ip-pools/" + strconv.Itoa(ipPoolId)
req, _ := http.NewRequest("DELETE", endpoint, nil)
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let ip_pool_id = 1;
let response = client
.delete(format!("{BASE_URL}/api/v1/ip-pools/{ip_pool_id}"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}Generate IPs
Generate individual IP addresses from the pool range.
| Property | Value |
|---|---|
| Endpoint | Generate IPs |
| Method | POST |
| URL | /api/v1/ip-pools/{id}/generate |
| Authentication | Bearer Token |
Request Body:
json
{
"isp_id": 1,
"branch_id": 1,
"user_id": 1
}Success Response (200 OK):
json
{
"success": true,
"message": "IPs generated successfully",
"data": {
"generated": 254
}
}Code Examples:
bash
curl -X POST "https://your-domain.com/api/v1/ip-pools/1/generate" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-auth-token" \
-d '{
"isp_id": 1,
"branch_id": 1,
"user_id": 1
}'php
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://your-domain.com']);
$ipPoolId = 1;
$response = $client->request('POST', "/api/v1/ip-pools/{$ipPoolId}/generate", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer your-auth-token',
],
'json' => [
'isp_id' => 1,
'branch_id' => 1,
'user_id' => 1,
],
]);
$data = json_decode($response->getBody(), true);
print_r($data);javascript
const BASE_URL = 'https://your-domain.com';
const TOKEN = 'your-auth-token';
const ipPoolId = 1;
const response = await fetch(`${BASE_URL}/api/v1/ip-pools/${ipPoolId}/generate`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Authorization: `Bearer ${TOKEN}`,
},
body: JSON.stringify({
isp_id: 1,
branch_id: 1,
user_id: 1,
}),
});
const data = await response.json();
console.log(data);python
import requests
BASE_URL = "https://your-domain.com"
TOKEN = "your-auth-token"
ip_pool_id = 1
response = requests.post(
f"{BASE_URL}/api/v1/ip-pools/{ip_pool_id}/generate",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {TOKEN}",
},
json={
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
},
)
data = response.json()
print(data)go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
const baseURL = "https://your-domain.com"
const token = "your-auth-token"
func main() {
ipPoolId := 1
endpoint := baseURL + "/api/v1/ip-pools/" + strconv.Itoa(ipPoolId) + "/generate"
payload, _ := json.Marshal(map[string]any{
"isp_id": 1,
"branch_id": 1,
"user_id": 1,
})
req, _ := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}rust
use reqwest::Client;
use serde_json::json;
const BASE_URL: &str = "https://your-domain.com";
const TOKEN: &str = "your-auth-token";
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new();
let ip_pool_id = 1;
let response = client
.post(format!("{BASE_URL}/api/v1/ip-pools/{ip_pool_id}/generate"))
.header("Accept", "application/json")
.bearer_auth(TOKEN)
.json(&json!({
"isp_id": 1,
"branch_id": 1,
"user_id": 1
}))
.send()
.await?;
let data: serde_json::Value = response.json().await?;
println!("{data:#}");
Ok(())
}