Changing stream title with python

Hello everyone! I am making a twitch bot that would change the title and/or game of my streams. I have been following the documentation and some threads already here and have gotten all the way up to getting an access token. However, the issue now lies with making a request and actually changing the title by using the following code:
channelEDIT_url = “” + “MY_CHANNEL_NAME”
headers =
‘Accept’: ‘application/vnd.twitchtv.v5+json’,
“client_secret” : “MY_BOTS_CLIENT_SECRET”,
“Authorization”: "OAuth " + (access token from,
“Content-Type”: “application/json”,
“scope” : “channel_editor”
data = {“channel[status]”: “NEW TITLE”}
response =, headers=headers, params=data)

The code doesn’t crash at least lol, but it still does not change the title of my stream or do anything… Would anybody know any fixes? Thank you for your time!

1 Like

This is horribly oudated. Kraken is long dead

Don’t need this header is kraken specific

You need to update to use the new URL and payload

URL: (not the username)
Method: PATCH
Headers: Authorization is prefixed with Bearer not OAuth
Payload: updated to match documented

It didn’t seem to work am I missing something? here is the code now:
channelEDIT_url = “” + “CHANNEL_ID_NUMERIC”
data =
“Client-ID”: “BOT_CLIENT_ID”,
“Authorization”: "Bearer " + ACCESS_TOKEN,
“Content-Type”: “application/json”,
“title” : “TEST TITLE”
response = requests.patch(channelEDIT_url, json=data)

Becuase you put headers and data into the same place as JSON data.

So that would of raised a 4xx code

headers = {
“Client-ID”: “BOT_CLIENT_ID”,
“Authorization”: "Bearer " + ACCESS_TOKEN,
“Content-Type”: “application/json”,
data = {
    'title': 'New Title'

requests.patch(“” + “CHANNEL_ID_NUMERIC”, headers=headers, json=data)

Should work (untested I don’t do python well)

still no unfortunately :confused: sorry I’m just used to python it’s the first programming language I’ve learned so it’s just cemented in my head.

This worked for me.
Got the expected 204 with user token generated with the needed scope

import requests

client_id = ''
access_token = ''
streamer_id = ''

headers = {
    'Client-ID': client_id,
    'Authorization': 'Bearer ' + access_token,
    'Content-Type': 'application/json'
data = {
    'title': 'testing a title change'

upd = requests.patch('' + streamer_id, headers=headers, json=data)



<Response [204]>

I figured out the issue, the PATCH request helped me figure out it was the wrong type of access token i am running a bot of my laptop not a server so i had a different type of access code ran and it solved it thanks so much for your help!

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