---
title: "Create the caller's organization"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create the caller's organization

Path: CloudRaker Workspace API › Onboarding

`POST /onboarding/organization`

Creates the organization for a signed-in user who has none, sets its external id to the derived tenant slug, adds the caller as an active `admin`, and provisions the tenant. Idempotent: a caller who already belongs to an organization gets it back with `created: false` rather than a second one. A caller who has been invited to an organization is refused instead, so they can accept that invitation rather than being given a second organization of their own. Give `slug` to choose the tenant slug. A taken slug answers 409 `slug_taken` and is never changed. Without `slug`, the slug comes from the name, with a short suffix when it is taken. A caller who already has an organization gets it back, and `slug` is ignored. Give `workspace: personal` with no `name` and no `slug` to create a personal workspace. Its name and slug come from the caller's profile: the first and last name, else the email address. A taken slug gets a short suffix. The session must be re-issued afterwards: token claims are set at authentication, so the current token still carries no tenant.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Request body

_Required._

- `name` (`createOnboardingOrganization.name`; string, optional) — The organization name. Required when `workspace` is `organization` or absent. Not allowed when `workspace` is `personal`.
  - minLength 1; maxLength 120; example `"Acme Corp"`
- `workspace` (`createOnboardingOrganization.workspace`; string, optional) — What to create. Absent means `organization`. `personal`: a workspace for the caller alone. The name comes from the caller's first and last name, else from the email address (for example `Jane Doe's workspace`). The slug comes from the same text, with a short suffix when it is taken. Send no `name` and no `slug`. `organization`: an organization with the given `name`. The slug is `slug` when given, else it comes from the name.
  - one of `"personal"`, `"organization"`; example `"personal"`
- `ignorePendingInvitation` (`createOnboardingOrganization.ignorePendingInvitation`; boolean, optional)
  - example `false`
- `slug` (`createOnboardingOrganization.slug`; string, optional)
  - maxLength 64; example `"acme"`
- `product` (`createOnboardingOrganization.product`; string, optional)
  - one of `"sign"`, `"paperwork"`, `"run"`; example `"run"`

## Example request

```json
{
  "name": "Acme Corp",
  "workspace": "personal",
  "ignorePendingInvitation": false,
  "slug": "acme",
  "product": "run"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.cloudraker.com/onboarding/organization \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Acme Corp",
  "workspace": "personal",
  "ignorePendingInvitation": false,
  "slug": "acme",
  "product": "run"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/onboarding/organization';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    name: 'Acme Corp',
    workspace: 'personal',
    ignorePendingInvitation: false,
    slug: 'acme',
    product: 'run'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/onboarding/organization"

payload = {
    "name": "Acme Corp",
    "workspace": "personal",
    "ignorePendingInvitation": False,
    "slug": "acme",
    "product": "run"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

The caller's organization and tenant slug.

#### Example

```json
{
  "organizationId": "org_01J…",
  "tenantSlug": "acme-corp",
  "created": true
}
```

- `organizationId` (`createOnboardingOrganization.response.200.organizationId`; string, required)
  - example `"org_01J…"`
- `tenantSlug` (`createOnboardingOrganization.response.200.tenantSlug`; string, required)
  - example `"acme-corp"`
- `created` (`createOnboardingOrganization.response.200.created`; boolean, required)

### 400

Validation Error

#### Example

```json
{
  "success": false,
  "error": [
    null
  ],
  "data": null
}
```

- `success` (`createOnboardingOrganization.response.400.success`; boolean, required)
  - one of `false`
- `error` (`createOnboardingOrganization.response.400.error`; array<unknown>, required)
- `data` (`createOnboardingOrganization.response.400.data`; unknown, required)

### 403

The caller is not a person. Organization API keys and embed tokens authenticate, but cannot hold a membership.

### 409

The caller has been invited to an organization and has not accepted yet. Accept the invitation, or resend with `ignorePendingInvitation` to create an organization anyway. `slug_taken` (body `{error, code}`): another organization uses the chosen `slug`. Choose a different one.

#### Example

```json
{
  "error": "pending_invitation",
  "organizationId": "org_01J…",
  "organizationName": "Acme Corp"
}
```

- `error` (`createOnboardingOrganization.response.409.error`; string, required)
- `organizationId` (`createOnboardingOrganization.response.409.organizationId`; string, required)
  - example `"org_01J…"`
- `organizationName` (`createOnboardingOrganization.response.409.organizationName`; string, required)
  - example `"Acme Corp"`

### 422

`disposable_email`: the caller signed up with a disposable mailbox. Sign up with a work or personal email address. `invalid_slug` (body `{error, code}`): the chosen `slug` must start with a letter, hold 2 to 40 lowercase letters, digits or hyphens, and contain no `--` and no trailing hyphen. Reserved names (for example `www`, `api`, `app`, `admin`, `run`, `sign`) are refused. A caller who already has an organization never gets this error.

### 429

`rate_limited`: too many organizations were requested from this network. Wait one minute, then try again.


Source: https://docs.cloudraker.com/workspace/api/onboarding/create-onboarding-organization/index.md
