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

# Create organization

Creates an Organization. The authenticated person becomes its `roles/owner`. Retry with the same Idempotency-Key to receive the same Organization.

`POST https://api.akua.dev/v1/organizations`

## Authorizations

- `Authorization: Bearer <token>` (BearerAuth): Bearer token for the authenticated caller.

## Headers

- `idempotency-key` (string): Optional caller-supplied idempotency key. Any non-empty key up to 64 characters is accepted. Endpoint-specific documentation describes how the key is used. Required string length: `1 - 64`. Example: `"create-prod-2026-05-07"`.

## Body

Required.

`application/json`: `OrganizationCreateRequest`

- `name` (string, required): Required string length: `1 - 50`. Pattern: `^(?=.*\S)[^\p{Cc}\p{Zl}\p{Zp}]+$`. Example: `"Code Zero"`.

## Response

### 201: Organization created

`application/json`: `Organization`

- `id` (string, required): Organization ID, `org_<id>`. Required string length: `3 - 54`.
- `name` (string | null, required): Null once the Organization is deleted: delete erases it at once. Required string length: `1 - 50`. Pattern: `^(?=.*\S)[^\p{Cc}\p{Zl}\p{Zp}]+$`. Example: `"Code Zero"`.
- `state` (enum<string>, required): `deleted`: soft-deleted until `purge_at`; afterwards the Organization is not found. Available options: `"active"`, `"deleted"`.
- `created_at` (integer, required): Unix timestamp (seconds). Required range: `0 <= x <= 9007199254740991`.
- `updated_at` (integer, required): Unix timestamp (seconds). Required range: `0 <= x <= 9007199254740991`.
- `deleted_at` (integer | null, required): Unix timestamp (seconds). Required range: `0 <= x <= 9007199254740991`.
- `purge_at` (integer | null, required): Unix timestamp (seconds). Required range: `0 <= x <= 9007199254740991`.
- `etag` (string, required): Pass as `If-Match` to delete only this version. OUTPUT_ONLY. Maximum string length: `64`.

### 400: The request is malformed.

`application/json`: `ApiBadRequest`

- `_tag` (enum<string>, required): Available options: `"Validation"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 401: Missing, invalid or expired credential.

`application/json`: `ApiUnauthorized`

- `_tag` (enum<string>, required): Available options: `"Unauthorized"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 403: The credential may not act in this workspace.

`application/json`: `ApiForbidden`

- `_tag` (enum<string>, required): Available options: `"Forbidden"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 409: The idempotency key was already used for a different request.

`application/json`: `ApiIdempotencyConflict`

- `_tag` (enum<string>, required): Available options: `"IdempotencyConflict"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 503: The service is temporarily unavailable.

`application/json`: `ApiServiceUnavailable`

- `_tag` (enum<string>, required): Available options: `"ServiceUnavailable"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

## Example request

```bash
curl --request POST \
  --url 'https://api.akua.dev/v1/organizations' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Code Zero"
  }'
```

## Example response

`201` `application/json`

```json
{
  "id": "org_j572abc123def456",
  "name": "Code Zero",
  "state": "active",
  "created_at": 123,
  "updated_at": 123,
  "deleted_at": 123,
  "purge_at": 123,
  "etag": "<string>"
}
```
