Can not create zone using API

Hi everyone. I am trying to create a zone using the Cloudflare api. I am using this command

curl -X POST "https://api.cloudflare.com/client/v4/zones" \
-H "Authorization: Bearer ****************************************" \
-H "Content-Type: application/json" \
--data '{"name":"DOMAIN.ORG","account":{"id": "USER_ID"},"jump_start":true}'

and I have tried

curl -X POST "https://api.cloudflare.com/client/v4/zones" \
-H "X-Auth-Email: [email protected]" \
-H "X-Auth-Key: GLOBAL_API_KEY" \
-H "Content-Type: application/json" \
--data '{"name":"DOMAIN.ORG","account":{"id": "USER_ID"},"jump_start":true}'

But I am getting this error response

{"success":false,"errors":[{"code":1068,"message":"Permission denied"}],"messages":[],"result":null}

I have given my API token these permissions:

All accounts - Billing:Edit, Account Settings:Edit
All zones - Zone Settings:Edit, Zone:Edit
All users - User Details:Edit

I am unsure why this isn’t working. Why do I keep getting permission denied error?

What is the domain that you are trying to create?

What happens if you change jump_start to false?
From previous posts it looks like the API was changing and I’m not sure if it has yet.

Create a Zone - Jump Start - #4 by simon

Figured it out! :smiley:
turns out “account id” doesn’t mean user id. I didn’t know accounts were separate from users.

For people reading in the future
step 1: use command below to get details about your accounts

curl -X GET "https://api.cloudflare.com/client/v4/accounts" \
-H "X-Auth-Email: EMAIL" \
-H "X-Auth-Key: KEY" \
-H "Content-Type: application/json" \

step 2: use the account id in your request ^_^;

thank you @Cyb3r-Jak3 for the help! your words triggered the right neurons and helped me figure it out :hugs:

btw I was able to create the zone without changing jump_start to false

2 Likes