Create a new organization.
const url = 'https://api.adversarial.com/api/v1/organizations';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"display_name":"example","slug":"acme"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.adversarial.com/api/v1/organizations \ --header 'Content-Type: application/json' \ --data '{ "display_name": "example", "slug": "acme" }'Any signed-in person may create an organization at any time — an orgless
onboarding session creating its first org, or an existing member spinning up
another — including an app acting on their behalf with a delegated token. The
caller becomes the new org’s ADMIN. Service-account and integration
credentials cannot create organizations and get 403. The response carries
the new org’s slug; a browser session also starts resuming there, so a later
request that names no organization resolves to it. A bearer token’s requests
are unaffected — they stay scoped to the organization its token names.
Request Bodyrequired
Section titled “Request Bodyrequired”Request body for POST /v1/organizations — general-purpose organization
creation. The caller supplies a display name and a URL slug.
object
User-chosen URL slug. Uniqueness is enforced by the DB and surfaced as a 422 on collision.
Example
acmeResponses
Section titled “Responses”The newly created organization
object
URL-safe human-readable identifier.
Examplegenerated
{ "description": "example", "display_name": "example", "icon": "example", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "slug": "example", "verified": true}Display_name is not 2-60 characters
The caller is a service account or integration, which cannot create organizations
Slug is invalid or already taken