Skip to content
You're eligible for 55–60% off list ratesClaim now!

The API and API Tokens

Create API tokens, understand their product and pool scope, and use the versioned HTTP API to manage sub-users, generate endpoints and read usage.

Last updated

The dashboard is for humans; the API is for your pipelines. Anything you manage by hand, from creating sub-users to generating proxy configuration, you can also drive from code with an API token.

Creating a token

Open API & MCP in the dashboard sidebar, above Settings. The page has two tabs: API Tokens, which lists your account's tokens and lets you create a new one, and API Reference, which renders the live OpenAPI document with per-endpoint code samples and a request runner.

  • Give the token a name so you can tell your tokens apart later.
  • Choose its scope: the product and pool pairs it may use.
  • Press Create token.

The token value is shown once. Copy it immediately. It is stored only as a hash, so it cannot be retrieved again. If you lose it, revoke it and create a replacement.

An account can hold up to five tokens, the same ceiling as its sub-users. Support can raise that limit on request, and it raises the sub-user limit too.

Scope

A token is not an account key with full access. Each token carries an explicit set of (product, pool) pairs, for example residential on one pool and mobile on another. Within those pairs it can do everything operational: manage every user, reset proxy passwords, set allocations, and generate configuration.

A pool is a source of exit IPs for a product. Today every product is served by a single pool, so a pair usually reads as just the product; the pool dimension exists because a product may be served by more than one pool. The pair selects which pool's addresses an endpoint uses.

Two boundaries are worth stating plainly:

  • No billing. A token can never buy traffic, create a checkout, change a plan or read invoices. Spending stays a dashboard action.
  • No token management. A token cannot create or revoke other tokens. That surface requires a signed-in dashboard user, so a leaked token can never extend its own reach.

Authenticating

Send the token as a Bearer credential on every request.

curl https://lightningbytes.com/api/v1/me \
  -H "Authorization: Bearer sk-lb_your_token"

A request with a missing, revoked or expired token receives 401. A request outside the token's scope receives 403 with a scope_denied code. A token whose account is on hold receives 403 with account_on_hold.

The endpoints

Every route lives under /api/v1. Where a token is scoped to one pool for a product, you may omit pool; where it spans several, name the one you mean.

Method and pathWhat it does
GET /meYour token's identity and effective scope
GET /productsIn-scope products with balance and usage
GET /poolsIn-scope pools with their products and capabilities
GET /locationsCountries a pool supports for a product
GET /locations/{country}/regionsRegions of a country the pool supports
GET /locations/{country}/regions/{region}/citiesCities of a region the pool supports, paged
GET /usersList sub-users
POST /usersCreate a sub-user with one or more services
GET /users/{id}One sub-user
DELETE /users/{id}Delete a sub-user and release its credentials
POST /users/{id}/passwordReset a sub-user's proxy password
POST /users/{id}/enableEnable a service grant
POST /users/{id}/disableDisable a service grant
PATCH /users/{id}/allocationSet a sub-user's traffic allocation
GET /users/{id}/endpointsGenerate proxy configuration
POST /users/{id}/endpoints/rotateRegenerate configuration with fresh session ids
POST /proxy-checkCheck an endpoint's connectivity and exit IP
GET /usage/overviewBalance and usage per product
GET /usage/trafficPeriod traffic bytes
GET /usage/traffic/historyTraffic time series
GET /usage/requests/historyRequest-count series
GET /usage/breakdownShare of traffic by user and by country
GET /usage/usersPer-sub-user traffic for the period

Generating an endpoint

Requesting configuration for a sub-user returns credentials and wire parts. Omit session_id to get a fresh exit IP per row, or pass one to pin a sticky session.

curl "https://lightningbytes.com/api/v1/users/USER_ID/endpoints?product=residential&protocol=socks5&country=us&count=3" \
  -H "Authorization: Bearer sk-lb_your_token"

Targeting is validated against what the pool actually supports. An unsupported parameter or place is a 400 unsupported_targeting, never a silently dropped one. country is a two-letter code, region is a region code such as US.OH (any case), city is a numeric city id, and session_id is 1 to 32 letters and digits. state is still accepted as a deprecated alias of region; use region in new code. A region must belong to the country, and a city to the country and, when given, the region.

