Api Under Attack Mode

Hello. I have a free plan. I created api token. and I want to configure the inclusion and deactivation of the “under attack” mode through the api. api check request works, example:

curl -X GET “https…/client/v4/user/tokens/verify”
-H “Authorization: Bearer W7CrjBaJJLdktYTwgtKb3DhUUt1H874a”

and this query gives an error

curl -X PATCH “https…/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/settings/security_level”
-H “X-Auth-Email: [email protected]
-H “X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41”
-H “Content-Type: application/json”
–data ‘{“value”:“under_attack”}’

here’s an error:

{
“success”: false
“errors”: [{
“code”: 6003,
“message”: “Invalid request headers”,
“error_chain”: [{
“code”: 6103,
“message”: “Invalid format for X-Auth-Key header”
}]
}],
“messages”: ,
“result”: null
}

id zone and mail and api token invented here, everything was filled out correctly for me

api key created “Custom Token”

 Zone.ZoneSettings.Read
 Zone.ZoneSettings.Edit

Are you trying to use tokens or keys? They are two different mechanisms for authenticating to the API.

1 Like

I used the token that I created in my profile in the API section
same as here -H “Authorization: Bearer and same here -H “X-Auth-Key:

and where then you need to get the X-Auth-Key ?

I understand my mistake!!! thank you good man!!! it was necessary to choose not a token but a Global API Key !!!

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