Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Token Regenerate

Replaces your API token with a new one.

POST /v1/token/regenerate

Request

No body. Authenticate with the token you want to replace.

curl -X POST https://scrape.iproyal.com/v1/token/regenerate \
  -H "Authorization: Bearer $WEB_SCRAPER_API_TOKEN"
<?php

$ch = curl_init('https://scrape.iproyal.com/v1/token/regenerate');

curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('WEB_SCRAPER_API_TOKEN'),
    ],
]);

$body = json_decode(curl_exec($ch), true);

echo $body['api_token'] . PHP_EOL;
import os

import requests

response = requests.post(
    "https://scrape.iproyal.com/v1/token/regenerate",
    headers={"Authorization": f"Bearer {os.environ['WEB_SCRAPER_API_TOKEN']}"},
    timeout=30,
)
response.raise_for_status()

print(response.json()["api_token"])

Response

{
  "api_token": "033d1ef78e0c7abb0130892b2471ef951e379f38378c3a5ff6b7649caeae"
}
Field
Type
Description

api_token

string

Your new API token

After You Regenerate

  1. Save the new token in your secrets storage.

  2. Update every application that uses the old token.

  3. Restart long-running jobs so they read the new value.

Your credit balance, limits, and usage history stay the same. Requests already running when you regenerate are not affected.

You can also regenerate your token in the IPRoyal dashboard. If a token leaks, regenerate it right away.

Errors

HTTP Status

error.code

401

invalid_token

403

account_suspended or account_disabled

A suspended or disabled account cannot regenerate its token. Contact IPRoyal Support in that case.

Last updated

Was this helpful?