Skip to main content
ScrapingRabbit

Blog · · 4 min read

Check TikTok and Instagram Username Availability in Code

Check whether a TikTok or Instagram username is taken with one GET request. See the response fields, a loop that tests many names, and why available is not a guarantee.

Picking a handle is a small task that gets repetitive fast. You want one name that works on several platforms, and you do not want to open a sign-up page for every idea. This guide shows how to check names in code, and how to read the answer.

The two endpoints

Both endpoints take a single username parameter and return the same kind of answer. Every call needs an API key. New accounts get 100 free credits and a first key is created automatically on sign-up (it is shown once on the dashboard). Sign in at scrapingrabbit.com/login, then send the key in the x-api-key header (a Bearer token also works). The code below reads it from the SCRAPINGRABBIT_API_KEY environment variable, so no key is ever written into your code.

curl -H "x-api-key: $SCRAPINGRABBIT_API_KEY" "https://api.scrapingrabbit.com/v1/tiktok/username/check?username=zachking"
curl -H "x-api-key: $SCRAPINGRABBIT_API_KEY" "https://api.scrapingrabbit.com/v1/instagram/username/check?username=nasa"

Send the name without the @ sign. Each successful call costs about 5 credits. That is an estimate that has not been measured yet, so check the pricing page for current numbers.

Read the answer

Here is a shortened real answer for an Instagram name that is in use:

{
  "success": true,
  "data": {
    "username": "nasa",
    "taken": true,
    "available": false,
    "reason": "taken",
    "account": {
      "id": "528817151",
      "fullName": "NASA",
      "followers": 104229234,
      "verified": true
    }
  }
}

The fields you will use most:

FieldMeaning
taken and availableOpposites. Use whichever reads better in your code.
reasonA short word for why. The example shows taken.
accountPublic details of the account that holds the name, when there is one.

For a name that is free, available is true and there is no account to describe.

Check many names

Here is a JavaScript loop that tests a list of ideas on TikTok, one at a time, with a pause in between. The pause of 6.5 seconds keeps it under the free plan's limit of 10 requests per minute. On a bigger plan you can shorten it:

const ideas = ["northwind", "northwind.co", "getnorthwind"];
const headers = { "x-api-key": process.env.SCRAPINGRABBIT_API_KEY };
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

for (const name of ideas) {
  const url = `https://api.scrapingrabbit.com/v1/tiktok/username/check?username=${encodeURIComponent(name)}`;
  const body = await (await fetch(url, { headers })).json();
  if (!body.success) {
    console.warn(name, "could not be checked:", body.code, body.message);
  } else {
    console.log(name, body.data.available ? "looks free" : "taken");
  }
  await wait(6500);
}

Three details make this safe to run:

  • encodeURIComponent keeps unusual characters from breaking the URL.
  • The loop checks success before it reads data, so one failed request does not stop the run.
  • The pause keeps you inside your key's per-minute limit and keeps the credit cost predictable. If you do hit the limit, you get a 429 status with the code RATE_LIMITED and a Retry-After header that tells you how many seconds to wait. Failed calls are not charged.

What counts as a valid name

The checker only accepts names it can look up, and it refuses anything else before it makes a request. A name must be 1 to 30 characters long and use only letters, numbers, dots and underscores. It must start and end with a letter, a number or an underscore, so a name that ends in a dot is rejected. You can also paste a profile link and the name is taken from it, as long as the link is on tiktok.com or instagram.com.

These rules are deliberate. They keep odd input out of your requests and make the answer easy to trust. If your own code accepts names from users, apply the same checks before you call the endpoint, so you do not waste requests on names that can never be valid.

Why available is not a guarantee

The checker looks for a public account with that name at the moment you ask. That is useful, but it cannot see everything. A platform can hold back names for its own reasons, and it can block names that were used by accounts that were removed. Those names may show as available here and still be refused at sign-up.

So use the answer to shortlist names, then confirm your final choice on the platform itself.

Finding a name that works on both

A practical way to work is to check each idea on both platforms and keep only the ones that are free on both. Run the TikTok and Instagram checks for the same name in your loop and print the pair. You can then pick from the shortlist and register it in one session.

Try it without code

The free checkers do the same lookup in the browser, with no key needed: one for TikTok and one for Instagram. They show whether the name is free and, for a taken name, who has it. If you need to check names inside your own product, call the endpoints shown above.

Try it yourself

Frequently asked questions

If a name shows as available, can I always register it?

No. A platform can reserve or block names that it does not show publicly. Treat available as a strong hint and confirm on the sign-up page.

Can I check a long list of names?

Yes, one request per name. Keep a pause between requests. Each successful check costs credits (about 5 per call, an estimate, see the pricing page for current numbers), and each key is limited to 10 requests per minute on the free plan, 60 on Starter, 120 on Pro and 300 on Scale.

Does the checker tell me who owns a taken name?

It returns a few public details about the account that holds the name, such as the display name, the follower count and whether it is verified.

More guides