---
title: API reference
description: Authenticated customer REST endpoints used by the 1c CLI.
url: https://1consent.app/docs/reference/api
---

# API reference

The supported customer REST surface is `/api/v1/cli/*` on the Dashboard API. Administrative Dashboard routes, billing webhooks, service-to-service endpoints, and the Internal system publisher are operational interfaces—not public customer contracts.

## Authentication

Bearer API key with the design_manager right. Keys may be scoped to a workspace (API value `org`), project, or app; requested child scopes must be contained by the key scope.

```bash
curl -H "Authorization: Bearer $ONECONSENT_TOKEN" \
  "<dashboard-origin>/api/v1/cli/validate"
```

Requests and responses use JSON. Invalid JSON or schema violations return `400`; missing or invalid keys return `401`; insufficient rights or an out-of-scope target return `403`. Mutation bodies are strict: unknown fields are rejected, `scope` and `scopeId` must be supplied together, and public identifiers are short IDs rather than database UUIDs.

## `GET /api/v1/cli/validate`

Validate an API key. Returns the authenticated customer scope, its public short ID and display name, and the key rights.

### Request example

```text
No query parameters or body.
```

### Success response schema

[Open the generated `api-key-info` JSON Schema](/reference/cli-api/api-key-info.schema.json).

### Success response example

```json
{
  "scope": "org",
  "scopeId": "org_demo",
  "scopeName": "Example Workspace",
  "rights": ["design_manager"]
}
```

## `GET /api/v1/cli/scope-tree`

List the accessible hierarchy. Returns projects and apps visible beneath the API key scope. All IDs are public short IDs, never database UUIDs.

### Request example

```text
No query parameters or body.
```

### Success response schema

[Open the generated `scope-tree` JSON Schema](/reference/cli-api/scope-tree.schema.json).

### Success response example

```json
{
  "scope": "org",
  "scopeId": "org_demo",
  "scopeName": "Example Workspace",
  "projects": [{
    "id": "project_demo",
    "slug": "website",
    "name": "Website",
    "apps": [{ "id": "app_demo", "name": "Store", "domain": "shop.example.com" }]
  }]
}
```

## `GET /api/v1/cli/resources`

Read resources for a scope. Returns standalone designs, themes, and collections for one authorized workspace, project, or app scope.

### Request schema

[Open the generated `scope-reference` JSON Schema](/reference/cli-api/scope-reference.schema.json).

### Request example

```text
Query parameters:
- scope: org | project | app
- scopeId: public short ID
```

### Success response schema

[Open the generated `scoped-resources` JSON Schema](/reference/cli-api/scoped-resources.schema.json).

### Success response example

```json
{
  "collections": [],
  "templates": [{
    "id": "design_demo",
    "name": "GDPR notice",
    "description": null,
    "version": 1,
    "status": "DRAFT",
    "frameworkType": "GDPR",
    "files": []
  }],
  "themes": []
}
```

## `POST /api/v1/cli/designs`

Create or update a standalone design. Upserts a standalone design by short ID within the authorized scope. Omit scope and scopeId together to use the API key scope.

### Request schema

[Open the generated `upsert-design` JSON Schema](/reference/cli-api/upsert-design.schema.json).

### Request example

```text
{
  "scope": "app",
  "scopeId": "app_demo",
  "shortId": "design_demo",
  "name": "GDPR notice",
  "description": "Primary notice",
  "frameworkType": "GDPR",
  "files": [{ "kind": "view", "filename": "main.1cl", "content": "..." }]
}
```

### Success response schema

[Open the generated `upsert-result` JSON Schema](/reference/cli-api/upsert-result.schema.json).

### Success response example

```json
{ "success": true, "id": "design_demo", "action": "updated" }
```

## `POST /api/v1/cli/themes`

Create or update a theme. Upserts a validated token theme by short ID within the authorized scope. Omit scope and scopeId together to use the API key scope.

### Request schema

[Open the generated `upsert-theme` JSON Schema](/reference/cli-api/upsert-theme.schema.json).

### Request example

```text
{
  "scope": "app",
  "scopeId": "app_demo",
  "shortId": "theme_demo",
  "name": "Brand theme",
  "tokens": { "...": "validated theme token configuration" }
}
```

### Success response schema

[Open the generated `upsert-result` JSON Schema](/reference/cli-api/upsert-result.schema.json).

### Success response example

```json
{ "success": true, "id": "theme_demo", "action": "updated" }
```

## `POST /api/v1/cli/collections`

Create or update a design collection. Atomically replaces a collection's shared files and at most one GDPR, TCF, and US design within the authorized scope.

### Request schema

[Open the generated `upsert-collection` JSON Schema](/reference/cli-api/upsert-collection.schema.json).

### Request example

```text
{
  "scope": "app",
  "scopeId": "app_demo",
  "shortId": "collection_demo",
  "name": "Default collection",
  "description": null,
  "sharedFiles": [{ "filename": "button.1cl", "content": "..." }],
  "templates": [{
    "shortId": "gdpr_demo",
    "name": "GDPR",
    "frameworkType": "GDPR",
    "files": []
  }]
}
```

### Success response schema

[Open the generated `upsert-result` JSON Schema](/reference/cli-api/upsert-result.schema.json).

### Success response example

```json
{ "success": true, "id": "collection_demo", "action": "updated" }
```
