API Problem

Hello i have a problem with the cloudflare api v4. I used the right api token but i got an Authentication error. $response = Http::withHeaders([ 'Content-Type' => 'application/json', 'Authorization' => 'Bearer xxx', ]) ->post('https://api.cloudflare.com/client/v4/zones/xxx/dns_records', [ 'content' => '1.1.1.1', 'name' => 'test.test.de', 'proxied' => false, 'type' => 'A', 'comment' => 'Record test', 'tags' => ['owner:dns-team'], 'ttl' => 3600, ]); The curl testing is working at my computer. But I cant use the http api.
9 Replies
Cyb3r-Jak3
Cyb3r-Jak310mo ago
What are the permissions of the API token?
RedImSky
RedImSkyOP10mo ago
Sorry it's in german. I used the "edit zone-dns" template.
No description
RedImSky
RedImSkyOP10mo ago
No description
Cyb3r-Jak3
Cyb3r-Jak310mo ago
That all looks right. Does the update work if it’s in curl?
RedImSky
RedImSkyOP10mo ago
I got the same error.
No description
Cyb3r-Jak3
Cyb3r-Jak310mo ago
For the content of the record all the same stuff in your own zone? Wondered if it’s blocking on that. Can you make the same record in the dashboard to verify it’s correct then delete after.
RedImSky
RedImSkyOP10mo ago
I'm able to create the record in the panel. Do you have an solution for this problem or should I write the cloudflare support?
Cyb3r-Jak3
Cyb3r-Jak310mo ago
I’d contact support at this stage
RedImSky
RedImSkyOP10mo ago
I fixed this. I had the wrong zone ID.
Want results from more Discord servers?
Add your server