Skip to main content

Quickstart

Three steps: register → create session → use proxy. New agents get a trial balance. so you can try without recharging.

Step 1: Register

Call the register API once to get credentials. Store api_key for all subsequent requests. Optional referral code (referral_code) can be provided during registration to associate the user with a designated agent.
curl -X POST "https://api.nexalayer.net/v1/account/register" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My AI Agent",
    "contact_email": "dev@example.com"
  }'
Use api_key in the X-API-Key header for all authenticated requests. Keep api_secret only if you use JWT; for API-Key-only mode you do not need it.

Step 2: Create a session (async)

Sessions are created asynchronously. The create call returns immediately with status: "creating". Poll GET /sessions/{session_id} until status is active.
curl -X POST "https://api.nexalayer.net/v1/sessions" \
  -H "X-API-Key: ak_a1b2c3d4e5f6g7h8" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "dynamic",
    "config": {
      "product_no": "out_dynamic_1",
      "traffic_gb": 1,
      "protocol": "http",
      "country": "US"
    }
  }'
Then poll until active:
curl -X GET "https://api.nexalayer.net/v1/sessions/sess_a1b2c3d4-e5f6-7890" \
  -H "X-API-Key: ak_a1b2c3d4e5f6g7h8"
When data.status === "active", use data.proxy.full_url (e.g. http://user:pass@host:port) to send traffic.

Step 3: Send traffic via proxy

Use the session’s proxy URL in your HTTP client.
import requests
import time

BASE_URL = "https://api.nexalayer.net/v1"
headers = {"X-API-Key": "ak_a1b2c3d4e5f6g7h8"}

# Create session (async)
resp = requests.post(
    f"{BASE_URL}/sessions",
    json={
        "type": "dynamic",
        "config": {
            "product_no": "out_dynamic_1",
            "traffic_gb": 1,
            "protocol": "http",
            "country": "US"
        }
    },
    headers=headers
)
session_id = resp.json()["data"]["session_id"]

# Poll until active
while True:
    r = requests.get(f"{BASE_URL}/sessions/{session_id}", headers=headers)
    data = r.json()["data"]
    if data["status"] == "active":
        proxy_url = data["proxy"]["full_url"]
        break
    time.sleep(2)

# Use proxy
proxies = {"http": proxy_url, "https": proxy_url}
r = requests.get("https://httpbin.org/ip", proxies=proxies)
print(r.json())  # origin = proxy IP

Summary

StepActionEndpoint
1RegisterPOST /account/register
2Create sessionPOST /sessions → poll GET /sessions/{session_id}
3Use proxyConfigure HTTP client with proxy.full_url
Next: Authentication (API Key vs JWT), Sessions (dynamic vs static, rotate, renew, terminate).