# Create a workspace

> Create a workspace.

<div class="g1t-endpoint"><span class="g1t-method" data-method="post">POST</span><code>/workspaces</code></div>

A workspace owns repositories and is the first part of their address: g1t.sh/{workspace}/{repo}. The whoami tool lists the ones you already belong to.

`base_permission` is what every member gets on each of its repositories: `write` until an owner changes it with `PATCH /workspaces/{workspace}`. See [Access and roles](/guides/access-and-roles/).

- **Authentication:** Required. Send an [access token](/reference/api/#authentication) as `Authorization: Bearer`.
- **MCP tool:** [`workspace`](/reference/mcp/#workspace) with `action` `create`, and the same inputs
- **Scope:** An access token needs [`workspace:admin`](/guides/authentication/#scopes).

## Body parameters

Send a JSON object. Names are `snake_case`, as in responses; the `camelCase` spelling is accepted too.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `slug` | string | Yes | Its name in URLs: lowercase letters, digits and single hyphens. |
| `name` | string | No | A display name. |

## Example request

```sh
curl -X POST https://api.g1t.sh/workspaces \
  -H "Authorization: Bearer $G1T_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "acme-labs",
    "name": "Acme Labs"
  }'
```

## Example response

A successful request answers `200` with:

```json
{
  "id": "wsp_01m43teqa9em6bje0bhvdj4jkb",
  "slug": "acme-labs",
  "name": "Acme Labs",
  "description": null,
  "created_at": "2026-10-04T16:02:51.337Z",
  "member_count": 1,
  "base_permission": "write"
}
```

## Errors

A failed request answers with one of these statuses and a body like `{"error": {"code": "not_found", "message": "Repository not found."}}`. See [errors](/reference/api/#errors).

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | A token is required, or the one sent is not valid. |
| 403 | `forbidden` | The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository. |
| 404 | `not_found` | It does not exist, or you cannot see it. |
| 409 | `conflict` | The request conflicts with the current state. |
| 422 | `invalid` | The input is not valid. `message` says which field and why. |
