Developers
Getting a token
To work with most API methods you need to obtain the user's access_token.1. Opening the authorization dialog – https://id.tviply.com/oauth
Parameters:
- client_id – The identifier of your application.
- redirect_uri – The address the user will be redirected to after completing authorization.
Example request:
https://id.tviply.com/oauth?client_id=1&redirect_uri=https://example.tv/oauth_back
If the user is not signed in to Tviply, the dialog will prompt them to sign in.
2. Getting the code
After the application is successfully authorized, the user's browser will be redirected to the redirect_uri specified when the authorization dialog was opened.
The code for obtaining the access key will be passed as a GET parameter:
https://example.tv/oauth_back?code=67c5e3b9f3d2fad016b4cee7c7b9c711
3. Getting the access_token
To obtain the access_token you need to make a request from your server to https://id.tviply.com/oauth/access_token, passing the following parameters:
Parameters:
- client_id – The identifier of your application.
- client_secret – The secret key of your application.
- redirect_uri – The address that was used to obtain the code at the first authorization step.
- code – The temporary code received after completing authorization.
Example request:
https://id.tviply.com/oauth/access_token?client_id=1
&client_secret=2a8ccfd229e40c67a013d9024a129c09e5f9402258e427207cab5aaba6829d69
&redirect_uri=https://example.tv/oauth_back
&code=67c5e3b9f3d2fad016b4cee7c7b9c711
The email and the access_token access key for the API methods will be returned in the response.
Further in the documentation access_token will be referred to as token
Methods API
abusetoken
Report an abuse signal.
POST abuse
Parameters:
- reason – reason id
- channel – channel name
- vodId – record id
- timer – time
- description – additional information
Example request:
curl -X POST -H "Authorization: Bearer token" -d '{"reason":1,"channel":"channelName"}' https://kouko.tviply.com/abuse
userstoken
Returns information about users.
GET users/param
Parameters:
- param – can be self, id or name of the user
Example request:
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/users/self
users/trackingtoken
Returns channel subscriptions.
GET users/tracking
Parameters:
- limit – how many records
- offset – list offset
Example request:
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/users/tracking?limit=10
users/settingstoken
Sets user settings.
PATCH users/settings
Parameters:
- name – check new name
- nameSave – save new name
Example request:
curl -X PATCH -H "Authorization: Bearer token" -d '{"name":"ExampleName"}' https://kouko.tviply.com/users/settings
users/pushTokenstokentrust
Sets tokens for sending push notifications.
PATCH users/pushTokens
Parameters:
- token_apns – token ios device
- token_droid – token android device
- webPush – subscription object from pushManager.subscribe(), up to 10 devices are kept per user
Example request:
curl -X PATCH -H "Authorization: Bearer token" -d '{"token_apns":"59407078da...e3de763c82f"}' https://kouko.tviply.com/users/pushTokens
curl -X PATCH -H "Authorization: Bearer token" -d '{"webPush":{"endpoint":"https://fcm.googleapis.com/fcm/send/f8Ld...","keys":{"p256dh":"BLc4xR...","auth":"tBHItJ..."}}}' https://kouko.tviply.com/users/pushTokensusers/avatartoken
Returns the <var>url</var> to send a POST request with the image to.
GET users/avatar
Example request:
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/users/avatar
curl -X POST -H "Authorization: Bearer token" --data-binary "@path/to/photo.jpg" urlusers/blacklisttoken
Blacklist management.
GET|POST|DELETE users/blacklist
Parameters:
- userId – user id
Example request:
# Get the blacklist
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/users/blacklist
# Add to the blacklist
curl -X POST -H "Authorization: Bearer token" -d '{"userId":1}' https://kouko.tviply.com/users/blacklist
# Remove from the blacklist
curl -X DELETE -H "Authorization: Bearer token" -d '{"userId":1}' https://kouko.tviply.com/users/blacklistchannelsfreedom
Returns information about channels.
GET channels/id
Parameters:
- id – channel id
- select – on-air = list of channels currently live
- limit – how many records
- offset – list offset
Example request:
curl -X GET https://kouko.tviply.com/channels/1
channels/livefreedom
Get the stream feed.
GET channels/live/id
Parameters:
- id – channel id
Example request:
curl -X GET https://kouko.tviply.com/channels/live/1
channels/rtmpSecrettokentrust
Returns the host and key of the user channel or generates a new one.
PUT channels/rtmpSecret
Parameters:
- channelId – channel id
- replace – generates a new key
Example request:
curl -X PUT -H "Authorization: Bearer token" -d '{"channelId":1,"replace":false}' https://kouko.tviply.com/channels/rtmpSecret
channels/statusfreedom
Returns the broadcast state.
GET channels/status/id
Parameters:
- id – channel id
Example request:
curl -X GET https://kouko.tviply.com/channels/status/1
channels/liketoken
Subscribes to or unsubscribes from a channel.
PUT channels/like
Parameters:
- channelId – channel id
Example request:
curl -X PUT -H "Authorization: Bearer token" -d '{"channelId":1}' https://kouko.tviply.com/channels/like
channels/belltoken
Turns notifications on/off.
PUT channels/bell
Parameters:
- channelId – channel id
Example request:
curl -X PUT -H "Authorization: Bearer token" -d '{"channelId":1}' https://kouko.tviply.com/channels/bell
channels/isFollowingtoken
Returns information about the subscription.
GET channels/isFollowing/channelNameId/checkUserName
Parameters:
- channelNameId – channel name or id
- checkUserName – user name
Example request:
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/channels/isFollowing/1/self
channels/settingstoken
Sets channel settings.
PATCH channels/settings/channelId
Parameters:
- channelId – channel id
- title – broadcast title
- description – channel description
- broadcast – broadcast category id
- restreamHost – restream host
- notification – on/off toggle
- vod – on/off toggle
- moments – on/off toggle
- restream – on/off toggle
- notifySubscription – on/off toggle
- forAdults – on/off toggle
Example request:
curl -X PATCH -H "Authorization: Bearer token" -d '{"title":"Example request"}' https://kouko.tviply.com/channels/settings/1
channels/covertoken
Returns the <var>url</var> to send a POST request with the image to.
GET channels/cover/channelId
Parameters:
- channelId – channel id
Example request:
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/channels/cover/1
curl -X POST -H "Authorization: Bearer token" --data-binary "@path/to/cover.jpg" urlchannels/followerstoken
List of channel subscribers.
GET channels/followers/channelId/limit/offset
Parameters:
- channelId – channel id
- limit – how many records
- offset – list offset
Example request:
curl -X GET https://kouko.tviply.com/channels/followers/1/10
channels/statstoken
Channel statistics data.
GET channels/stats/channelId
Parameters:
- channelId – channel id
Example request:
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/channels/stats/1
chatfreedomtoken
Latest messages, restrictions, roles.
GET chat/channelId
Parameters:
- channelId – channel id
Example request:
curl -X GET https://kouko.tviply.com/chat/1
chat/livefreedomtoken
Subscribe to receiving chat messages.
WebSocket chat/live
Parameters:
- channelId – channel id
- liveToken – Get it: curl -X GET -H "Authorization: Bearer {{token}}" https://id.tviply.com/check
Example request:
# Subscribe to chat messages
wscat -c "https://ws.tviply.com" -w 60 -x {"command":"subscribe","channel":"chat.channelId","data":{}}
# Adding authorization
wscat -c "https://ws.tviply.com/liveToken"chat/messagestoken
Message management.
GET|POST|PATCH chat/messages
Parameters:
- channelId – channel id
- message – message text
- voice – blob base64; type: audio/ogg; max size: 1 MiB
- userId – user id
- limit – how many records, maximum 100
- time – message time
Example request:
# Get your own or a user's latest messages.
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/chat/messages?channelId=1&userId=2&limit=10
# Send a message to the chat
curl -X POST -H "Authorization: Bearer token" -d '{"channelId":1,"message":"Test message by using api and curl"}' https://kouko.tviply.com/chat/messages
# Send a voice message
curl -X POST -H "Authorization: Bearer token" -d '{"channelId":1,"voice":"--blob-in-base64--"}' https://kouko.tviply.com/chat/messages
# Edit, only for the owner of messages from the last 5 min.
curl -X PATCH -H "Authorization: Bearer token" -d '{"channelId":1,"time":1679589698.6486,"message":"new text"}' https://kouko.tviply.com/chat/messages/1chat/usersfreedomtoken
Get the list of users.
GET chat/users/channelId/type
Parameters:
- channelId – channel id
- type – online | moderator | banned
Example request:
curl -X GET https://kouko.tviply.com/chat/users/1/online
chat/emotesfreedomtoken
Get/Add/Edit/Delete channel emotes.
GET | POST | PUT | DELETE chat/emotes/channelId
Parameters:
- channelId – channel id
- id – emote id
- name – new name
- url – path for uploading the emote
Example request:
# Get the list of channel emotes
curl -X GET https://kouko.tviply.com/chat/emotes/1
# Get the list of channel + user emotes
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/chat/emotes/1
# Change the unique name
curl -X PUT -H "Authorization: Bearer token" -d '{"id":10,"name":"nameEmote"}' https://kouko.tviply.com/chat/emotes/1
# Delete an emote
curl -X DELETE -H "Authorization: Bearer token" -d '{"id":10}' https://kouko.tviply.com/chat/emotes/1
# Upload an emote, returns the url to send a POST request with the image to.
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/chat/emotes/1/upload
curl -X POST -H "Authorization: Bearer token" --data-binary "@path/to/emote.gif" urlchat/translatetoken
Get a message translation, the target language comes from the user session.
POST chat/translate
Parameters:
- text – message text
Example request:
curl -X POST -H "Authorization: Bearer token" -d '{"text":"Test message by using api and curl"}' https://kouko.tviply.com/chat/translate
recordsfreedom
List of records.
GET records/vodId
Parameters:
- vodId – record id
- channelId – channel id
- broadcastId – category id
- limit – how many records
- offset – list offset
Example request:
curl -X GET https://kouko.tviply.com/records?channelId=1&limit=10
records/playfreedom
Get the record feed.
GET records/play/vodId
Parameters:
- vodId – record id
Example request:
curl -X GET https://kouko.tviply.com/records/play/a1b2c3d4e5
records/chatfreedom
Chat history of the record.
GET records/chat/vodId/part
Parameters:
- vodId – record id
- part – each part is 5 * 60 sec.
Example request:
curl -X GET https://kouko.tviply.com/records/chat/a1b2c3d4e5/1
records/playbacktoken
Save the playback position.
PUT records/playback
Parameters:
- vodId – record id
- time – position in sec.
Example request:
curl -X PUT -H "Authorization: Bearer token" -d '{"vodId":"a1b2c3d4e5","time":10}' https://kouko.tviply.com/records/playback
records/resumetoken
Get the playback position.
GET records/resume/vodId
Parameters:
- vodId – record id
Example request:
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/records/resume/a1b2c3d4e5
records/edittoken
Editing a record.
PUT records/edit/vodId
Parameters:
- vodId – record id
- name – title | broadcast
- value – value for name
Example request:
curl -X PUT -H "Authorization: Bearer token" -d '{"name":"title","value":"New title"}' https://kouko.tviply.com/records/edit/a1b2c3d4e5
records/removetoken
Delete a record.
DELETE records/remove
Parameters:
- vodId – record id
Example request:
curl -X DELETE -H "Authorization: Bearer token" -d '{"vodId":"a1b2c3d4e5"}' https://kouko.tviply.com/records/remove
records/covertoken
Generates a new cover.
PUT records/cover
Parameters:
- vodId – record id
Example request:
curl -X PUT -H "Authorization: Bearer token" -d '{"vodId":"a1b2c3d4e5"}' https://kouko.tviply.com/records/cover
records/mp4token
Request to create a source file in mp4 format.
GET | POST records/mp4/vodId
Parameters:
- vodId – record id
Example request:
# Creation request
curl -X POST -H "Authorization: Bearer token" https://kouko.tviply.com/records/mp4/a1b2c3d4e5
# Get the state
curl -X GET -H "Authorization: Bearer token" https://kouko.tviply.com/records/mp4/a1b2c3d4e5records/chaptersfreedomtoken
Get, change markers.
GET | PUT records/chapters/vodId
Parameters:
- vodId – record id
- list – list of chapters
Example request:
# Get
curl -X GET https://kouko.tviply.com/records/chapters/a1b2c3d4e5
# Replace
curl -X PUT -H "Authorization: Bearer token" -d '{"list":[{"position":0,"title":"Test position 0 sec."},{"position":60,"broadcast_id":1234}]}' https://kouko.tviply.com/records/chapters/a1b2c3d4e5records/activityfreedom
Get the chat activity of the record.
GET records/activity/vodId
Parameters:
- vodId – record id
Example request:
curl -X GET https://kouko.tviply.com/records/activity/a1b2c3d4e5
records/similarfreedom
Get similar records.
GET records/similar/vodId
Parameters:
- vodId – record id
Example request:
curl -X GET https://kouko.tviply.com/records/similar/a1b2c3d4e5
momentsfreedom
List of moments.
GET moments/momentId
Parameters:
- momentId – moment id
- channelId – channel id
- ownerId – owner id
- broadcastId – category id
- select – owner | unpublished
- limit – how many records
- offset – list offset
- sort – newest | popular | popular-month
Example request:
curl -X GET https://kouko.tviply.com/moments?channelId=1&limit=10
moments/playfreedom
Get the record feed.
GET moments/play/id
Parameters:
- id – moment id
Example request:
curl -X GET https://kouko.tviply.com/moments/play/a1b2c3d4e5
moments/edittoken
Editing a moment.
PUT moments/edit/id
Parameters:
- id – moment id
- name – title | broadcast
- value – value for name
Example request:
curl -X PUT -H "Authorization: Bearer token" -d '{"name":"title","value":"New title"}' https://kouko.tviply.com/moments/edit/a1b2c3d4e5
moments/removetoken
Delete a moment.
DELETE moments/remove
Parameters:
- id – moment id
Example request:
curl -X DELETE -H "Authorization: Bearer token" -d '{"id":"a1b2c3d4e5"}' https://kouko.tviply.com/moments/remove
moments/similarfreedom
Get similar moments.
GET moments/similar/id
Parameters:
- id – moment id
Example request:
curl -X GET https://kouko.tviply.com/moments/similar/a1b2c3d4e5
broadcastsfreedom
Get information about a broadcast category.
GET broadcasts/id
Parameters:
- idOrName – id or name of the broadcast category
- limit – how many records
- offset – list offset
Example request:
curl -X GET https://kouko.tviply.com/broadcasts?limit=10
broadcasts/searchfreedom
Search across broadcast categories.
GET broadcasts/search/query
Parameters:
- query – search text
Example request:
curl -X GET https://kouko.tviply.com/broadcasts/search/over
searchfreedom
Search across channels and broadcast categories.
GET search/query
Parameters:
- query – search text
Example request:
curl -X GET https://kouko.tviply.com/search/over