Type of user ID in API responses

What is the underlying data-type of the _id property in responses involving the users Twitch API?

The Get User endpoint example implies the _id property is a number. However, the Get User by ID endpoint returns the ID as a string. Is this intentional, or is this a typo?

Are all Twitch user IDs strictly numeric data, or are some IDs an alphanumeric string? I’m curious about how this applies to stream/channel IDs as well.

Should my application cache user IDs as strings or as unsigned integers?

The newer endpoints use strings so that’s probably what you should store them as. In the future some features may use GUIDs.

See also information about Snowflake ID’s from Twitter https://blog.twitter.com/2010/announcing-snowflake and https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake

Basically it’s a string.

You should treat all IDs as strings. You do not need to do math on them and they may in the future be non-numeric.

You may want to make sure you treat it properly as potentially an integer or string depending on language, but @DallasNChains has stated they’re moving to all strings

Twitch API Version Update Discussion & FAQ

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