Python requests returning 401 on Genesys Cloud token endpoint

I’ve been trying to get an OAuth2 client credentials token using Python requests but the API keeps returning a 401. The docs say to use POST /login/oauth2/v1/token with the grant_type and client_id in the body but I’m not sure if I’m handling the authentication correctly. Here is the code I’m using

import requests

url = 'https://api.mypurecloud.com/login/oauth2/v1/token'
payload = {
 'grant_type': 'client_credentials',
 'client_id': 'my-app-id',
 'client_secret': 'my-secret'
}
response = requests.post(url, data=payload)
print(response.status_code)
print(response.text)

The response is just {"error":"invalid_client"}. I know the credentials are correct because they work in Postman. Is there a specific header I need to add?