Fetching Users¶
At the core of TikTok are the users; those posting content and interacting with it. As such, the first item we'll take a look at is how we can fetch TikTok account data and what sort of information we can find.
The EnsembleData has two endpoints for fetching user information. The first reqiures a TikTok username, while the second requires a TikTok secuid. Let's take a look.
User Info From Username API¶
This is the slightly simpler of the two endpoints; we need to supply a TikTok username, which is easier to find, and we're done.
User data¶
There is a whole lot of information inside the user
object.
Here useful fields you can find inside the user
object are:
id
: The user's primary user id which you may need for other API calls.secUid
: The user's secondary user id which you may need for other API calls.nickname
: The user's display name.signature
: The user's TikTok bio.verified
: Whether the user is verified on TikTok.language
region
ins_id
: The user's Instagram id if they have connected their Instagram account.youtube_channel_id
: The user's YouTube channel title if they have connected their YouTube account.avatar...
: Various avatar fields which contains the profile picture in different resolutions.
Tip
The avatar...
fields in the user
object contain links to the profile picture that expire after a relatively short period of time. If you want to be able to access the profile picture later on, you should download it and store it yourself. Otherwise, you'll need to send another request later on to get the profile picture again.
User stats¶
Here's a little overview of what you'll find in the user stats
:
{
"user": ...,
"stats": {
"followingCount": 214, // Number of users this user is following
"followerCount": 26357770,
"heartCount": 1304183341, // Total number of likes this user's videos have received
"videoCount": 629, // Total number of videos this user has posted
"diggCount": 7244, // Total number of videos this user has liked
}
}
User Info From Secuid API¶
This endpoint requires a TikTok secuid.
Where do I find the secuid?
You'll find the secuid
in the response payloads for other EnsembleData TikTok API endpoints. For example, in the response payload for the Post Info
API, you'll find the secuid
under the author
object. If you're not using other endpoints, we would recommend using the User Info From Username
API instead of this one.
User data¶
Many of the fields are the same as what you will find in the User Info From Username
API response, though there are differences. For example, the user ids in this response are instead found under uid
and sec_uid
.
User stats¶
aweme_count
: Total number of videos this user has postedfollower_count
: Number of followers this user hasfollowing_count
: Number of users this user is followingtotal_favorited
: Total number of likes this user's videos have receivedfavoriting_count
: Number of videos this user has liked
Alternative method¶
There is an optional parameter to this endpoint called alternative_method
. By default it is set to false
, but if you set it to true
, the API will use an alternative method to fetch the user data. When using the the alternative method, the response payload will differ, though there may be some extra information available which you won't find in the default response.
Tip
We recommend, checking out the full response payload with the alternative_method
both enabled and disabled to see which option is most appropriate for your use case.