---
title: "createRepo"
---

> 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.

# createRepo

Path: Forge API › repos

`POST /orgs/{org_id}/repos`

Create an empty repo in the org and answer it. Takes createRepos on the org. The body is {"name": name, "idempotency_key": key}, with an optional "description" of at most 280 characters: retrying with the same key resumes the same creation, and a new key creates another repo. The repo's slug, its address in the org, comes from its name: lowercase ASCII letters and digits in words joined by single hyphens, at most 64 characters, so "Acme Standards" gives acme-standards. A name another repo in the org holds, in any case and archived or not, is refused with RepoNameTaken; a name whose slug another repo holds, such as one that differs only in punctuation, with RepoSlugTaken; and a name with no ASCII letter or digit with RepoNameNeedsLetterOrDigit.

## Path parameters

- `org_id` (`createRepo.path.org_id`; string, required)
  - pattern: `^org_[0-7][0-9a-hjkmnp-tv-z]{25}$`

## Request body

_Required._

- `name` (`createRepo.name`; string, required)
  - minLength: `1`
- `idempotency_key` (`createRepo.idempotency_key`; string, required)
  - minLength: `1`
- `description` (`createRepo.description`; any of, optional)
  - any of the following: `RepoDescription`, `null`

## Example request

```json
{
  "name": "string",
  "description": "string",
  "idempotency_key": "string"
}
```

## Code samples

### cURL

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

### TypeScript

```typescript
const url = '<base-url>/orgs/<org_id>/repos';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({name: 'string', description: 'string', idempotency_key: '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/<org_id>/repos"

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

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

print(response.text)
```

## Responses

### 201

Repo

#### Example

```json
{
  "id": "string",
  "org_id": "string",
  "name": "string",
  "description": "string",
  "slug": "string",
  "creator_id": "string",
  "archived_at": "string",
  "archived_by_id": "string"
}
```

- `id` (`createRepo.response.201.id`; string, required)
  - pattern: `^repo_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `org_id` (`createRepo.response.201.org_id`; string, required)
  - pattern: `^org_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `name` (`createRepo.response.201.name`; string, required)
  - minLength: `1`
- `description` (`createRepo.response.201.description`; any of, required)
  - any of the following: `string`, `null`
- `slug` (`createRepo.response.201.slug`; string, required)
  - maxLength: `64` · pattern: `^[a-z0-9]+(?:-[a-z0-9]+)*$`
- `creator_id` (`createRepo.response.201.creator_id`; string, required)
  - pattern: `^(?:user|extension)_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `archived_at` (`createRepo.response.201.archived_at`; any of, required)
  - any of the following: `string`, `null`
- `archived_by_id` (`createRepo.response.201.archived_by_id`; any of, required)
  - any of the following: `ActorId`, `null`

### 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` (`createRepo.response.401._tag`; string, required)
  - one of `"InvalidCredentials"`

### 403

Forbidden | ForbiddenOrigin | RequiresPersonalSession | RunBranchRequired

#### Example

```json
{
  "_tag": "Forbidden",
  "message": "string"
}
```

Any of the following:

- `ForbiddenEncoded`
  - `_tag` (`ForbiddenEncoded._tag`; string, required)
    - one of `"Forbidden"`
  - `message` (`ForbiddenEncoded.message`; string, required)
- `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

OrgNotFound | RepoNotFound

#### Example

```json
{
  "_tag": "OrgNotFound"
}
```

Any of the following:

- `OrgNotFoundEncoded`
  - `_tag` (`OrgNotFoundEncoded._tag`; string, required)
    - one of `"OrgNotFound"`
- `RepoNotFoundEncoded`
  - `_tag` (`RepoNotFoundEncoded._tag`; string, required)
    - one of `"RepoNotFound"`

### 409

RepoCreationConflict | RepoNameTaken | RepoSlugTaken

#### Example

```json
{
  "_tag": "RepoCreationConflict"
}
```

Any of the following:

- `RepoCreationConflictEncoded`
  - `_tag` (`RepoCreationConflictEncoded._tag`; string, required)
    - one of `"RepoCreationConflict"`
- `RepoNameTakenEncoded`
  - `_tag` (`RepoNameTakenEncoded._tag`; string, required)
    - one of `"RepoNameTaken"`
- `RepoSlugTakenEncoded`
  - `_tag` (`RepoSlugTakenEncoded._tag`; string, required)
    - one of `"RepoSlugTaken"`
  - `slug` (`RepoSlugTakenEncoded.slug`; string, required)
    - minLength: `1`

### 413

RequestBodyTooLarge

#### Example

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

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

### 422

RepoNameNeedsLetterOrDigit

#### Example

```json
{
  "_tag": "RepoNameNeedsLetterOrDigit"
}
```

- `_tag` (`createRepo.response.422._tag`; string, required)
  - one of `"RepoNameNeedsLetterOrDigit"`

### 429

RateLimited

#### Example

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

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

### 500

OrgFailure | RepoFailure

#### Example

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

Every option has:

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

Any of the following, each adding:

- `OrgFailureEncoded`
  - `_tag` (`OrgFailureEncoded._tag`; string, required)
    - one of `"OrgFailure"`
- `RepoFailureEncoded`
  - `_tag` (`RepoFailureEncoded._tag`; string, required)
    - one of `"RepoFailure"`

### 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/create-repo/index.md
