Object didn't pass validation for format organization-name

I am attempting to create an organization using the ManagementAPIv2 from my local machine. I have attempted it in both NodeJs and Curl for testing. Both of which provided the same outcome.

Every time I try to create an organization I am returned with the following error message (From NodeJS, but the same message on Curl);

statusCode: 400,
[start:dev]       error: 'Bad Request',
[start:dev]       message: "Payload validation error: 'Object didn't pass validation for format organization-name: ORG_NAME' on property name (The name of this organization).",
[start:dev]       errorCode: 'invalid_body'

The API does have the proper permissions associated with its token, and It returns other pieces of information just fine like an authentication token. I assume it has something to do with the formatting of my request but as per the docs everything is in line and I have used the bare minimum requirements for creation. My code is as follows (Removing sensitive tokens and addresses);

curl --request POST \
  --url https://XXXXXXX/api/v2/organizations \
  --header 'authorization: Bearer XXXXXX' \
  --header 'cache-control: no-cache' \
  --header 'content-type: application/json' \
  --data '{ "name": "testingName" }'

(Use Various names as well; Testing Name, testingname, testingName, abc, etc.)

If anyone can help point me in the right direction it would be greatly appreciated, thank you!

Hi @FrankDurdin ,

I get the same error when sending names with spaces or uppercase characters. This is a human readable name but different from the “friendly name” field (in GUI or API) but once I fixed the uppercase characters and spaces in my name, it worked. You mentioned that “testingname” was not working either, did you get the exact same error?

“Name” must only contain lowercase characters, ‘-’, and ‘_’, and start with a letter or number

Hi @FrankDurdin,

Welcome to the Auth0 Community!

When creating an Organization, the name property must only contain lowercase characters, ‘-’, and ‘_’, and start with a letter or number. In this case, setting “testingName” as the name is not allowed as it contains uppercase letters. See below.

I hope this helps!


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