Content must be json

import requests


headers = {

    "Authorization": "Bearer MyToken",

    "Content-type" : "application/json"


data = {

    "type": "A",

    "name": "",

    "content": "",

    "ttl": "1",

    "proxied": "true"


r = requests.put(CLOUDFLARE_ENDPOINT_URL, headers=headers, data=data)


What am I doing wrong?
I’m getting this error: {"result":null,"success":false,"errors":[{"code":9207,"message":"Content-type must be application/json."}],"messages":[]}
its literally json

Could you try json=data instead of data=data? Then requests should serialize the dictionary for you :slightly_smiling_face:

Also, I believe the "ttl" and "proxied" attributes should be an integer and boolean respectively, not a string.