# Create a workspace

`POST /api/v1/workspaces`

Creates a workspace owned by the signed-in person. The account's email must be confirmed.

Sign-in: a dashboard session only. API tokens and OAuth sign-ins get `403 token.not_allowed`.

Section: Workspaces. Operation id in openapi.json: `create_workspace`.

## Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `Idempotency-Key` | header | no | string | Any 1–255 characters, for example a UUID per intended action. A retry with the same key and the same request answers the stored response and creates nothing again; the same key with another request answers `422 request.idempotency_key_reused`. Keys are kept for 24 hours. |

## Request body

Required: yes.

`application/json`: WorkspaceInput

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes |  |
| `timezone` | string | yes |  |

## Responses

Errors are `application/problem+json` (`Problem`); branch on `type`.

### 201

The workspace.

`application/json`: WorkspaceView

| Field | Type | Required | Description |
|---|---|---|---|
| `blocked` | boolean | yes | Blocked by the installation's administrator: read only, checks do not run, no alerts; public status pages keep serving. |
| `id` | string (uuid) | yes |  |
| `name` | string | yes |  |
| `role` | WorkspaceRole | yes |  |
| `timezone` | string | yes | IANA zone: uptime days and the default zone of maintenance windows. |

### 400

Bad Request.

- `request.malformed`: the body or a parameter is not of the expected shape
- `request.idempotency_key_invalid`: the key is empty or longer than 255 characters
- `auth.credentials_conflict`: the request carries both a session cookie and a token

### 401

Unauthorized.

- `auth.unauthenticated`, `auth.session_expired`: no session, or it ended
- `token.invalid`: the token is malformed, unknown, revoked or expired, or its creator left the workspace

### 403

Forbidden.

- `auth.forbidden`: your role is too low for this
- `token.not_allowed`: this operation needs a signed-in session; tokens cannot call it
- `request.origin_mismatch`, `request.header_required`: a changing request with a session comes from another site or lacks `X-Monitorly-Request: 1`
- `auth.email_unverified`: account email is not confirmed via the link in the email: the account cannot change anything in a workspace or create a workspace

### 409

Conflict.

- `account.free_workspaces_reached`: the account already owns a workspace on the Free plan (one per account); upgrade or delete that one first

### 413

Payload Too Large.

- `request.too_large`: the body is larger than 256 KiB

### 422

Unprocessable Entity.

- `field.required`, `field.too_long`, `field.invalid`: a field breaks a rule; `errors` points at it

### 429

Too Many Requests.

- `session.rate_limited`: more than 5 changes a second from your sessions
- `workspace.create_limited`: the account created 30 workspaces in the last hour; wait `Retry-After` seconds

Schemas named above are listed with their fields in [the schema list](https://docs.monitorly.cloud/api/reference/schemas.md).
