AI & Automation

What is API?

An API (application programming interface) is a defined contract that lets one program call another. On the web that usually means HTTP endpoints returning JSON, with an authentication header, documented parameters and stable error codes. Proxy providers publish APIs so a script can list endpoints, trigger an IP rotation or read bandwidth usage without anyone opening a dashboard.

A web API call is a method and a path, sometimes with a body: GET to read, POST to create, PATCH or PUT to update, DELETE to remove. The status code carries the outcome. 2xx means the request was accepted, 401 means the credential was missing or wrong, 403 means it was valid but not permitted, 404 means the resource does not exist, and 429 means you have exceeded a rate limit, usually with a Retry-After header telling you how long to wait. REST is the common style; GraphQL sends one query document to a single endpoint, and gRPC moves binary messages over HTTP/2.

Authentication is normally a token in a request header, either Authorization: Bearer followed by the token or a vendor-specific key header. Some APIs sign each request with an HMAC over the body and a timestamp, which prevents replay. Keep keys in environment variables or a secrets manager, never in the repository, and issue separate keys per environment so revoking one does not stop production. A 407 Proxy Authentication Required response is a different failure from 401: it comes from the proxy in front of the request, not from the API behind it.

Proxy control APIs tend to cover the same ground: list your endpoints, force a rotation, choose a country or carrier, read the GB consumed, create sub-users. Some providers put those controls in the proxy username string instead of a REST call, so a session or a geo target is encoded where credentials go. Check which model you are dealing with before designing worker code, because one implies an HTTP client and the other implies string templating. At PROXIES.SX, endpoints and rotation carry no charge, so a rotation loop costs nothing beyond the traffic it moves.

Consuming an API without pain comes down to a handful of habits. Set an explicit timeout on every call, because a hung socket blocks a worker indefinitely. Retry 429 and 5xx responses with exponential backoff plus jitter, and never retry a 400. Send an idempotency key on writes so a retried purchase does not run twice. Page with cursors rather than offsets where both exist. Pin the version in the path, subscribe to the changelog, and log the request identifier from each response so support can trace a failed call.

Where you meet it

An API becomes the answer when the dashboard stops being enough, with forty endpoints to check and usage figures you want inside your own monitoring. Most of the work is plumbing. Store the key outside the repository, set a timeout, decide what happens on a 429, log the request id. Read the error format before you write the happy path, because that is the part you will handle most often.

Common questions

What is the difference between a proxy endpoint and a provider API?

The proxy endpoint carries your traffic: you point a client at a host and port and requests exit through an IP address. The API controls the account around it - listing endpoints, forcing rotation, selecting a country, reading usage. They use different credentials and different failure codes, 407 for proxy auth and 401 for the API.

How should I store an API key safely?

Read it from an environment variable or a secrets manager at runtime, keep it out of version control and out of client-side code, and use separate keys for development and production. Rotate on any suspicion of exposure. Scope each key to the smallest permission set the job needs, so a leak has limited reach.

What should my code do when an API returns 429?

Stop, wait, and retry rather than looping immediately. If a Retry-After header is present, honour it exactly; otherwise back off exponentially with random jitter so parallel workers do not retry in lockstep. Cap the number of attempts, and reduce your steady-state request rate rather than relying on retries.

Related terms

MCP
MCP, the Model Context Protocol, is an open standard for connecting AI assistants to external tools and data. A server declares the tools, resources and prompts it provides; a client such as Claude Desktop, Claude Code or an IDE discovers them at runtime over JSON-RPC and calls them on the model's behalf, so one integration works across every compatible assistant.
AI Agent
An AI agent is a program that lets a language model choose its own next action toward a goal, calling tools such as a browser, an HTTP client or a shell between reasoning steps and feeding each result back into its context. A fixed script sets the order in advance; an agent derives it from what the last step returned.
Browser Automation
Browser automation is the scripted control of a real browser, navigating, clicking, typing and reading the rendered DOM in place of a person doing it by hand. Playwright, Puppeteer and Selenium drive Chromium, Firefox and WebKit over a debugging or WebDriver protocol, headless or with a visible window, for testing, scraping and agent work.
Puppeteer
Puppeteer is a Node.js library that drives Chrome and Chromium through the Chrome DevTools Protocol. From JavaScript it launches a browser, opens pages, clicks and types, intercepts network traffic and renders screenshots or PDFs. Teams run it to scrape pages that only assemble their content after JavaScript executes, and to automate logged-in workflows.
Playwright
Playwright is Microsoft's browser automation library. A single API drives Chromium, Firefox and WebKit, with official bindings for JavaScript, Python, .NET and Java. It has auto-waiting, isolated browser contexts, per-context proxy settings and a trace viewer that replays a failed run step by step, which makes it the usual pick for new automation projects.
Selenium
Selenium is a browser automation framework that drives real browsers through the W3C WebDriver protocol. It has official bindings for Java, Python, C#, Ruby and JavaScript, and Selenium Grid spreads runs across many machines. Long-standing use makes it the default in enterprise QA, though newer libraries handle waiting and proxy credentials with far less code.
Scrapy
Scrapy is an open-source Python framework for large-scale web crawling. Its asynchronous engine keeps many requests in flight at once, while spiders, item pipelines and downloader middlewares keep parsing separate from transport. Proxies plug into the middleware chain, so a crawl can change exit IP addresses without any edit to spider code.

Real 4G/5G mobile and residential IPs

PROXIES.SX runs carrier IPs in 100+ countries with HTTP and SOCKS5 on every endpoint. $4/GB down to $2.40/GB at volume, free endpoints and rotation, and your GB never expire.