You are on page 1of 5

Events API documentation

What is Events API


Events API allows users to receive notifications about events like chat
messages, private messages, tips, etc. Any programming language can be
used to connect to this API from a 3rd party server.

Authorization
Events API access is controlled by tokens. You can create multiple access
tokens and delete them to remove access.

Make sure to select Events API scope to gain access to this API.

After deleting a token, please wait up to one minute for API access to get
revoked.

Warning
With these credentials, participating third party services can connect
features and services for your room, such as toy controls. Please only provide
your access token to services that you trust, as it does grant access to tip
information and private messages.

How to use it
Connect to the longpoll JSON event feed}
Longpoll JSON event feed¶
Steps:

1. Load the room event


feed https://eventsapi.chaturbate.com/events/:username/:token/ (dis
played on user’s settings page on CB)
2. You will receive a list of all latest events plus nextUrl.
3. Use nextUrl to load the next set of events, and continue like this for as
long as you want.

Optional query parameter

 timeout: The server will wait at most this long before returning results. If
a timeout is not set, the nextUrl will default to a 10 second timeout
o example: https://eventsapi.chaturbate.com/
events/:username/:token/?timeout=0
o default: 10
o min: 0
o max: 90

Example code

Note
The rate limit for the API is 2000 requests per minute.
Example Response
The response is a json encoded string that needs to be deserialized.

"events": [

"method": "chatMessage",

"id": "1625274862454-0",

"object": {...}

],

"nextUrl":
"https://eventsapi.chaturbate.com/events/testuser/*******************
*****/?i=1625274862454-0&timeout=10",

 events: an array that may contain zero or more items


 nextUrl: the URL you should extract and load to listen for subsequent
events

id refers to the unique ID of an event.


object field varies depending on method, please check Method Types.

Objects
broadcaster
type: string
name of the broadcaster

media
type: object

 (number) id: unique ID of media set


 (string) type: “photos” or “video”
 (string) name: name of media set
 (number) tokens: how many tokens paid

message
type: object

 (string) color: color of message


 (string or null) bgColor: background color of message
 (string) message: message
 (string) font: font of message
 (string) fromUser: username who sent message (Private Messages
only)
 (string) toUser: username who received message (Private Messages
only)

subject
type: string

the room title

tip
type: object

 (number) tokens: number of tokens tipped


 (bool) isAnon: did user tip anonymously?
 (string) message: tip message

user
type: object

 (string) user: the user’s username


 (bool) inFanclub: is the user in the broadcasters fan club
 (bool) hasTokens: does the user have at least 1 token
 (bool) isMod: is the user a moderator
 (string) recentTips: “none” (grey), “some” (dark blue), “lots” (light
purple), or “tons” (dark purple)
 (string) gender: “m” (male), “f” (female), “t” (trans), or “c” (couple)
 (string) subgender: “” (non-trans), “tf” (transfemme), “tm” (transmasc),
or “tn” (non-binary)

You might also like