---
title: "Spaces & Projects in the SDK"
canonical: https://trickest.com/docs/developer-tools/sdk/spaces-projects
description: "client.spaces and client.projects; list, create, update, and delete workspaces and projects."
---

# Spaces & Projects in the SDK

Examples use a server-side `client` from
[Client setup](/docs/developer-tools/sdk/client-setup), and resource IDs supplied
by your application.

<Info>
  **Platform concepts:** [Workspaces &
  Projects](/docs/key-concepts/workspaces-and-projects). **CLI:** [Spaces &
  Projects](/docs/developer-tools/cli/spaces).
</Info>

## `client.spaces`

Maps to `/api/workspaces` (the product calls these **spaces** / workspaces).

| Method                       | Returns                    | Description                |
| ---------------------------- | -------------------------- | -------------------------- |
| `list(options?)`             | `AsyncGenerator<Space>`    | All spaces, auto-paginated |
| `listPage(options?)`         | `PaginatedResponse<Space>` | One page                   |
| `get(id, options?)`          | `Promise<Space>`           | Single space               |
| `create(data, options?)`     | `Promise<Space>`           | `{ name, description? }`   |
| `update(id, data, options?)` | `Promise<Space>`           | Partial update             |
| `delete(id, options?)`       | `Promise<void>`            | Delete space               |

```ts
for await (const space of client.spaces.list()) {
  console.log(space.name, space.id);
}

const space = await client.spaces.create({
  name: "Red Team",
  description: "Offensive workflows",
});

const full = await client.spaces.get(space.id);
await client.spaces.update(space.id, { description: "Updated" });
```

<Tip>
  `create` may return a partial record depending on the API; call `get(id)` if
  you need every field hydrated.
</Tip>

## `client.projects`

Projects live **inside a space**. Every method takes `spaceId` first.

| Method                                | Description              |
| ------------------------------------- | ------------------------ |
| `list(spaceId, options?)`             | Auto-paginated projects  |
| `get(spaceId, id, options?)`          | One project              |
| `create(spaceId, data, options?)`     | `{ name, description? }` |
| `update(spaceId, id, data, options?)` | Update metadata          |
| `delete(spaceId, id, options?)`       | Delete project           |

```ts
const projects = [];
for await (const p of client.projects.list(spaceId)) {
  projects.push(p);
}

const project = await client.projects.create(spaceId, {
  name: "Discovery",
  description: "Discovery pipelines",
});
```

## Recipe: resolve space then list workflows

```ts
let spaceId: string | undefined;
for await (const s of client.spaces.list()) {
  if (s.name !== "Solutions") continue;
  if (spaceId) throw new Error("More than one space has this name; use an ID");
  spaceId = s.id;
}
if (!spaceId) throw new Error("space not found");

for await (const wf of client.workflows.list(spaceId)) {
  console.log(wf.name);
}
```

## Related

<CardGroup cols={2}>
  <Card
    title="Workflows"
    icon="diagram-project"
    href="/docs/developer-tools/sdk/workflows"
  >
    `client.workflows` in a space.
  </Card>
  <Card
    title="Runs & schedules"
    icon="play"
    href="/docs/developer-tools/sdk/runs-schedules"
  >
    Execute workflows created here.
  </Card>
</CardGroup>

---
_Markdown source of https://trickest.com/docs/developer-tools/sdk/spaces-projects._
