# Create an organization

Source: [Create an organization](<https://docs.gptunnel.ru/en/business/org-create/>)

<a id="_top"></a>
> **Note: Organization API key**
>
> Use an API key from a business organization with permission to create organizations. See the [Business API overview](<https://docs.gptunnel.ru/en/business/>).

<a id="establishment-of-the-organization"></a>
## Establishment of the organization

`POST https://gptunnel.ru/api/v1/orgs/create`

Creates a business organization and assigns an existing user as its owner. The organization appears in the owner’s dashboard immediately. Use the returned `org_id` to [transfer funds](<https://docs.gptunnel.ru/en/business/transfer/>) to its account.

The partner handles billing for the new organization. Monthly invoices are not issued automatically.

### Request headers

| Parameter | Type | Description |
| --- | --- | --- |
| `Authorization` (required) | `string` | Organization API key |
| `Idempotency-Key` (required) | `string` | Unique operation key, 8–64 characters from A-Za-z0-9\_- |
| `Content-Type` (required) | `string` | application/json |

### Request parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `name` (required) | `string` | Name of organization, 1 - 255 characters |
| `owner` (required) | `object` | Provide exactly one field: user\_id (24 lowercase hexadecimal characters) for a registered owner, or phone (+79XXXXXXXXX) if lookup by phone is enabled. |
| `inn` | `string` | Russian taxpayer identification number (INN), 10 or 12 digits |
| `ogrn` | `string` | Russian registration number (OGRN or OGRNIP), 13 or 15 digits |

An unknown field in the request body or in `owner` returns HTTP `400`, code `3`.

> **Caution: Owner lookup by phone requires separate access**
>
> Only partners with phone lookup enabled can send `owner.phone`. Other partners receive HTTP `403`, code `33`.

<a id="example-request"></a>
### Example request

Set `GPTUNNEL_API_KEY` and replace the placeholders with values for your organization.

<a id="tab-panel-0-0"></a>
**Python**

```python
import json
import os
from urllib.request import Request, urlopen

key = os.environ.get("GPTUNNEL_API_KEY")
if not key:
    raise SystemExit("Set GPTUNNEL_API_KEY")

body = {
  "name": "ООО Ромашка",
  "owner": {
    "user_id": "6ad72133269dc8d9f75a33bc"
  },
  "inn": "7707083893",
  "ogrn": "1027700132195"
}
request = Request(
    "https://gptunnel.ru/api/v1/orgs/create",
    method="POST",
    headers={
        "Authorization": key,
        "Content-Type": "application/json",
        "Idempotency-Key": "client-4821-org",
    },
    data=json.dumps(body).encode("utf-8"),
)
with urlopen(request, timeout=30) as response:
    print(json.load(response))
```

<a id="tab-panel-0-1"></a>
**cURL**

```bash
curl --request POST \
  --url 'https://gptunnel.ru/api/v1/orgs/create' \
  --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: client-4821-org' \
  --data '{
  "name": "ООО Ромашка",
  "owner": {
    "user_id": "6ad72133269dc8d9f75a33bc"
  },
  "inn": "7707083893",
  "ogrn": "1027700132195"
}'
```

<a id="tab-panel-0-2"></a>
**JavaScript (Node.js)**

```javascript
const key = process.env.GPTUNNEL_API_KEY
if (!key) throw new Error("Set GPTUNNEL_API_KEY")

const body = {
  "name": "ООО Ромашка",
  "owner": {
    "user_id": "6ad72133269dc8d9f75a33bc"
  },
  "inn": "7707083893",
  "ogrn": "1027700132195"
}
const response = await fetch("https://gptunnel.ru/api/v1/orgs/create", {
  method: "POST",
  headers: {
    Authorization: key,
    "Content-Type": "application/json",
    "Idempotency-Key": "client-4821-org",
  },
  body: JSON.stringify(body),
})
if (!response.ok) throw new Error(await response.text())
console.log(await response.json())
```

<a id="response"></a>
### Response

### Response fields

| Parameter | Type | Description |
| --- | --- | --- |
| `code` | `number` | 0 on success |
| `org_id` | `string` | ID of the new organization. Use it for transfers. |
| `account` | `string` | Account number: ЛСО-\<number\> if inn or ogrn was supplied, otherwise B-RU-\<number\>. |
| `owner_user_id` | `string` | ID owner |
| `owner_created` | `boolean` | Always false when designating an existing user |
| `inn` | `string \| null` | The organization’s INN, or null if omitted |
| `ogrn` | `string \| null` | The organization’s OGRN or OGRNIP, or null if omitted |
| `created_at` | `string` | Time of Organization Establishment, ISO 8601 |
| `replayed` | `boolean` | true if the same Idempotency-Key was used to create this organization earlier |

<a id="tab-panel-1-0"></a>
**200 OK**

```json
{
  "code": 0,
  "org_id": "67f3b9d1a0c4e2f345678901",
  "account": "ЛСО-16966",
  "owner_user_id": "6ad72133269dc8d9f75a33bc",
  "owner_created": false,
  "inn": "7707083893",
  "ogrn": "1027700132195",
  "created_at": "2026-10-20T09:15:42.000Z",
  "replayed": false
}
```

<a id="tab-panel-1-1"></a>
**409 OGRN already registered**

```json
{
  "code": 41,
  "message": "An organization with this OGRN is already registered."
}
```

Repeating a request with the same `Idempotency-Key`, name, owner, INN and OGRN returns the existing organization with `replayed: true`. Reusing the key with different data returns HTTP `409`, code `20`.

<a id="errors"></a>
### Errors

| HTTP | code | When |
| --- | --- | --- |
| 400 | 3 | Invalid request body, unknown field, or an employee service account specified as the owner. For schema errors, see `details`. |
| 400 | 21 | The `Idempotency-Key` header is missing or has an invalid format. |
| 403 | 13 | The key belongs to a personal account. |
| 403 | 32 | Organization creation is not enabled for your organization. |
| 403 | 33 | Your organization cannot specify the owner by phone number. |
| 404 | 17 | The user identified by `owner.user_id` does not exist or has been deleted. |
| 409 | 20 | The `Idempotency-Key` has already been used with different request data. |
| 409 | 41 | An organization with this OGRN is already registered. |
| 409 | 42 | An organization with this INN is already registered. |
