Riken ScraperDocs

Retries and idempotency

Retry safely with an Idempotency-Key. A replayed answer is never charged twice.

Send an Idempotency-Key header with any string up to 255 characters. Use a new key for each logical request and the same key for its retries.

curl -s "https://scraper.riken.me/v1/tiktok/profile?handle=example_creator" \
  -H "x-api-key: $RIKEN_API_KEY" \
  -H "Idempotency-Key: profile-example_creator-2026-11-11"

How it behaves

caseresult
same key, same parameters, within 24 hoursthe stored answer comes back with Idempotent-Replay: true. Not charged again.
same key, other parametersa new request, charged on its own. The key is bound to the parameters.
same key while the first request still runs409 idempotency_conflict with Retry-After: 1. Wait and retry.
the first answer was an error or freenothing was stored, so the retry runs again
another API key, same Idempotency-Keyunrelated. Replays never cross API keys.

Only charged answers are stored.

A retry loop

import time, uuid, requests

def get(url, key, params):
    idem = str(uuid.uuid4())
    for attempt in range(5):
        r = requests.get(url, params=params, timeout=200,
                         headers={"x-api-key": key, "Idempotency-Key": idem})
        if r.status_code in (409, 429, 503) or r.status_code >= 500:
            time.sleep(int(r.headers.get("Retry-After", 2 ** attempt)))
            continue
        return r
    return r

On this page