# Spaces

List, read and create Spaces, the folders for each client or project.

Web version: https://www.svanja.com/docs/api/spaces/

A Space holds the notes and files for a single client or project, and the assistant reads it when you work on that client. You can view them in [Spaces](https://app.svanja.com/spaces). Use these endpoints to list your Spaces with their IDs, or to create a new Space when you add a client in another tool.

To read Spaces, your API key needs the Spaces area, which is included in Full access and Read-only. Creating a Space requires Full access or Spaces set to **Read and write**. If a key is limited to specific Spaces, it can only see those and can't create new ones. For more background, see [Spaces, notes and files](https://www.svanja.com/docs/spaces/).

`GET /spaces` returns all the Spaces your key can access, and `GET /spaces/{space}` returns a single one.

`POST /spaces` creates a new Space. Set `kind` to `project` or `client`, and set `language` to the Space's language, such as `en-US` or `de-DE`. Because a client Space belongs to a company, it also needs either `mail_account_public_id` (the ID of an existing company from [CRM](https://www.svanja.com/docs/api/crm/)) or `new_company_name` to create a new one:

```json
{
  "name": "Example Ltd",
  "kind": "client",
  "language": "en-US",
  "new_company_name": "Example Ltd"
}
```

If you need to update a Space later, such as renaming or archiving it, use the older Projects endpoints under `/projects`. They modify the same Spaces under their previous name. To work with the notes and files inside a Space, see [Files and notes](https://www.svanja.com/docs/api/files/). You can also manage Spaces from your terminal with [svanja space](https://www.svanja.com/docs/cli/spaces/).

## Operations

| Operation | What it does | Effect | Endpoints |
| --- | --- | --- | --- |
| `project.create` | Create a project. | Changes data in Svanja | `POST /projects` |
| `project.delete` | Delete a project. | Changes data in Svanja | `DELETE /projects/{project}` |
| `project.read` | List and inspect legacy projects. | Reads only | `GET /projects`<br>`GET /projects/{project}` |
| `project.update` | Update a project. | Changes data in Svanja | `PATCH /projects/{project}` |
| `space.create` | Create a Space. | Changes data in Svanja | `POST /spaces` |
| `space.read` | Read Spaces. | Reads only | `GET /spaces`<br>`GET /spaces/{space}` |

## Endpoints

### GET /api/v1/spaces

List Spaces

Lists Spaces visible to the key visibility user.

### POST /api/v1/spaces

Create a Space

Creates a project or client Space and starts repository preparation.

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Optional key for unsafe bearer writes. Reusing the same key and same canonical body replays the original response for 24 hours; reusing it with a different body returns idempotency_conflict. |

| Body field | Type | Required | Notes |
| --- | --- | --- | --- |
| `kind` | one of client, project | no |  |
| `name` | string | yes |  |
| `description` | string or null | no |  |
| `language` | string | no |  |
| `mail_account_public_id` | string or null | no |  |

### GET /api/v1/spaces/{space}

Show a Space

Shows one Space visible to the key visibility user.

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `space` | path | string | yes | Space public ULID or slug. |

### GET /api/v1/projects

List projects

Lists projects visible to the authenticated key. Selected-project keys receive only their selected projects for project-backed reads.

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `page` | query | integer | no | Page number. Defaults to 1. |
| `per_page` | query | integer | no | Page size. Defaults to 25 and is capped at 100. |
| `status` | query | one of active, paused, archived | no | Filter projects by status. |
| `q` | query | string | no | Search project name and description. |
| `sort` | query | one of created_at, -created_at, updated_at, -updated_at, name, -name, status, -status | no | Sort projects. A leading dash means descending. |

### POST /api/v1/projects

Create a project

Creates a project from JSON body fields only. Project-backed creation requires a Projects write-capable key with all-projects scope.

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Optional key for unsafe bearer writes. Reusing the same key and same canonical body replays the original response for 24 hours; reusing it with a different body returns idempotency_conflict. |

| Body field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `description` | string or null | no |  |
| `url` | string or null | no |  |
| `status` | one of active, paused, archived | no |  |
| `timezone` | one of UTC, America/New_York, America/Los_Angeles, Europe/London, Europe/Berlin, Asia/Tokyo | no |  |
| `language` | one of en-US, en-GB, en-AU, en-CA, de-DE, de-AT, de-CH, es-ES, es-MX, es-AR, fr-FR, fr-CA, fr-BE, fr-CH | no |  |
| `limit` | integer | no |  |
| `automate` | boolean | no |  |

### GET /api/v1/projects/{project}

Show a project

Shows one project by public ID. Missing, malformed, cross-team, soft-deleted, and selected-project scope misses return the same public not-found error.

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `project` | path | string | yes | Project public ULID. This is not the legacy numeric project id. |

### PATCH /api/v1/projects/{project}

Update a project

Partially updates a project from JSON body fields only. Selected-project keys may update selected projects when they have Projects write access.

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `project` | path | string | yes | Project public ULID. This is not the legacy numeric project id. |
| `Idempotency-Key` | header | string | no | Optional key for unsafe bearer writes. Reusing the same key and same canonical body replays the original response for 24 hours; reusing it with a different body returns idempotency_conflict. |

| Body field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string | no |  |
| `description` | string or null | no |  |
| `url` | string or null | no |  |
| `status` | one of active, paused, archived | no |  |
| `timezone` | one of UTC, America/New_York, America/Los_Angeles, Europe/London, Europe/Berlin, Asia/Tokyo | no |  |
| `language` | one of en-US, en-GB, en-AU, en-CA, de-DE, de-AT, de-CH, es-ES, es-MX, es-AR, fr-FR, fr-CA, fr-BE, fr-CH | no |  |
| `limit` | integer | no |  |
| `automate` | boolean | no |  |

### DELETE /api/v1/projects/{project}

Delete a project

Soft-deletes a project and returns a public acknowledgement. Selected- project keys may delete selected projects when they have Projects write access.

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `project` | path | string | yes | Project public ULID. This is not the legacy numeric project id. |
| `Idempotency-Key` | header | string | no | Optional key for unsafe bearer writes. Reusing the same key and same canonical body replays the original response for 24 hours; reusing it with a different body returns idempotency_conflict. |
