---
title: "Teams"
description: "REST endpoints for teams. Bearer-auth required."
section: "API"
group: "REST"
order: 68
---

## GET /api/teams

List teams.

**Query parameters**

- `limit` (optional): Page size (1–100, default 100).
- `after` (optional): Keyset cursor — return the page after this row (next page).
- `before` (optional): Keyset cursor — return the page before this row (prev page).
- `ids` (optional): Comma-separated list of IDs. Narrows results to these IDs within the caller's accessible scope (does not bypass access checks).
- `filter` (optional): Nested filter expression (`<Entity>Filter`): AND/OR/NOT + per-field comparison operators + relation traversal. JSON-encoded on the query string.
- `orderBy` (optional): Multi-key sort (`<Entity>OrderBy[]`): array of `{ field: direction }` applied in order. Directions: asc/desc plus the four explicit nulls variants. JSON-encoded on the query string.
- `organization_id` (optional): Optional narrower — list only teams in this org. Without it, lists every team across orgs the caller has visibility into.
- `include_deleted` (optional): Soft-deleted team visibility. `false` (default) — active rows only. `true` — active plus soft-deleted. `only` — soft-deleted only.
- `name` (optional): Case-insensitive substring match on name.
- `created_by` (optional): Shorthand: filter where `createdBy` equals this value.
- `deleted_by` (optional): Shorthand: filter where `deletedBy` equals this value.
- `retention_tier` (optional): Shorthand: filter where `retentionTier` equals this value.

**Response**

```json
{
  "data": [
    {
      "id": "<...>",
      "organizationId": "<...>",
      "name": "<...>",
      "handle": "<...>",
      "createdBy": "<...>",
      "deletedAt": "<...>",
      "deletedBy": "<...>",
      "retentionTier": "<...>",
      "createdAt": "<...>",
      "updatedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}
```

## POST /api/teams

Create team

**Request body**

```json
{
  "organizationId": "string",
  "name": "string",
  "handle": "string"
}
```

**Response**

```json
{
  "id": "string",
  "organizationId": "string",
  "name": "string",
  "handle": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "deletedBy": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## GET /api/teams/{id}

Get a team by ID.

**Path parameters**

- `id` (required): Team to retrieve.

**Response**

```json
{
  "id": "string",
  "organizationId": "string",
  "name": "string",
  "handle": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "deletedBy": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## PATCH /api/teams/{id}

Update team

**Path parameters**

- `id` (required):

**Request body**

```json
{
  "name?": "string",
  "handle?": "string"
}
```

**Response**

```json
{
  "id": "string",
  "organizationId": "string",
  "name": "string",
  "handle": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "deletedBy": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## DELETE /api/teams/{id}

Soft-delete a team.

**Path parameters**

- `id` (required): Team to soft-delete.

**Response**

```json
{
  "success": "boolean"
}
```

## DELETE /api/teams/{id}/purge

Permanently delete a soft-deleted team.

**Path parameters**

- `id` (required): Soft-deleted team to permanently delete.

**Response**

```json
{
  "success": "boolean"
}
```

## POST /api/teams/{id}/restore

Restore a soft-deleted team.

**Path parameters**

- `id` (required): Soft-deleted team to restore.

**Response**

```json
{
  "id": "string",
  "organizationId": "string",
  "name": "string",
  "handle": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "deletedBy": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```
