# Possible to check if username is available through API?

**URL:** <https://discuss.dev.twitch.com/t/possible-to-check-if-username-is-available-through-api/17659>\
**Category:** API\
**Created:** [September 13, 2018, 12:17am UTC](https://discuss.dev.twitch.com/t/possible-to-check-if-username-is-available-through-api/17659 "2018-09-13T00:17:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryancole](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/ryancole/32/3803_2.png) [@ryancole](https://discuss.dev.twitch.com/u/ryancole)\
**Post date:** [September 13, 2018, 12:17am UTC](https://discuss.dev.twitch.com/t/possible-to-check-if-username-is-available-through-api/17659/1 "2018-09-13T00:17:54Z")

</div>

Hi folks,

Is there a way to check if a username is available through the API? I’m thinking about the page, on twitch, on which you can check if a username is available - [https://passport.twitch.tv/logins/new](https://passport.twitch.tv/logins/new).

I don’t see a way to check for that same information through the API.

If not, it’d probably be possible to mimic those same requests that that page makes, right?

---

<div class="post-metadata">

**Author:** ![Dist](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://discuss.dev.twitch.com/u/Dist)\
**Post date:** [September 13, 2018, 12:41am UTC](https://discuss.dev.twitch.com/t/possible-to-check-if-username-is-available-through-api/17659/2 "2018-09-13T00:41:25Z")

</div>

You can use the get channels v3 endpoint `https://api.twitch.tv/kraken/channels/CHANNEL_NAME`. If you get a channel not found response then the username should be available.

Keep in mind, this is a deprecated endpoint so will be removed at some point in the future, and while there are new endpoints that let you look up a username these are not as reliable for this use case as while they would certainly tell you if a username is in use, it doesn’t differentiate between unused usernames that are available and usernames that are ‘unavailable’ such as deactivated or suspended accounts.

---

<div class="post-metadata">

**Author:** ![ryancole](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/ryancole/32/3803_2.png) [@ryancole](https://discuss.dev.twitch.com/u/ryancole)\
**Post date:** [September 13, 2018, 12:49am UTC](https://discuss.dev.twitch.com/t/possible-to-check-if-username-is-available-through-api/17659/3 "2018-09-13T00:49:11Z")

</div>

@Dist

That’d likely just be the equivalent of getting the “time machine” message, though, right? It wouldn’t be as accurate as what you can see on that passport logins page? As far as I understand, that page shows if a username is currently available to be used, right?

Is it worth trying to go through the effort of mimicking the requests on that form, or is there some mechanism there that prevents that? I’m poking at it right now and am getting some “failed to decode JSON” error.

I guess worst case scenario I could load the page up in a headless browser?

---

<div class="post-metadata">

**Author:** ![Dist](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://discuss.dev.twitch.com/u/Dist)\
**Post date:** [September 13, 2018, 12:57am UTC](https://discuss.dev.twitch.com/t/possible-to-check-if-username-is-available-through-api/17659/4 "2018-09-13T00:57:21Z")

</div>

The “time machine” page is somewhat like what the newer API endpoints are like in that it doesn’t differentiate between available usernames and ones that are unavailable because of things like suspensions.

The v3 endpoint will give you exactly what you need. If the username is in use, you’ll get back the channel object, if it’s unavailable for some other reason, you’ll get back a 422 unavailable message, and if you get back a 404 not found then the username is available for use.

---

<div class="post-metadata">

**Author:** ![ryancole](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/ryancole/32/3803_2.png) [@ryancole](https://discuss.dev.twitch.com/u/ryancole)\
**Post date:** [September 13, 2018, 1:09am UTC](https://discuss.dev.twitch.com/t/possible-to-check-if-username-is-available-through-api/17659/5 "2018-09-13T01:09:29Z")

</div>

@Dist thank you so much! Seems to work.

---

<div class="post-metadata">

**Author:** ![durland](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@durland](https://discuss.dev.twitch.com/u/durland)\
**Post date:** [September 13, 2018, 2:26am UTC](https://discuss.dev.twitch.com/t/possible-to-check-if-username-is-available-through-api/17659/6 "2018-09-13T02:26:58Z")

</div>

> [@Possible to change twitch username with api?](https://discuss.dev.twitch.com/t/possible-to-change-twitch-username-with-api/9535/2):
>
> https://passport.twitch.tv/usernames/\<username\> Check for http code 204. It’s not part of the official API.

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [October 13, 2018, 2:27am UTC](https://discuss.dev.twitch.com/t/possible-to-check-if-username-is-available-through-api/17659/7 "2018-10-13T02:27:01Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
