Skip to main content
POST
/
v1
/
allowed_ips
Create an Allowed IP
curl --request POST \
  --url https://api.us.lexful.app/v1/allowed_ips \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Account-ID: <api-key>' \
  --data '
{
  "ip_address": "<string>",
  "description": "<string>",
  "enabled": true
}
'
import requests

url = "https://api.us.lexful.app/v1/allowed_ips"

payload = {
    "ip_address": "<string>",
    "description": "<string>",
    "enabled": True
}
headers = {
    "Authorization": "Bearer <token>",
    "X-Account-ID": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <token>',
    'X-Account-ID': '<api-key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ip_address: '<string>', description: '<string>', enabled: true})
};

fetch('https://api.us.lexful.app/v1/allowed_ips', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.us.lexful.app/v1/allowed_ips",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'ip_address' => '<string>',
    'description' => '<string>',
    'enabled' => true
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
    "X-Account-ID: <api-key>"
  ],
]);

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

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

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

func main() {

	url := "https://api.us.lexful.app/v1/allowed_ips"

	payload := strings.NewReader("{\n  \"ip_address\": \"<string>\",\n  \"description\": \"<string>\",\n  \"enabled\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("X-Account-ID", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.us.lexful.app/v1/allowed_ips")
  .header("Authorization", "Bearer <token>")
  .header("X-Account-ID", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"ip_address\": \"<string>\",\n  \"description\": \"<string>\",\n  \"enabled\": true\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.us.lexful.app/v1/allowed_ips")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["X-Account-ID"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"ip_address\": \"<string>\",\n  \"description\": \"<string>\",\n  \"enabled\": true\n}"

response = http.request(request)
puts response.read_body
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "ip_address": "<string>",
  "enabled": true,
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "updated_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "description": "<string>"
}
{
  "status": 123,
  "message": "<string>",
  "error_id": "<string>",
  "error_code": "<string>",
  "developer_message": "<string>"
}
{
  "status": 123,
  "message": "<string>",
  "error_id": "<string>",
  "error_code": "<string>",
  "developer_message": "<string>"
}
{
  "status": 123,
  "message": "<string>",
  "error_id": "<string>",
  "error_code": "<string>",
  "developer_message": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer token

X-Account-ID
string
header
required

Account ID

Body

application/json
ip_address
string
required

IP address or CIDR range. Supports IPv4 only (e.g., 192.168.1.1, 10.0.0.0/8)

Minimum string length: 1
description
string

Optional description (e.g., "Office network", "VPN gateway")

Maximum string length: 500
enabled
boolean
default:true

Whether this allowed IP is active (defaults to true)

Response

Default Response

id
string<uuid>
required

Allowed IP unique identifier

ip_address
string
required

IP address or CIDR range (e.g., 192.168.1.1 or 10.0.0.0/8)

enabled
boolean
required

Whether this allowed IP is active

created_at
string<date-time>
required

Creation timestamp

updated_at
string<date-time>
required

Last update timestamp

created_by
string<uuid>
required

User ID who created this allowed IP

updated_by
string<uuid>
required

User ID who last updated this allowed IP

description
string | null

Optional description of this IP address