---
title: "Organizations"
description: "REST endpoints for organizations. Bearer-auth required."
section: "API"
group: "REST"
order: 51
---

## GET /api/organizations

List organizations.

**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.
- `handle` (optional): Filter by handle (case-sensitive exact match).
- `include_deleted` (optional): Soft-deleted org visibility. `false` (default) — active rows only. `true` — active plus soft-deleted. `only` — soft-deleted only.
- `owner_id` (optional): Shorthand: filter where `ownerId` equals this value.

**Response**

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

## POST /api/organizations

Create organization

**Request body**

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

**Response**

```json
{
  "id": "string",
  "name": "string",
  "handle": "string",
  "ownerId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## GET /api/organizations/{id}

Get an organization by ID.

**Path parameters**

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

**Response**

```json
{
  "id": "string",
  "name": "string",
  "handle": "string",
  "ownerId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## PATCH /api/organizations/{id}

Update organization

**Path parameters**

- `id` (required):

**Request body**

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

**Response**

```json
{
  "id": "string",
  "name": "string",
  "handle": "string",
  "ownerId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## DELETE /api/organizations/{id}

Soft-delete an organization.

**Path parameters**

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

**Response**

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

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

Permanently delete a soft-deleted organization.

**Path parameters**

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

**Response**

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

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

Restore a soft-deleted organization.

**Path parameters**

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

**Response**

```json
{
  "id": "string",
  "name": "string",
  "handle": "string",
  "ownerId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## GET /api/organizations/by-handle/{handle}

Get organization by handle

Resolves an organization handle to its full row. Used by path-based URL routing (`/<orghandle>/…`). Caller must be a member; non-members get 403 (preserves handle privacy).

**Path parameters**

- `handle` (required):

**Response**

```json
{
  "id": "string",
  "name": "string",
  "handle": "string",
  "ownerId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```
