Set Invoice to Auto Bill API

I am trying to retroactively update an invoice to auto bill but the update invoice request below is not working

url = ‘https://invoicing.co/api/v1/invoices/vbmO3NjOeY
headers = {}
headers[‘accept’] = ‘application/json’
headers[‘x-api-token’] = ‘xxxxxxxxxx’
headers[‘x-requested-with’] = ‘XMLHttpRequest’
data = {}
data[‘auto_bill_enabled’] = True
data = json.dumps(data)

r = requests.put(url,data=data,headers=headers)
results = r.json()

Hi,

I suggest first getting it working as a cURL request and then converting it to code.

If you want to send a sample cURL request I can test it for you.

Can I actually propose the opposite and have you send me the curl request?

curl -X PUT "https://invoicing.co/api/v1/invoices/<invoice_id>" \
-d '{"auto_bill_enabled": true}' \
-H "Content-Type: application/json" \
-H "X-Requested-With: XMLHttpRequest" \
-H "X-API-TOKEN:<token>"

Got it working, thank you!