---
title: "Elements"
description: "REST endpoints for elements. Bearer-auth required."
section: "API"
group: "REST"
order: 26
---

## GET /api/elements

List elements.

**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.
- `workspace_id` (optional): Filter elements to this workspace.
- `include_deleted` (optional): Soft-deleted element visibility. `false` (default) — active rows only. `true` — active plus soft-deleted. `only` — soft-deleted only.
- `name` (optional): Case-insensitive substring match on name.
- `source` (optional): Narrow by source. `workspace` = this workspace's elements plus those visible via installed integrations; `integration` = only elements made visible by installed integrations; omit = union.
- `status` (optional): Shorthand: filter where `status` equals this value.
- `default_version_id` (optional): Shorthand: filter where `defaultVersionId` equals this value.
- `created_by` (optional): Shorthand: filter where `createdBy` equals this value.
- `retention_tier` (optional): Shorthand: filter where `retentionTier` equals this value.

**Response**

```json
{
  "data": [
    {
      "id": "<...>",
      "workspaceId": "<...>",
      "name": "<...>",
      "description": "<...>",
      "status": "<...>",
      "visibility": "<...>",
      "defaultVersionId": "<...>",
      "defaultExportName": "<...>",
      "createdBy": "<...>",
      "deletedAt": "<...>",
      "retentionTier": "<...>",
      "createdAt": "<...>",
      "updatedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}
```

## POST /api/elements

Create element

**Request body**

```json
{
  "workspaceId": "string",
  "name": "string",
  "description?": "string",
  "visibility?": "private | public",
  "files?": [
    {
      "path": "<...>",
      "content": "<...>"
    }
  ]
}
```

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "status": "draft | live",
  "visibility": "private | public",
  "defaultVersionId": "string",
  "defaultExportName": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## GET /api/elements/{id}

Get a single element.

**Path parameters**

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

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "status": "draft | live",
  "visibility": "private | public",
  "defaultVersionId": "string",
  "defaultExportName": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## PATCH /api/elements/{id}

Update element

**Path parameters**

- `id` (required):

**Request body**

```json
{
  "name?": "string",
  "description?": "string",
  "visibility?": "private | public",
  "defaultVersionId?": "string"
}
```

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "status": "draft | live",
  "visibility": "private | public",
  "defaultVersionId": "string",
  "defaultExportName": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## DELETE /api/elements/{id}

Soft-delete an element.

**Path parameters**

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

**Response**

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

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

Permanently delete a soft-deleted element.

**Path parameters**

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

**Response**

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

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

Restore a soft-deleted element.

**Path parameters**

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

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "status": "draft | live",
  "visibility": "private | public",
  "defaultVersionId": "string",
  "defaultExportName": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```
