---
title: "createOrg"
---

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

# createOrg

Path: Forge API › orgs

`POST /orgs`

Create an org and answer it. The body is {"name": name, "slug": slug}. The org's slug is its address in Forge, such as in a URL, and a rename keeps it: lowercase ASCII letters and digits in words joined by single hyphens, at most 63 characters, since it is also the org's subdomain. Without "slug", it comes from the name, so "Acme Builders" gives acme-builders, and a name with no ASCII letter or digit is refused with OrgNameNeedsLetterOrDigit. A slug another org holds is refused with OrgSlugTaken, and one Forge keeps for its own addresses, such as api or www or any slug of one or two characters, with OrgSlugReserved.

## Request body

_Required._

- `name` (`createOrg.name`; string, required)
  - minLength: `1`
- `slug` (`createOrg.slug`; string, optional)
  - maxLength: `63` · pattern: `^[a-z0-9]+(?:-[a-z0-9]+)*$`

## Example request

```json
{
  "name": "string",
  "slug": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/orgs' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "string",
  "slug": "string"
}
'
```

### TypeScript

```typescript
const url = '<base-url>/orgs';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({name: 'string', slug: 'string'})
};

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

### Python

```python
import requests

url = "<base-url>/orgs"

payload = {
    "name": "string",
    "slug": "string"
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
```

## Responses

### 201

Org

#### Example

```json
{
  "id": "string",
  "name": "string",
  "slug": "string"
}
```

- `id` (`createOrg.response.201.id`; string, required)
  - pattern: `^org_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `name` (`createOrg.response.201.name`; string, required)
  - minLength: `1`
- `slug` (`createOrg.response.201.slug`; string, required)
  - maxLength: `64` · pattern: `^[a-z0-9]+(?:-[a-z0-9]+)*$`

### 400

InvalidRequest | RequestBodyTooDeep

#### Example

```json
{
  "_tag": "InvalidRequest",
  "part": "path",
  "issues": [
    {
      "path": [
        "string"
      ],
      "message": "string"
    }
  ]
}
```

Any of the following:

- `InvalidRequestEncoded`
  - `_tag` (`InvalidRequestEncoded._tag`; string, required)
    - one of `"InvalidRequest"`
  - `part` (`InvalidRequestEncoded.part`; string, required)
    - one of `"path"`, `"query"`, `"headers"`, `"body"`
  - `issues` (`InvalidRequestEncoded.issues`; array of object, required)
    - `path` (`InvalidRequestEncoded.issues.path`; array\<any of\>, required)
      - any of the following: `string`, `integer`
    - `message` (`InvalidRequestEncoded.issues.message`; string, required)
- `RequestBodyTooDeepEncoded`
  - `_tag` (`RequestBodyTooDeepEncoded._tag`; string, required)
    - one of `"RequestBodyTooDeep"`
  - `max_depth` (`RequestBodyTooDeepEncoded.max_depth`; integer, required)
    - maximum: `9007199254740991` · minimum: `-9007199254740991`

### 401

InvalidCredentials

#### Example

```json
{
  "_tag": "InvalidCredentials"
}
```

- `_tag` (`createOrg.response.401._tag`; string, required)
  - one of `"InvalidCredentials"`

### 403

ForbiddenOrigin | RequiresPersonalSession | RunBranchRequired

#### Example

```json
{
  "_tag": "ForbiddenOrigin"
}
```

Any of the following:

- `ForbiddenOriginEncoded`
  - `_tag` (`ForbiddenOriginEncoded._tag`; string, required)
    - one of `"ForbiddenOrigin"`
- `RequiresPersonalSessionEncoded`
  - `_tag` (`RequiresPersonalSessionEncoded._tag`; string, required)
    - one of `"RequiresPersonalSession"`
- `RunBranchRequiredEncoded`
  - `_tag` (`RunBranchRequiredEncoded._tag`; string, required)
    - one of `"RunBranchRequired"`
  - `branch` (`RunBranchRequiredEncoded.branch`; string, required)
    - minLength: `1`
  - `message` (`RunBranchRequiredEncoded.message`; string, required)

### 404

UserNotFound

#### Example

```json
{
  "_tag": "UserNotFound"
}
```

- `_tag` (`createOrg.response.404._tag`; string, required)
  - one of `"UserNotFound"`

### 409

OrgSlugTaken

#### Example

```json
{
  "_tag": "OrgSlugTaken",
  "slug": "string"
}
```

- `_tag` (`createOrg.response.409._tag`; string, required)
  - one of `"OrgSlugTaken"`
- `slug` (`createOrg.response.409.slug`; string, required)
  - minLength: `1`

### 413

RequestBodyTooLarge

#### Example

```json
{
  "_tag": "RequestBodyTooLarge",
  "max_bytes": -9007199254740991
}
```

- `_tag` (`createOrg.response.413._tag`; string, required)
  - one of `"RequestBodyTooLarge"`
- `max_bytes` (`createOrg.response.413.max_bytes`; integer, required)
  - maximum: `9007199254740991` · minimum: `-9007199254740991`

### 422

OrgSlugReserved | OrgNameNeedsLetterOrDigit

#### Example

```json
{
  "_tag": "OrgSlugReserved",
  "slug": "string",
  "message": "string"
}
```

Any of the following:

- `OrgSlugReservedEncoded`
  - `_tag` (`OrgSlugReservedEncoded._tag`; string, required)
    - one of `"OrgSlugReserved"`
  - `slug` (`OrgSlugReservedEncoded.slug`; string, required)
    - minLength: `1`
  - `message` (`OrgSlugReservedEncoded.message`; string, required)
- `OrgNameNeedsLetterOrDigitEncoded`
  - `_tag` (`OrgNameNeedsLetterOrDigitEncoded._tag`; string, required)
    - one of `"OrgNameNeedsLetterOrDigit"`

### 429

RateLimited

#### Example

```json
{
  "_tag": "RateLimited"
}
```

- `_tag` (`createOrg.response.429._tag`; string, required)
  - one of `"RateLimited"`

### 500

ControlPlaneFailure | OrgFailure

#### Example

```json
{
  "_tag": "ControlPlaneFailure",
  "reason": "string"
}
```

Every option has:

- `reason` (`<option>.reason`; string, required)

Any of the following, each adding:

- `ControlPlaneFailureEncoded`
  - `_tag` (`ControlPlaneFailureEncoded._tag`; string, required)
    - one of `"ControlPlaneFailure"`
- `OrgFailureEncoded`
  - `_tag` (`OrgFailureEncoded._tag`; string, required)
    - one of `"OrgFailure"`

### 503

SessionUnavailable | RateLimitUnavailable

#### Example

```json
{
  "_tag": "SessionUnavailable"
}
```

Any of the following:

- `SessionUnavailableEncoded`
  - `_tag` (`SessionUnavailableEncoded._tag`; string, required)
    - one of `"SessionUnavailable"`
- `RateLimitUnavailableEncoded`
  - `_tag` (`RateLimitUnavailableEncoded._tag`; string, required)
    - one of `"RateLimitUnavailable"`


Source: https://buildrforge.com/docs/api/orgs/create/index.md
