Errors, limits and idempotency

    Error format, HTTP codes, calls-per-minute limit and how the Idempotency-Key prevents double charges.

    View as Markdown

    Error format

    json
    { "success": false, "error": "INVALID_GB", "message": "Quantidade de GB inválida.", "field": "gb" }
    • error: fixed code. Use this field in your program.
    • message: text for people. It can change.
    • field: shows up when the problem is a specific field.

    Every response includes the x-correlation-id header. Send this value to support when you ask for help with a call.

    HTTP codes

    HTTPWhen it happens
    200 / 201It worked (201 when an order was created)
    400Some data is wrong. Fix it before trying again.
    401Key missing, invalid or expired
    403Missing permission, or the IP is not on the key's list
    404The proxy or order does not exist in this account
    409Conflict: location with no IP, order in progress, proxy unavailable
    422Idempotency-Key reused with a different order
    429Rate limit. Wait the time in the Retry-After header.
    500 / 502 / 503Our failure or a temporary one. Try again in a few seconds.

    Most common codes

    CodeWhat to do
    MISSING_API_KEY / INVALID_API_KEYCheck the header and the key. It may have been revoked.
    EXPIRED_API_KEYCreate a new key in the panel.
    IP_NOT_ALLOWEDCall from an IP on the key's list or edit the list.
    INSUFFICIENT_SCOPEThe key does not have the permission. Purchases require the Purchases permission.
    RATE_LIMITEDWait and slow down.
    PROXY_NOT_FOUNDThe id is not a proxy in your account.
    INVALID_PRODUCT / INVALID_GB / INVALID_PACKAGESee the limits in GET /v1/products.
    INVALID_COUPONCoupon does not exist, has expired or does not meet the rules.
    INVALID_DOCUMENTInvalid CPF or CNPJ for the Pix.
    ACCOUNT_EMAIL_MISSINGComplete your account details in the panel.
    GEO_NOT_SUPPORTEDThe product does not accept state or city.
    STATE_REQUIREDTo choose a city, also send the state.
    INVALID_SESSIONsession_minutes must be from 1 to 120, or null.
    NO_PROXIES_FOR_LOCATIONChoose a larger area. Nothing changed.
    INVALID_IPSend a valid IPv4.
    ORDER_STATUS_UNKNOWNThe order could not be confirmed. Check GET /v1/orders before trying to buy again.

    Rate limits

    LimitValue
    Per key60 calls per minute
    Per IP, adding up all keys300 calls per minute
    Active keys per account5
    GB per orderSee max_gb_per_order in GET /v1/products

    When you go over the limit, the response is 429 with the Retry-After header (in seconds). To track orders, poll every 5 to 10 seconds.

    Idempotency: never charge twice

    Every purchase and every top-up requires the Idempotency-Key header. Generate a new code for each purchase (a UUID works) and store it with the order in your system.

    http
    Idempotency-Key: 6f1c2a90-3b7e-4f7a-9a51-2d0c8e6b1f44

    How it works:

    • Same code and same order: the API returns the first response, with the Idempotent-Replayed: true header. It does not create another order.
    • Same code with a different order: 422 IDEMPOTENCY_KEY_REUSED. Generate a new code.
    • Two identical calls at the same time: the second one gets 409 REQUEST_IN_PROGRESS. Wait 5 seconds and repeat.
    • Temporary error (429 or 5xx): the code is released and you can repeat the same call.

    Code rule: 8 to 128 characters, with letters, numbers and _ - : ..

    Example of a safe retry in Python:

    python
    import uuid, time, requests
    
    key = str(uuid.uuid4())  # one per purchase
    for tentativa in range(3):
        r = requests.post(
            "https://api.rh7proxys.com/v1/orders",
            headers={"Authorization": "Bearer rh7k_your_key", "Idempotency-Key": key},
            json={"product": "residential", "gb": 10},
            timeout=60,
        )
        if r.status_code < 500 and r.status_code != 429:
            break
        time.sleep(5)
    print(r.json())