Question

Issue with Creating Domain API?

I was trying to make an A record in my DNS records when it returned a 403 error (checked in Network Viewer) I tried manually posting it with cURL, but it said “You are not allowed to perform this operation”. It is a brand new API key and it is also the correct domain in the API URL listed in cURL. Here’s the command I ran directly from API docs just edited for my domain:

curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"type":"A","name":"cdn","data":"very.cool.ip.here","priority":null,"port":null,"ttl":1800,"weight":null,"flags":null,"tag":null}' \
  "https://api.digitalocean.com/v2/domains/totallycool.domain/records"

Edit: removed my domain and IP from the command so I don’t doxx myself :)


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Update (7/3/23): Still not working… I unfortunately deleted one of the currently existing A records and now unable to add it back… most of my programs are broken now :/

KFSys
Site Moderator
Site Moderator badge
July 3, 2023

Hey @kxtzownsu,

I’ve experienced such errors in the distant past where generating a new key helped me resolve the issue.

Additionally, try using to see if that would help

`doctl auth init -t "API_TOKEN"

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel