# client.projects

> client.projects — the projects operations.

`client.projects` — the `projects` operations.

On `AsyncKindgi` every method is the same, awaited.

## `client.projects.get_default()`

```python signature
get_default(*, timeout: float | None = None) -> Project
```

Fetch the workspace's default project. `GET /v1/projects/default`

Returns the row where `Project.isDefault = true` (at most one per workspace), to a caller who can read it, as `GET /v1/projects/{projectId}` checks. Returns 404 `project-not-found` when the workspace has none. An API key or session limited to a project gets the default project only when it's that project; otherwise, and when the workspace has none, it gets 403 `key-project-mismatch`, naming `default`.

## `client.projects.list_deleted()`

```python signature
list_deleted(
    *,
    limit: int | None = None,
    cursor: str | None = None,
    timeout: float | None = None,
) -> DeletedProjectCollectionPage
```

List the workspace's deleted projects. `GET /v1/projects/deleted`

Cursor-paginated, the most recently deleted first, each with `deletedAt`. A deleted project is restored with `POST /v1/projects/{projectId}/restore`. Needs `admin` on the workspace.

## `client.projects.list()`

```python signature
list(
    *,
    limit: int | None = None,
    cursor: str | None = None,
    org_id: str | UUID | None = None,
    name_contains: str | None = None,
    timeout: float | None = None,
) -> ProjectCollectionPage
```

List projects in the caller's workspace. `GET /v1/projects`

Cursor-paginated, without the deleted projects (`GET /v1/projects/deleted` lists those). Optional `?orgId=` narrows to a specific org (projects may have no org; absent = all); `?nameContains=` substring-matches on `Project.name`.

## `client.projects.create()`

```python signature
create(
    body: ProjectSpec | Mapping[str, Any] | None = None,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
    **fields: Any,
) -> CreateResourceResult
```

Create a project. `POST /v1/projects`

A project's slug is unique within its org, and a project without an org's among the workspace's projects without one: two orgs may each have a project with the same slug. A taken slug answers `409 slug-conflict`, and so does a slug another project of the workspace had before it was renamed, in any org (`details.heldAs: 'old-slug'`). A deleted project's slugs stay its own, so they answer it too, with `details.deletedProject: true`. A second default project answers `409 project-default-already-exists`.

## `client.projects.get()`

```python signature
get(project_id: str | UUID, /, *, timeout: float | None = None) -> Project
```

Fetch a project by id. `GET /v1/projects/{projectId}`

## `client.projects.update()`

```python signature
update(
    project_id: str | UUID,
    body: ProjectPatch | Mapping[str, Any] | None = None,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
    **fields: Any,
) -> None
```

Partially update a project. `PATCH /v1/projects/{projectId}`

A new `slug`, or a move to another org (`orgId`, or `null` for none), answers `409 slug-conflict` when the slug is taken where the project ends up. A new `slug` also answers it when another project of the workspace had that slug before it was renamed, in any org (`details.heldAs: 'old-slug'`). Either has `details.deletedProject: true` when the project holding the slug is deleted: its slugs stay its own. The slug a rename leaves stays this project's, in `formerSlugs`: no other project can take it, and this one can take it back, unless another project also had it before a rename.

## `client.projects.delete()`

```python signature
delete(
    project_id: str | UUID,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
) -> None
```

Delete a project (idempotent). `DELETE /v1/projects/{projectId}`

The project is kept, not erased: from then on it's gone from its get, the list and its memberships, nobody can reach what's in it, its unfinished runs are cancelled, and its triggers skip their fires and deliveries. Its slugs stay its own, and so do its keys and its own service account (`runAsProject`), which reach nothing while it's deleted. A workspace admin finds it at `GET /v1/projects/deleted` and brings it back as it was with `POST /v1/projects/{projectId}/restore`. Idempotent: an unknown or already-deleted project answers 204, and deleting it again keeps the time it was first deleted. The workspace's default project can't be deleted. A delete that changes something is recorded in the audit log, `project-deleted`.

## `client.projects.restore()`

```python signature
restore(
    project_id: str | UUID,
    /,
    *,
    idempotency_key: str | None = None,
    timeout: float | None = None,
) -> Project
```

Restore a deleted project. `POST /v1/projects/{projectId}/restore`

Brings a deleted project back as it was: its members, team grants, keys, own service account and slugs, and its triggers' next fires run. Fires and deliveries that came due while it was deleted were skipped, and runs cancelled at the delete stay cancelled. Its `updatedAt` moves to the restore. A live project answers 200, unchanged. A deleted project doesn't count against the workspace's limit on projects in production, so restoring one that's in production counts it again: at the limit, the restore is refused (`403 production-limit-reached`) and the project stays deleted. Needs `admin` on the workspace: roles on a deleted project reach nothing, its own admins' included. Restoring a deleted project is recorded in the audit log, `project-restored`.
