APIs & Access Tokens
We currently support the following actions you can make via requests from your code.
Event | Endpoint | Scope |
---|---|---|
System chat message | /api/integrations/chat/system | CAN_SEND_SYSTEM_MESSAGES |
Standard chat message | /api/integrations/chat/send | CAN_SEND_MESSAGES |
Chat action | /api/integrations/chat/action | CAN_SEND_SYSTEM_MESSAGES |
Remove chat message | /api/integrations/chat/messagevisibility | HAS_ADMIN_ACCESS |
Get chat history | /api/integrations/chat | HAS_ADMIN_ACCESS |
Get connected clients | /api/integrations/clients | HAS_ADMIN_ACCESS |
Set stream title | /api/integrations/streamtitle | HAS_ADMIN_ACCESS |
system message to client | /api/integrations/chat/system/client/{clientId} | CAN_SEND_SYSTEM_MESSAGES |
Visit the API documentation for each endpoint to learn more about what values are expected or will be returned. |
Your Owncast server will only accept actions from requests with a valid Access Token. Follow the below steps to create an access token.
- visit
/admin/access-tokens
on your owncast server. - Click
Create Access Token
. - Select the scope of permissions you want to give this token.
- Save this access token.
Your code
- Create a new request in your code.
- This request should send headers with
Authorization: Bearer
and your access token.
Example request:
{
headers: {
Content-Type: "application/json",
Authorization: "Bearer " + YOUR_ACCESS_TOKEN
},
{ body: "this is a system chat message" }
}
Test sending chat messages
Change the following curl
command to point to your server URL and use your auth token with “system message” access. It will send a system message to your chat.
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOURAUTHTOKEN" -d '{"body": "I am a system message!"}' http://YOUR.OWNCAST.SERVER/api/integrations/chat/system