infrastructure

Idempotency

Idempotency means that making the same API request multiple times produces the same result as making it once, enabling safe retries without duplicate side effects.

An operation is idempotent if repeating it has the same observable effect as performing it once. HTTP GET and DELETE are idempotent by definition; HTTP POST (which creates a new resource each time) is not. Idempotency keys — unique identifiers sent with requests — allow servers to detect duplicate requests and return the cached result of the first execution instead of repeating the operation.

In scraping APIs, idempotency is important for reliable job submission under retries. If a client submits a scrape job and the network fails before the response arrives, the client cannot know whether the server received the request. An idempotency key lets the client safely retry: the server checks if a job with that key already exists and returns its status rather than creating a duplicate job.

Idempotency also applies to data writes in scraping pipelines: inserting a scraped record should use upsert semantics (insert if absent, ignore or update if present) to prevent duplicate rows when the same URL is scraped more than once.

Examples

# Pass an idempotency key with a scrape job submission
import httpx, uuid

key = str(uuid.uuid4())
response = httpx.post(
    "https://api.alterlab.io/v1/scrape",
    headers={"X-Idempotency-Key": key},
    json={"url": "https://example.com"}
)
# Safe to retry with the same key if this call fails

Related Terms

Extract Idempotency data from any website

AlterLab returns clean, structured data from any public URL — no scraper infrastructure needed. Start free, no credit card required.

View API docs

Your first scrape.
Sixty seconds.

$1 free balance. No credit card. No SDK.Just a POST request.

terminal
curl -X POST https://api.alterlab.io/v1/scrape \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "formats": ["markdown"]}'

No credit card required · Up to 5,000 free scrapes · Balance never expires

    Idempotency — Web Scraping Glossary | AlterLab