Create an organization
POST
/organizations
const url = 'https://api.perstat.io/organizations';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example"}'};
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.perstat.io/organizations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example" }'Creates a new organization owned by the caller; the URL slug is derived from the name. Returns 409 when the per-user organization limit is reached or the slug is already taken. API keys require the explicit org:create scope and an organization-wide key whose creator is currently an owner. The new organization is owned by that creator; the key remains bound to its original organization and cannot access resources in the new organization. Accepts API keys with the org:create scope, subject to current role and resource grants.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
name
required
string
Examplegenerated
{ "name": "example"}Responses
Section titled “Responses”Resource created. The response body contains the created resource.
Media typeapplication/json
object
id
required
string
name
required
string
slug
required
string
Examplegenerated
{ "id": "example", "name": "example", "slug": "example"}The request is invalid. Check the supplied fields and values.
Authentication is missing or invalid.
The request conflicts with the current resource state.