---
title: "Create a workspace"
method: POST
path: "/api/workspaces"
tags: ["Workspaces"]
---

# Create a workspace

`POST /api/workspaces`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/workspaces`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

## Request body

- object
  - `name` string, required

## Response `201`

Created workspace.

- Workspace
  - `id` integer
  - `slug` string
  - `name` string
  - `tenantId` integer, nullable
  - `createdAt` string, date-time
  - `archivedAt` string, date-time, nullable
  - `archived` boolean
  - `contextCount` integer

## Other responses

- `400`: Request body/query failed Zod validation.
- `401`: Missing or invalid credentials.
- `409`: Duplicate slug.

---

[API](https://skmtc.dev/contextq/apis/contextq-api.md) · [All operations](https://skmtc.dev/contextq/apis/contextq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/contextq/apis/contextq-api/revisions/7afc44056a22?raw)
