Unable to update apex DNS record via API

Hello

I’m following the documentation here Cloudflare API Documentation

I’m able to update any record with the curl command that is shown, for example:

curl --request PUT
–url https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records/{dns_record_id}
–header ‘Content-Type: application/json’
-H “Authorization: Bearer MYTOKEN”
–data-raw ‘{
“content”: “a.b.c.d”",
“name”: “subodmain.example.com”,
“proxied”: true,
“type”: “A”,
“ttl”: 1200
}’

This works fine for any record except the apex record. When I try the apex record, it fails with
“code”:9207,“message”:“Request body is invalid.”

I have tried using the PATCH method, with the same results. I also have updated it via the GUI, and I see that the name field is using “example.com” instead of “@” as mentioned in the docs.

Does anyone know if I’m doing something wrong or if this is a bug?

Hi there,

The issue you’re experiencing with updating the apex record using the PUT method might be related to the format of the name field.

Could I ask you to try using the name field with the @ symbol to specify the apex record, like this:

 "name": "@"

Kindly inform us of the results generated by this.

Hi Yassine2

I have already tried it, but it fails:
I also have updated it via the GUI, and I see that the name field is using “example.com” instead of “@” as mentioned in the docs.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.