Find valid values with the location routes. Every location route takes product and pool and lists only what that pool serves, so two pools can return different lists, and a pool that is not yours or does not serve the product is a 400 invalid_pool. Regions come back as codes with a name and a placeholder flag, and cities as an id and a name. A region with placeholder: true (named Other) bundles the places the pool does not group by region: it is the only region of a country the pool serves countrywide, and otherwise it comes last and appears only when some cities need it. Pass its code as region like any other. The cities route takes limit (at most 500), offset and a q filter, so large regions are read a page at a time.

curl "https://lightningbytes.com/api/v1/locations/us/regions/US.OH/cities?product=residential&q=col&limit=20" \
  -H "Authorization: Bearer sk-lb_your_token"

Then pass the id you want:

curl "https://lightningbytes.com/api/v1/users/USER_ID/endpoints?product=residential&country=us&region=US.OH&city=4509177" \
  -H "Authorization: Bearer sk-lb_your_token"

Usage periods

The usage routes take an optional start_at and end_at. Each is an ISO-8601 date or date-time, at most 40 characters; a date-time with no offset is read as UTC. The period is rounded out to whole hours and may span at most 100 days. An empty value, or leaving the parameter out, uses the default period.

Errors

Every error has the same body: { "error": { "code": "...", "message": "..." } }. Branch on code; the message is for people and may change.

Status and codeMeaning
400 bad_requestA parameter is missing or out of range
400 unsupported_targetingThe pool does not support a targeting parameter or place you sent; the message points to the location routes
400 invalid_pool, 400 ambiguous_poolThe pool does not serve that product, or the token holds several pools for it and none was named
400 insufficient_balanceThe allocation is larger than the remaining balance can back
401 unauthorizedMissing, revoked or expired token
403 scope_deniedOutside the token's product and pool scope
403 account_on_holdThe account is on hold; contact support@lightningbytes.com
503 locations_unavailableThe location list could not be read; retry shortly. A request with no location is unaffected
404 not_foundNo such sub-user on your account
409 not_provisionedThe sub-user has no active proxy for that product yet; retry shortly
429 rate_limitedToo many requests or too many proxy checks at once; retry after a short wait
502 pool_errorThe pool could not complete the request; retry shortly
503 service_unavailable, 503 pool_unavailableTemporarily unavailable; retry shortly

The OpenAPI document lists the codes on its Error schema.

Connecting an MCP client

The same token you created above also authenticates an MCP server, so an agent can manage the account directly instead of calling each HTTP endpoint itself. Send the token as a bearer credential to the endpoint below.

https://www.lightningbytes.com/api/mcp

Use the www host exactly as written. The apex (lightningbytes.com) redirects to www, and an HTTP client drops the Authorization header when a redirect changes the host, so an apex URL fails with 401 even though the token is valid.

For Claude Code, one command adds it:

claude mcp add --transport http lightningbytes \
  https://www.lightningbytes.com/api/mcp \
  --header "Authorization: Bearer sk-lb_your_token"

For any other client, the MCP tab of API & MCP has a copy-ready block per client. The client you pick decides one field: Roo Code and Zoo Code require an explicit "type": "streamable-http" on a URL entry and will not load one without it, Cursor infers the transport from the url, VS Code names it "http", and Claude Desktop's local config file accepts only stdio servers, so its block bridges the endpoint through mcp-remote. See Using the MCP Server for the full table and the failure symptoms.

The MCP server exposes the same operational actions as the HTTP API: reading products, pools, locations and usage; listing, creating and deleting sub-users; resetting a proxy password; enabling, disabling and allocating a sub-user; generating and rotating endpoints; and checking a proxy. A separate tool returns the dashboard link for adding traffic, which is where a human completes a purchase.

Note

The token's product and pool scope applies to MCP exactly as it does to the HTTP API. A tool call outside the token's scope is refused.

Important

MCP is operational only, like the API: no tool can buy traffic, change a plan or read invoices. Adding traffic stays a signed-in dashboard action.

The OpenAPI specification

The machine-readable contract is served at /api/v1/openapi.json. Point a client generator or a request tool at it to explore the surface.

The same document is rendered as an interactive reference in the dashboard, on the API Reference tab of API & MCP. It shows every endpoint with code samples in several languages and its own authentication panel, so you can paste a token and run a request without leaving the page. To open the reference directly, link to /dashboard/api?tab=api-reference.

Revoking a token

Revoke a token from the API & MCP page's API Tokens tab with the row's Revoke action. Revocation is immediate: any request using that token fails with 401.

Start working with cleaner IPs

Clean, pre-filtered residential and mobile proxies, sign up and send your first request in minutes.