---
title: "createWorkspace"
---

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

# createWorkspace

Path: agenthold API › workspaces

`POST /workspaces`

URL: `/api/v1/workspaces`

## Authentication

Requires one of the following:

- `session`, apiKey, in cookie
- `token`, http bearer, header `Authorization`

## Request body

_Required._

- `name` (`createWorkspace.name`; string, required)
  - maxLength: `100` · minLength: `1`

## Example request

```json
{
  "name": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/api/v1/workspaces' \
  --header 'Content-Type: application/json' \
  --cookie 'agenthold_session=<agenthold_session>' \
  --data '
{
  "name": "string"
}
'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/workspaces';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    cookie: 'agenthold_session=<agenthold_session>'
  },
  body: JSON.stringify({name: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/api/v1/workspaces"

payload = { "name": "string" }
headers = {
    "cookie": "agenthold_session=<agenthold_session>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

Created. The caller becomes its owner.

#### Example

```json
{
  "id": "string",
  "name": "string",
  "personal": true,
  "role": "owner",
  "createdAt": "2019-08-24T14:15:22Z"
}
```

- `id` (`createWorkspace.response.201.id`; string, required)
- `name` (`createWorkspace.response.201.name`; string, required)
- `personal` (`createWorkspace.response.201.personal`; boolean, required)
- `role` (`createWorkspace.response.201.role`; string, required)
  - one of `"owner"`, `"admin"`, `"member"`
- `createdAt` (`createWorkspace.response.201.createdAt`; string, required)
  - format: `date-time`

### 400

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`createWorkspace.response.400.error`; string, required)


Source: https://agenthold.dev/api/workspaces/create/index.md
