Help Needed: Error Code 12040 - service_token_invalid_name When Creating Service Token

I’m currently experiencing an issue while trying to create a new service token through the Cloudflare API. Despite trying various names, I keep receiving the following error response:

{
“result”: null,
“success”: false,
“errors”: [
{
“code”: 12040,
“message”: “access.api.error.service_token_invalid_name”
}
],
“messages”:
}

This error occurs when I send a POST request to create a new service token with a body like:
{
“duration”: “60m”,
“name”: “example_name”
}

  • Authorization header bearing api token;

I have tried several different names for the service token, but none seem to work. I haven’t found much information about this specific error code (12040) in the Cloudflare documentation or other online resources. Has anyone else encountered this issue, and if so, how did you resolve it?