<!-- Generator: Widdershins v4.0.1 -->

<h1 id="coolhand-llm-request-logging-api">Coolhand LLM Request Logging API v2</h1>

LLM Request Logging API Documentation.

# Introduction
This API allows clients to log and store request/response data from Large Language Model (LLM) API calls
for monitoring, analysis, and debugging purposes. The API accepts any JSON structure in the `raw_request`
field, making it flexible for different LLM providers and use cases.

# Authentication
API uses **API Key** authentication. Clients are issued unique API keys that must be included
in requests using one of these methods:

- **X-API-Key header**: `X-API-Key: your_api_key_here`
- **Authorization Bearer header**: `Authorization: Bearer your_api_key_here`

Contact your administrator to obtain an API key.

## Public vs. private keys
Every client is issued two independent keys:

- **Public key** (`ch_pub_...`) — safe to embed in SDK setup snippets, agent-facing code, or
  anywhere else it might be exposed to an end user. It only permits ingest-style writes (e.g.
  logging a new request, submitting feedback) — it cannot read back any data.
- **Private key** (`ch_priv_...`) — required for read endpoints and other sensitive operations
  (e.g. optimization evidence links). Never embed a private key in
  client-side or agent-facing code; treat it like a server-side secret.

Each endpoint below documents which key type(s) it accepts. Endpoints that require a private
key are marked accordingly.

# Common Use Cases

## OpenAI API Logging
Log requests and responses from OpenAI's chat completions, embeddings, and other endpoints.

## Anthropic Claude Logging
Store conversation data and model responses from Claude API calls.

## Custom LLM Provider Logging
The flexible JSON structure supports any LLM provider's request/response format.

## Analytics and Monitoring
Aggregate usage statistics, token consumption, and performance metrics across LLM calls.

# API Error Handling
  ## Error Response Structure
  When interacting with the LLM Request Logging API, you'll encounter standard error response formats
  for different types of failures.

  
  ## HTTP Status Codes
  Understanding the HTTP status codes for this API:

  |HTTP Status Code          | Description
  |--------------------------|-------------------------------
  |`201` Created             | LLM request log successfully created
  |`400` Bad Request         | Malformed request or invalid JSON structure
  |`401` Unauthorized        | Missing, invalid, or expired API key
  |`422` Unprocessable Entity| Validation error - required fields missing or invalid format
  |`5xx` Server Errors       | Server-side issues - please report these for investigation

Base URLs:

* <a href="http://{productionHost}">http://{productionHost}</a>

    * **stageHost** -  Default: coolhandlabs.com

* <a href="http://{defaultHost}">http://{defaultHost}</a>

    * **defaultHost** -  Default: 0.0.0.0:3000

# Authentication

* API Key (publicApiKey)
    - Parameter Name: **X-API-Key**, in: header. A client's public key (`ch_pub_...`). Safe to embed in SDK/agent-facing code. Only permits ingest-style writes — cannot read data back.

* API Key (privateApiKey)
    - Parameter Name: **X-API-Key**, in: header. A client's private key (`ch_priv_...`). Required for read endpoints and other sensitive operations. Never embed in client-side or agent-facing code.

- HTTP Authentication, scheme: bearer Either key type (public or private, per the operation's requirements) or a Doorkeeper OAuth access token, sent as `Authorization: Bearer <token>`.

<h1 id="coolhand-llm-request-logging-api-client-files">Client Files</h1>

API endpoints for uploading documents/files associated with a client

## Create Client File

<a id="opIdcreate_client_file"></a>

`POST /api/v2/client_files`

Uploads a document as a ClientFile, e.g. so a tool like coolhand-cli can attach project files to a client. `id` is the file's hashid. `metadata` is an optional free-form object for client-supplied context - see the `project_path` convention in the [Understanding an LLM Request Log](/guides/log_fields) guide's Metadata section, which applies here too. Uploads always land as `draft`: `status` is not settable through this endpoint - a client admin promotes a file with `PATCH /api/v2/client_files/{id}`. Requires the private API key - the public key cannot upload files. Files are currently proxied through the API and capped at 20MB; larger uploads are not yet supported. Accepted formats: pdf, md/markdown, txt, docx/doc, xlsx/xls, pptx/ppt, odt/ods/odp and html/htm. The type is detected from the file's contents and must match its extension; anything else is rejected with a 422 on `file`.

> Body parameter

```yaml
string

```

<h3 id="create-client-file-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|Authorization|header|string|false|Bearer token with the private API key|
|body|body|string|true|Display name for the file|

> Example responses

> 201 Response

```json
{
  "id": "string",
  "name": "string",
  "file_type": "string",
  "status": "string",
  "description": "string",
  "metadata": {},
  "created_at": "2019-08-24T14:15:22Z"
}
```

<h3 id="create-client-file-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success without optional fields, defaulting file_type/status|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - public (write-only) key cannot upload files|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - missing name|Inline|

<h3 id="create-client-file-responseschema">Response Schema</h3>

Status Code **201**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» name|string|false|none|none|
|» file_type|string|false|none|none|
|» status|string|false|none|none|
|» description|string¦null|false|none|none|
|» metadata|object|false|none|none|
|» created_at|string(date-time)|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## List Client Files

<a id="opIdlist_client_files"></a>

`GET /api/v2/client_files`

Lists the client's files of every status (draft, published, archived), newest first. Requires a **per-user API key** belonging to a client admin of the client. The client-level private key, the public key, OAuth access tokens and keys of non-admin members are rejected. The per-user key may be sent as `X-API-Key` or as `Authorization: Bearer <key>`. Paginated: see the `X-Page`, `X-Per-Page`, `X-Total-Count` and `X-Total-Pages` response headers.

<h3 id="list-client-files-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Per-user private API key of a client admin|
|Authorization|header|string|false|Bearer token with the per-user private API key|
|status|query|string|false|Filter by status: draft, published or archived|
|file_type|query|string|false|Filter by file type: slide_deck, report or document|
|page|query|integer|false|Page number|
|per|query|integer|false|Page size (default 25, max 100)|

> Example responses

> 200 Response

```json
[
  {
    "id": "string",
    "name": "string",
    "file_type": "string",
    "status": "string",
    "description": "string",
    "metadata": {},
    "created_at": "2019-08-24T14:15:22Z"
  }
]
```

<h3 id="list-client-files-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|forbidden - key does not belong to a client admin|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unknown status filter|None|

<h3 id="list-client-files-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» name|string|false|none|none|
|» file_type|string|false|none|none|
|» status|string|false|none|none|
|» description|string¦null|false|none|none|
|» metadata|object|false|none|none|
|» created_at|string(date-time)|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **403**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Update Client File Status

<a id="opIdupdate_client_file_status"></a>

`PATCH /api/v2/client_files/{id}`

Changes a file's `status` to draft, published or archived. A client admin can publish a file directly - published files appear on the client's dashboard. Only `status` can be changed. Any status can be set from any other (e.g. archive and un-archive a file); setting the current status again is a no-op that returns 200. Requires a **per-user API key** belonging to a client admin of the client. The client-level private key, the public key, OAuth access tokens and keys of non-admin members are rejected. The per-user key may be sent as `X-API-Key` or as `Authorization: Bearer <key>`.

> Body parameter

```json
{
  "client_file": {
    "status": "string"
  }
}
```

<h3 id="update-client-file-status-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Per-user private API key of a client admin|
|Authorization|header|string|false|Bearer token with the per-user private API key|
|body|body|object|true|none|
|» client_file|body|object|false|none|
|»» status|body|string|false|none|
|id|path|string|true|Client file hashid|

> Example responses

> 200 Response

```json
{
  "id": "string",
  "name": "string",
  "file_type": "string",
  "status": "string",
  "description": "string",
  "metadata": {},
  "created_at": "2019-08-24T14:15:22Z"
}
```

<h3 id="update-client-file-status-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|forbidden - key does not belong to a client admin|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|file not found for this client|None|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unknown status|None|

<h3 id="update-client-file-status-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» name|string|false|none|none|
|» file_type|string|false|none|none|
|» status|string|false|none|none|
|» description|string¦null|false|none|none|
|» metadata|object|false|none|none|
|» created_at|string(date-time)|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **403**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Download Client File

<a id="opIddownload_client_file"></a>

`GET /api/v2/client_files/{id}/content`

Downloads the raw bytes of the uploaded file, whatever its status. The `Content-Type` is the type detected at upload; PDF, HTML and text files are served inline, other formats as an attachment. Requires a **per-user API key** belonging to a client admin of the client. The client-level private key, the public key, OAuth access tokens and keys of non-admin members are rejected. The per-user key may be sent as `X-API-Key` or as `Authorization: Bearer <key>`.

<h3 id="download-client-file-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Per-user private API key of a client admin|
|Authorization|header|string|false|Bearer token with the per-user private API key|
|id|path|string|true|Client file hashid|

> Example responses

> 401 Response

```
{"error":"string"}
```

<h3 id="download-client-file-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|None|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|forbidden - key does not belong to a client admin|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|file not found for this client|None|

<h3 id="download-client-file-responseschema">Response Schema</h3>

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **403**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-llm-references">LLM References</h1>

Read-only API endpoints for the files referenced by tool calls in a client's Claude Code / Cowork sessions — the same data behind the Referenced Files dashboard page.

## List Referenced Files

<a id="opIdlist_referenced_files"></a>

`GET /api/v2/llm_references`

Returns this client's referenced files aggregated to one row per distinct `file_path`,
ranked by `reference_count` descending — the same data and ordering as the "Referenced
Files" dashboard page. The body is a bare JSON array, matching
`GET /api/v2/llm_request_templates` rather than an envelope. Pagination metadata is
exposed via the `X-Page`, `X-Per-Page`, `X-Total-Count` and `X-Total-Pages` response
headers.

**Bounded to a 90-day window.** Only references created within the last
`LlmReference::DEFAULT_WINDOW` (90 days) are counted, matching the dashboard page — a
file referenced only outside that window will not appear.

**`reference_count` and `last_referenced_at` are computed, not stored columns.** They
are aggregate expressions (`COUNT(*)`, `MAX(created_at)`) over the underlying rows.

**`path_category` is a best-effort classification of `file_path`, also computed rather
than stored.** One of `ephemeral_cloud_sandbox` (inside a Cowork cloud sandbox container
destroyed when its session ended — unrecoverable), `local_session_copy` (mirrored to the
user's own Mac by Cowork; likely but not confirmed still present), `user_file` (the
user's own file, untouched by any session lifecycle), `repo_relative` (an ordinary
Claude Code repo-relative path — the common case), or `unclassified` (none of the above).

**Search with `q[file_path_cont]=`.** Basic Ransack filtering is supported against
`LlmReference.ransackable_attributes` (`file_path`, `created_at`, `updated_at`).
An unrecognized attribute or predicate returns 422 rather than being silently ignored.
**Sorting (`q[s]=`) is not supported and also returns 422** — there is no sort that
composes with the grouped response; results are always ranked by `reference_count`.

**The two-statement cost.** `#index` issues the grouped page query and a separate
`COUNT(DISTINCT file_path)` for the pagination total, so — like
`GET /api/v2/llm_request_templates` — a `504` here means one of those two statements
individually exceeded the per-statement timeout, and total database time for the
response can reach twice that figure.

**No per-file-path show endpoint.** File paths contain slashes and aren't safe as a URL
path segment, so the per-file session drill-down lives at
`GET /api/v2/llm_references/sessions?file_path=...` instead.

The client is always derived from the authenticating API key; there is no `client_id`
parameter. Requires the **private** API key — the public key is write-only and cannot
read data back.

<h3 id="list-referenced-files-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|Authorization|header|string|false|Bearer token with the private API key|
|q[file_path_cont]|query|string|false|Case-insensitive substring match against file_path|
|page|query|integer|false|Page number|
|per|query|integer|false|Records per page (default 25, max 100; per_page also accepted)|
|per_page|query|integer|false|Alias for per (same 25/100 bounds)|
|q[id_eq]|query|string|false|NOT a supported filter — id was intentionally excluded from ransackable_attributes (it isn't part of this endpoint's response shape). Documented here only to show the resulting contract: an unrecognized filter attribute returns 422 rather than being silently ignored.|
|q[created_at_gteq]|query|string|false|Filter to references created on or after this ISO 8601 timestamp. created_at/updated_at are ransackable for range predicates like this one (_gteq/_lteq); a substring predicate against either (e.g. q[created_at_cont]) is accepted but matches nothing, since Ransack does not compile a LIKE-family predicate against a timestamp column.|
|q[s]|query|string|false|NOT a supported filter — sorting is rejected outright (422) rather than silently ignored or honored, because no sort composes with the grouped response. Results are always ranked by reference_count descending.|

> Example responses

> 200 Response

```json
[
  {
    "file_path": "string",
    "reference_count": 0,
    "path_category": "ephemeral_cloud_sandbox",
    "last_referenced_at": "2019-08-24T14:15:22Z"
  }
]
```

<h3 id="list-referenced-files-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|q[created_at_gteq] filters to references created on or after a timestamp|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - sorting is not supported|Inline|
|504|[Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5)|gateway timeout - the aggregate exceeded the statement timeout|Inline|

<h3 id="list-referenced-files-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» file_path|string|false|none|none|
|» reference_count|integer|false|none|none|
|» path_category|string|false|none|Best-effort classification of file_path's retrievability|
|» last_referenced_at|string(date-time)|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|path_category|ephemeral_cloud_sandbox|
|path_category|local_session_copy|
|path_category|user_file|
|path_category|repo_relative|
|path_category|unclassified|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **504**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## List sessions that referenced a file

<a id="opIdlist_sessions_that_referenced_a_file"></a>

`GET /api/v2/llm_references/sessions`

Returns the raw rows for a single `file_path`, newest first — the per-file drill-down
that `GET /api/v2/llm_references` intentionally omits, so a caller can see which
individual sessions referenced a file rather than only the aggregate count.
`llm_request_log_id` is that session's hashid — feed it to
`GET /api/v2/llm_request_logs/{id}` to inspect the session itself.

`file_path` must match exactly (no Ransack substring matching here — this is a lookup for
a path you already have, typically from the `file_path` field on the list endpoint's
response, not a search). Bounded to the same 90-day window as the list endpoint.

Requires the **private** API key.

<h3 id="list-sessions-that-referenced-a-file-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|Authorization|header|string|false|Bearer token with the private API key|
|file_path|query|string|true|Exact file path to look up sessions for|
|page|query|integer|false|Page number|
|per|query|integer|false|Records per page (default 25, max 100; per_page also accepted)|

> Example responses

> 200 Response

```json
[
  {
    "llm_request_log_id": "string",
    "created_at": "2019-08-24T14:15:22Z"
  }
]
```

<h3 id="list-sessions-that-referenced-a-file-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|returns raw per-session rows for one file_path, newest first, scoped to this client|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - the public API key cannot read|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - file_path is required|Inline|
|504|[Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5)|gateway timeout - the session count exceeded the statement timeout|Inline|

<h3 id="list-sessions-that-referenced-a-file-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» llm_request_log_id|string|false|none|none|
|» created_at|string(date-time)|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **504**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-llm-request-log-feedbacks">LLM Request Log Feedbacks</h1>

API endpoints for collecting user feedback on LLM request/response quality and accuracy

## Create LLM Request Log Feedback

<a id="opIdcreate_llm_request_log_feedback"></a>

`POST /api/v2/llm_request_log_feedbacks`

Creates a new feedback entry for LLM request monitoring and improvement purposes.

**Field Guide - All fields are optional, but here's how to get the best results:**

### Matching Fields
- **llm_request_log_id** 🎯 *Exact Match* - Hashid from the Coolhand API response when the original LLM request was logged. Provides exact matching.
- **llm_provider_unique_id** 🎯 *Exact Match* - The x-request-id from the LLM API response (e.g., "req_xxxxxxx")
- **original_output** 🔍 *Fuzzy Match* - The original LLM response text. Provides fuzzy matching but isn't 100% reliable.
- **client_unique_id** 🔗 *Your Internal Matcher* - Connect to an identifier from your system for internal matching
- **workload_hashid** 📦 *Workload Association* - Optional. Associate feedback with a specific workload to increase fuzzy match success rate

### Quality Data
- **revised_output** ⭐ *Best Signal* - End user revision of the LLM response. The highest value data for improving quality scores.
- **explanation** 💬 *Medium Signal* - End user explanation of why the response was good or bad. Valuable qualitative data.
- **like** 👍 *Low Signal* - Boolean like/dislike. Lower quality signal but easy for users to provide.
- **creator_unique_id** 👤 *User Tracking* - Unique ID to match feedback to the end user who created it
- **collector** 🏷️ *Metadata* - Optional name/stamp identifying the collection method (e.g., "coolhand-node-0.1.0")

**Reusing an existing placeholder:** if `original_output` + `coolhand_fingerprint_id` match
an existing unrated feedback record, this request updates that record instead of creating a
new one. For a public-key caller, only `like`/`sentiment`/`explanation`/`revised_output`/
`llm_request_log_id` are applied to it — the rest of the request is ignored (and reported
in `warnings`), the same restriction `PATCH /api/v2/llm_request_log_feedbacks/{id}` applies
to a public key. `llm_request_log_id` stays writable here even though PATCH treats it as
immutable for every caller: it's already scoped to this client, so linking it in doesn't
cross the same boundary the other restricted fields do. Private key / OAuth Bearer token
callers can update every field on the existing record. This restriction only applies when
reusing an existing placeholder — a genuinely new record still accepts the full field set
from a public key.

**Size limit:** a request made with the public key is capped at 10MB (413 above that);
private keys are not capped.

**Response shape:** a public-key caller receives only the record's `id` back (plus
`warnings`, and `created_partial_id` when a partial was created) — reading a record back is
a private-credential operation. Private key / OAuth Bearer callers get the full payload
documented below.

> Body parameter

```json
{
  "llm_request_log_feedback": {
    "llm_request_log_id": "string",
    "like": true,
    "explanation": "Great response! Very helpful and accurate.",
    "revised_output": "This is a dummy revised output",
    "llm_provider_unique_id": "req_1234567890abcdef",
    "original_output": "Dear John Doe,\n\nThank you for reaching out to us regarding the issue with your recent order #12345...",
    "client_unique_id": "email-service-1760025972258",
    "creator_unique_id": "user-789",
    "collector": "coolhand-node-0.1.0",
    "workload_hashid": "abc123def456",
    "sentiment": "like",
    "coolhand_fingerprint_id": "fp-abc123xyz",
    "focus_section": "This specific sentence needs improvement.",
    "focus_range": {
      "start": 100,
      "end": 150
    }
  }
}
```

<h3 id="create-llm-request-log-feedback-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|API key for authentication|
|Authorization|header|string|false|Bearer token with API key|
|api_key|query|string|false|API key as query parameter|
|collector|query|string|false|🏷️ Optional collector identifier (can also be provided in request body)|
|body|body|object|true|none|
|» llm_request_log_feedback|body|object|true|none|
|»» llm_request_log_id|body|string|false|🎯 Exact Match - Hashid from the Coolhand API response when the original LLM request was logged. Provides exact matching to connect feedback to a specific logged request. A raw integer FK is also still accepted for backward compatibility.|
|»» like|body|boolean|false|👍 Low Signal - Boolean like/dislike rating. Lower quality signal but easy for users to provide. Use true for positive feedback, false for negative, or null/omit for neutral.|
|»» explanation|body|string¦null|false|💬 Medium Signal - End user explanation of why the response was good or bad. Valuable qualitative data for understanding user preferences and improving model performance. (optional, max 5000 characters)|
|»» revised_output|body|string|false|⭐ Best Signal - End user revision of the LLM response. The highest value data for improving quality scores. This is the user's improved version of what the AI should have said. (PostgreSQL text field - up to 1GB)|
|»» llm_provider_unique_id|body|string|false|🎯 Exact Match - The x-request-id from the LLM API response (e.g., 'req_xxxxxxx'). Provides exact matching to connect feedback to the specific LLM provider request.|
|»» original_output|body|string|false|🔍 Fuzzy Match - The original LLM response text. Provides fuzzy matching but isn't 100% reliable. Use when you don't have llm_provider_unique_id or llm_request_log_id. (PostgreSQL text field - up to 1GB)|
|»» client_unique_id|body|string|false|🔗 Your Internal Matcher - Connect to an identifier from your system for internal matching. This helps you correlate feedback with your own request tracking system.|
|»» creator_unique_id|body|string|false|👤 User Tracking - Unique ID to match feedback to the end user who created it. Useful for analyzing feedback patterns by user and preventing duplicate feedback.|
|»» collector|body|string¦null|false|🏷️ Metadata - Optional name/stamp identifying the collection method or SDK version. Helps track which system or version collected the feedback.|
|»» workload_hashid|body|string¦null|false|📦 Workload Association - Optional. Hashid of the workload to associate this feedback with. Providing a workload increases the fuzzy match success rate. If invalid, a warning will be added but feedback saved.|
|»» sentiment|body|string¦null|false|🎭 Sentiment - Explicit sentiment value: 'like', 'dislike', or 'neutral'. Takes precedence over the 'like' boolean if both are provided. Prefer using sentiment over like for new integrations. Any other value is rejected with a 422.|
|»» coolhand_fingerprint_id|body|string¦null|false|🔑 Session/Device ID - Unique identifier for the session or device. Used for parent matching when creating partial feedback.|
|»» focus_section|body|string¦null|false|🎯 Partial Feedback - The specific text section being rated. When provided, creates a FeedbackPartial attached to a parent feedback. The parent is automatically found or created based on original_output and user identifiers.|
|»» focus_range|body|object¦null|false|📍 Position Range - Character positions of the focus_section within original_output. Useful when the same text appears multiple times.|
|»»» start|body|integer|false|Start character position (0-indexed)|
|»»» end|body|integer|false|End character position (exclusive)|

#### Enumerated Values

|Parameter|Value|
|---|---|
|»» sentiment|like|
|»» sentiment|dislike|
|»» sentiment|neutral|

> Example responses

> 201 Response

```json
{
  "id": "string",
  "client_id": "string",
  "llm_request_log_id": "string",
  "workload_id": "string",
  "like": true,
  "sentiment": "string",
  "creator_type": "string",
  "explanation": "string",
  "revised_output": "string",
  "llm_provider_unique_id": "string",
  "original_output": "string",
  "client_unique_id": "string",
  "creator_unique_id": "string",
  "collector": "string",
  "coolhand_fingerprint_id": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "content_scrubbed_at": "2019-08-24T14:15:22Z",
  "had_revised_output": true,
  "had_explanation": true,
  "warnings": [
    {
      "message": "string",
      "timestamp": "2019-08-24T14:15:22Z"
    }
  ],
  "created_partial_id": "string",
  "feedback_partials": [
    {
      "id": "string",
      "llm_request_log_feedback_id": "string",
      "client_id": "string",
      "focus_section": "string",
      "focus_range": {
        "start": 0,
        "end": 0
      },
      "sentiment": "like",
      "like": true,
      "explanation": "string",
      "creator_unique_id": "string",
      "coolhand_fingerprint_id": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ]
}
```

<h3 id="create-llm-request-log-feedback-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success with partial feedback (focus_section)|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - invalid API key|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable - validation failed (e.g. unknown sentiment)|Inline|

<h3 id="create-llm-request-log-feedback-responseschema">Response Schema</h3>

Status Code **201**

*Response when creating partial feedback. Includes the parent feedback with created_partial_id indicating which FeedbackPartial was created.*

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|Parent feedback hashid|
|» client_id|string|false|none|Hashid of the client that owns this feedback entry.|
|» llm_request_log_id|string¦null|false|none|none|
|» workload_id|string¦null|false|none|none|
|» like|boolean¦null|false|none|none|
|» sentiment|string¦null|false|none|Parent sentiment (may be nil for placeholder)|
|» creator_type|string¦null|false|none|none|
|» explanation|string¦null|false|none|none|
|» revised_output|string¦null|false|none|none|
|» llm_provider_unique_id|string¦null|false|none|none|
|» original_output|string¦null|false|none|none|
|» client_unique_id|string¦null|false|none|none|
|» creator_unique_id|string¦null|false|none|none|
|» collector|string¦null|false|none|none|
|» coolhand_fingerprint_id|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» content_scrubbed_at|string(date-time)¦null|false|none|none|
|» had_revised_output|boolean¦null|false|none|none|
|» had_explanation|boolean¦null|false|none|none|
|» warnings|[object]¦null|false|none|Warnings about auto-created placeholder parent or other issues|
|»» message|string|false|none|none|
|»» timestamp|string(date-time)|false|none|none|
|» created_partial_id|string|false|none|Hashid of the FeedbackPartial that was created. Use this ID with PATCH requests to update the partial.|
|» feedback_partials|[object]|false|none|Array of FeedbackPartials attached to this parent|
|»» id|string|false|none|FeedbackPartial hashid|
|»» llm_request_log_feedback_id|string|false|none|Parent feedback hashid|
|»» client_id|string|false|none|Hashid of the client (delegated from the parent).|
|»» focus_section|string|false|none|The highlighted text section|
|»» focus_range|object¦null|false|none|none|
|»»» start|integer|false|none|none|
|»»» end|integer|false|none|none|
|»» sentiment|string¦null|false|none|none|
|»» like|boolean¦null|false|none|Computed from sentiment for backwards compatibility|
|»» explanation|string¦null|false|none|none|
|»» creator_unique_id|string¦null|false|none|none|
|»» coolhand_fingerprint_id|string¦null|false|none|none|
|»» created_at|string(date-time)|false|none|none|
|»» updated_at|string(date-time)|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|sentiment|like|
|sentiment|dislike|
|sentiment|neutral|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|true|none|Validation messages keyed by field name|
|»» **additionalProperties**|[string]|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
publicApiKey, privateApiKey, bearerAuth
</aside>

## Search LLM Request Log Feedbacks

<a id="opIdsearch_llm_request_log_feedbacks"></a>

`GET /api/v2/llm_request_log_feedbacks`

Returns this client's feedback entries. Supports Ransack search via `q[...]` params (e.g. `q[sentiment_eq]=2` - sentiment is stored as the integer codes 0=dislike/1=neutral/2=like, which is what responses render as the strings 'dislike'/'neutral'/'like' - or `q[created_at_gteq]=...`), sorting via `q[s]` (e.g. `created_at desc`; when no `q[s]` is supplied, the endpoint applies a stable default sort of `id desc` so pagination is deterministic), and pagination via `page`/`per` (default 25, max 100). Filtering and sorting on `original_output`/`revised_output` are not supported. Accepts any of this client's private credentials - the client's own private API key, a team member's UserClient private key, an AdminClientCredential, or the scoped, rotating key of the client's agent user (see Clients::AgentUserProvisioner) used by the change-suggestion coding agent to ground a fix in the feedback it was told to look at - but not the public key, which is write-only and cannot read. List items omit `original_output`/`revised_output` (which can each hold up to 1GB) - fetch a specific item via GET /api/v2/llm_request_log_feedbacks/{id} to get the full text and any feedback_partials. Also sets X-Total-Count/X-Page/X-Per-Page/X-Total-Pages response headers - the same pagination signal every paginated v2 endpoint exposes (see GET /api/v2/llm_request_logs); the body's `pagination` object is kept for backward compatibility, not the pattern to rely on for new integrations.

<h3 id="search-llm-request-log-feedbacks-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Any of this client's private credentials (see description)|
|Authorization|header|string|false|Bearer token with the private API key|
|q[sentiment_eq]|query|integer|false|Filter by sentiment integer code: 0 = dislike, 1 = neutral, 2 = like|
|q[workload_id_eq]|query|string|false|Filter by workload hashid (the same value rendered as each item's workload_id)|
|q[s]|query|string|false|Sort expression, e.g. 'created_at desc'|
|page|query|integer|false|Page number|
|per|query|integer|false|Records per page (default 25, max 100)|

> Example responses

> 200 Response

```json
{
  "feedback": [
    {
      "id": "string",
      "client_id": "string",
      "llm_request_log_id": "string",
      "workload_id": "string",
      "like": true,
      "sentiment": "string",
      "creator_type": "string",
      "explanation": "string",
      "llm_provider_unique_id": "string",
      "client_unique_id": "string",
      "creator_unique_id": "string",
      "collector": "string",
      "coolhand_fingerprint_id": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "content_scrubbed_at": "2019-08-24T14:15:22Z",
      "had_revised_output": true,
      "had_explanation": true
    }
  ],
  "pagination": {
    "current_page": 0,
    "per_page": 0,
    "total_count": 0,
    "total_pages": 0,
    "has_next_page": true,
    "has_prev_page": true
  }
}
```

<h3 id="search-llm-request-log-feedbacks-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|filters by workload via ransack q[workload_id_eq]|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|workload hashid does not resolve to a workload owned by this client|Inline|

<h3 id="search-llm-request-log-feedbacks-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» feedback|[object]|false|none|none|
|»» id|string|false|none|none|
|»» client_id|string|false|none|Hashid of the client that owns this feedback entry.|
|»» llm_request_log_id|string¦null|false|none|none|
|»» workload_id|string¦null|false|none|none|
|»» like|boolean¦null|false|none|none|
|»» sentiment|string¦null|false|none|none|
|»» creator_type|string¦null|false|none|none|
|»» explanation|string¦null|false|none|none|
|»» llm_provider_unique_id|string¦null|false|none|none|
|»» client_unique_id|string¦null|false|none|none|
|»» creator_unique_id|string¦null|false|none|none|
|»» collector|string¦null|false|none|none|
|»» coolhand_fingerprint_id|string¦null|false|none|none|
|»» created_at|string(date-time)|false|none|none|
|»» updated_at|string(date-time)|false|none|none|
|»» content_scrubbed_at|string(date-time)¦null|false|none|none|
|»» had_revised_output|boolean¦null|false|none|none|
|»» had_explanation|boolean¦null|false|none|none|
|» pagination|object|false|none|none|
|»» current_page|integer|false|none|none|
|»» per_page|integer|false|none|none|
|»» total_count|integer|false|none|none|
|»» total_pages|integer|false|none|none|
|»» has_next_page|boolean|false|none|none|
|»» has_prev_page|boolean|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Update LLM Request Log Feedback

<a id="opIdupdate_llm_request_log_feedback"></a>

`PATCH /api/v2/llm_request_log_feedbacks/{id}`

Updates an existing feedback entry. Only specific fields can be updated - identity fields are immutable.

**Partial Feedback Updates:**
When `partial_id` is provided in the request body, the update is applied to that specific FeedbackPartial
instead of the parent feedback. This is useful when adding explanations to partial feedback (highlighted text sections).
The response will include `updated_partial_id` to confirm which partial was updated.

**Updatable Fields (Parent Feedback) - public key:**
- **like** - Boolean like/dislike rating
- **sentiment** - Sentiment value (like/dislike/neutral)
- **explanation** - End user explanation
- **revised_output** - End user revision of the LLM response

**Updatable Fields (Parent Feedback) - private key / OAuth Bearer token:**
Everything above, plus:
- **creator_type** - Who supplied the feedback (human/agent/unknown)
- **original_output** - The original LLM response text
- **llm_provider_unique_id** - The x-request-id from the LLM API response
- **collector** - Collection method identifier
- **client_unique_id** - Your internal request identifier
- **coolhand_fingerprint_id** - Fingerprint id used for dedup/matching
- **workload_hashid** - Associate with a workload (or clear by setting to null/empty)

A public-key request that includes a private-key-only field does not error - that field is
silently ignored, and only the public-key-allowed fields in the request are applied.

**Response shape:** a public-key caller receives only the record's `id` (reading a record
back is a private-credential operation - see GET /api/v2/llm_request_log_feedbacks/{id}),
plus `warnings` and, for a partial update, `updated_partial_id` so it can be confirmed. Private key
and OAuth Bearer callers get the full payload documented below. Any field the request sent
that the credential may not write is reported back in `warnings`.

**Updatable Fields (FeedbackPartial - when partial_id is provided) - all credential types:**
- **explanation** - End user explanation for this specific partial
- **sentiment** - Sentiment value (like/dislike/neutral)
- **like** - Boolean (automatically converted to sentiment)

Partials have no `creator_type` - it is a parent-feedback field only, and is ignored here
for every credential type.

**Immutable Fields (cannot be updated):**
- creator_unique_id
- llm_request_log_id

**Note:** After a successful update, if the feedback is not already matched to a log and has original_output,
the fuzzy matching job will be re-triggered to attempt matching.

> Body parameter

```json
{
  "llm_request_log_feedback": {
    "like": true,
    "explanation": "string",
    "revised_output": "string",
    "original_output": "string",
    "llm_provider_unique_id": "string",
    "collector": "string",
    "client_unique_id": "string",
    "workload_hashid": "string",
    "partial_id": "string",
    "sentiment": "like",
    "creator_type": "human",
    "coolhand_fingerprint_id": "string"
  }
}
```

<h3 id="update-llm-request-log-feedback-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|id|path|string|true|Feedback hashid|
|X-API-Key|header|string|false|API key for authentication|
|Authorization|header|string|false|Bearer token with API key|
|body|body|object|true|none|
|» llm_request_log_feedback|body|object|false|none|
|»» like|body|boolean¦null|false|👍 Boolean like/dislike rating|
|»» explanation|body|string¦null|false|💬 End user explanation (max 5000 characters)|
|»» revised_output|body|string¦null|false|⭐ End user revision of the LLM response|
|»» original_output|body|string¦null|false|🔍 The original LLM response text. Private key / OAuth Bearer token only - silently ignored for public-key callers.|
|»» llm_provider_unique_id|body|string¦null|false|🎯 The x-request-id from the LLM API response. Private key / OAuth Bearer token only - silently ignored for public-key callers.|
|»» collector|body|string¦null|false|🏷️ Collection method identifier. Private key / OAuth Bearer token only - silently ignored for public-key callers.|
|»» client_unique_id|body|string¦null|false|🔗 Your internal request identifier. Private key / OAuth Bearer token only - silently ignored for public-key callers.|
|»» workload_hashid|body|string¦null|false|📦 Workload hashid to associate with (set to null/empty to clear). Private key / OAuth Bearer token only - silently ignored for public-key callers.|
|»» partial_id|body|string¦null|false|🎯 FeedbackPartial hashid - when provided, updates the partial feedback instead of the parent. Used to add explanations to specific highlighted sections. Get this from created_partial_id in the POST response.|
|»» sentiment|body|string¦null|false|🎭 Sentiment value for the parent feedback, or for the partial when partial_id is provided: 'like', 'dislike', or 'neutral'. Any other value is rejected with a 422.|
|»» creator_type|body|string¦null|false|👤 Who supplied the feedback. Private key / OAuth Bearer token only - silently ignored for public-key callers.|
|»» coolhand_fingerprint_id|body|string¦null|false|🔗 Fingerprint id used for dedup/matching. Private key / OAuth Bearer token only - silently ignored for public-key callers.|

#### Enumerated Values

|Parameter|Value|
|---|---|
|»» sentiment|like|
|»» sentiment|dislike|
|»» sentiment|neutral|
|»» creator_type|human|
|»» creator_type|agent|
|»» creator_type|unknown|

> Example responses

> 200 Response

```json
{
  "id": "string",
  "client_id": "string",
  "llm_request_log_id": "string",
  "workload_id": "string",
  "like": true,
  "sentiment": "string",
  "creator_type": "string",
  "explanation": "string",
  "revised_output": "string",
  "llm_provider_unique_id": "string",
  "original_output": "string",
  "client_unique_id": "string",
  "creator_unique_id": "string",
  "collector": "string",
  "coolhand_fingerprint_id": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "content_scrubbed_at": "2019-08-24T14:15:22Z",
  "had_revised_output": true,
  "had_explanation": true,
  "updated_partial_id": "string",
  "feedback_partials": [
    {
      "id": "string",
      "llm_request_log_feedback_id": "string",
      "client_id": "string",
      "focus_section": "string",
      "focus_range": {
        "start": 0,
        "end": 0
      },
      "sentiment": "like",
      "like": true,
      "explanation": "string",
      "creator_unique_id": "string",
      "coolhand_fingerprint_id": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ]
}
```

<h3 id="update-llm-request-log-feedback-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success - updating a partial feedback|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - invalid partial_id|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable - validation failed (e.g. unknown sentiment)|Inline|

<h3 id="update-llm-request-log-feedback-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|Parent feedback hashid|
|» client_id|string|false|none|Hashid of the client that owns this feedback entry.|
|» llm_request_log_id|string¦null|false|none|none|
|» workload_id|string¦null|false|none|none|
|» like|boolean¦null|false|none|none|
|» sentiment|string¦null|false|none|none|
|» creator_type|string¦null|false|none|none|
|» explanation|string¦null|false|none|none|
|» revised_output|string¦null|false|none|none|
|» llm_provider_unique_id|string¦null|false|none|none|
|» original_output|string¦null|false|none|none|
|» client_unique_id|string¦null|false|none|none|
|» creator_unique_id|string¦null|false|none|none|
|» collector|string¦null|false|none|none|
|» coolhand_fingerprint_id|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» content_scrubbed_at|string(date-time)¦null|false|none|none|
|» had_revised_output|boolean¦null|false|none|none|
|» had_explanation|boolean¦null|false|none|none|
|» updated_partial_id|string¦null|false|none|Hashid of the partial that was updated|
|» feedback_partials|[object]¦null|false|none|Array of feedback partials attached to this parent|
|»» id|string|false|none|FeedbackPartial hashid|
|»» llm_request_log_feedback_id|string|false|none|Parent feedback hashid|
|»» client_id|string|false|none|Hashid of the client (delegated from the parent).|
|»» focus_section|string|false|none|The highlighted text section|
|»» focus_range|object¦null|false|none|none|
|»»» start|integer|false|none|none|
|»»» end|integer|false|none|none|
|»» sentiment|string¦null|false|none|none|
|»» like|boolean¦null|false|none|none|
|»» explanation|string¦null|false|none|none|
|»» creator_unique_id|string¦null|false|none|none|
|»» coolhand_fingerprint_id|string¦null|false|none|none|
|»» created_at|string(date-time)|false|none|none|
|»» updated_at|string(date-time)|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|sentiment|like|
|sentiment|dislike|
|sentiment|neutral|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|true|none|Validation messages keyed by field name|
|»» **additionalProperties**|[string]|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
publicApiKey, privateApiKey, bearerAuth
</aside>

## Get LLM Request Log Feedback

<a id="opIdget_llm_request_log_feedback"></a>

`GET /api/v2/llm_request_log_feedbacks/{id}`

Fetches a single feedback entry by hashid, including original_output, revised_output, and any feedback_partials - the full record that GET /api/v2/llm_request_log_feedbacks omits from list results. Accepts any of this client's private credentials - the client's own private API key, a team member's UserClient private key, an AdminClientCredential, or the scoped, rotating key of the client's agent user (see Clients::AgentUserProvisioner) used by the change-suggestion coding agent to ground a fix in the feedback it was told to look at - but not the public key, which is write-only and cannot read.

<h3 id="get-llm-request-log-feedback-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|id|path|string|true|Feedback hashid|
|X-API-Key|header|string|false|Any of this client's private credentials (see description)|
|Authorization|header|string|false|Bearer token with the private API key|

> Example responses

> 200 Response

```json
{
  "id": "string",
  "client_id": "string",
  "llm_request_log_id": "string",
  "workload_id": "string",
  "like": true,
  "sentiment": "string",
  "creator_type": "string",
  "explanation": "string",
  "original_output": "string",
  "revised_output": "string",
  "llm_provider_unique_id": "string",
  "client_unique_id": "string",
  "creator_unique_id": "string",
  "collector": "string",
  "coolhand_fingerprint_id": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "content_scrubbed_at": "2019-08-24T14:15:22Z",
  "had_revised_output": true,
  "had_explanation": true,
  "feedback_partials": [
    {
      "id": "string",
      "llm_request_log_feedback_id": "string",
      "client_id": "string",
      "focus_section": "string",
      "focus_range": {
        "start": 0,
        "end": 0
      },
      "sentiment": "like",
      "like": true,
      "explanation": "string",
      "creator_unique_id": "string",
      "coolhand_fingerprint_id": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ]
}
```

<h3 id="get-llm-request-log-feedback-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - public (write-only) key cannot read|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - belongs to another client|Inline|

<h3 id="get-llm-request-log-feedback-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» client_id|string|false|none|Hashid of the client that owns this feedback entry.|
|» llm_request_log_id|string¦null|false|none|none|
|» workload_id|string¦null|false|none|none|
|» like|boolean¦null|false|none|none|
|» sentiment|string¦null|false|none|none|
|» creator_type|string¦null|false|none|none|
|» explanation|string¦null|false|none|none|
|» original_output|string¦null|false|none|none|
|» revised_output|string¦null|false|none|none|
|» llm_provider_unique_id|string¦null|false|none|none|
|» client_unique_id|string¦null|false|none|none|
|» creator_unique_id|string¦null|false|none|none|
|» collector|string¦null|false|none|none|
|» coolhand_fingerprint_id|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» content_scrubbed_at|string(date-time)¦null|false|none|none|
|» had_revised_output|boolean¦null|false|none|none|
|» had_explanation|boolean¦null|false|none|none|
|» feedback_partials|[object]|false|none|none|
|»» id|string|false|none|none|
|»» llm_request_log_feedback_id|string|false|none|none|
|»» client_id|string|false|none|Hashid of the client (delegated from the parent).|
|»» focus_section|string¦null|false|none|none|
|»» focus_range|object¦null|false|none|none|
|»»» start|integer|false|none|none|
|»»» end|integer|false|none|none|
|»» sentiment|string¦null|false|none|none|
|»» like|boolean¦null|false|none|none|
|»» explanation|string¦null|false|none|none|
|»» creator_unique_id|string¦null|false|none|none|
|»» coolhand_fingerprint_id|string¦null|false|none|none|
|»» created_at|string(date-time)|false|none|none|
|»» updated_at|string(date-time)|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|sentiment|like|
|sentiment|dislike|
|sentiment|neutral|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-llm-request-logs">LLM Request Logs</h1>

API endpoints for logging and storing LLM (Large Language Model) request/response data

## Create LLM Request Log

<a id="opIdcreate_llm_request_log"></a>

`POST /api/v2/llm_request_logs`

Creates a new LLM request log entry for monitoring and analysis purposes. See the [Understanding an LLM Request Log](/guides/log_fields) guide for a full description of the fields Coolhand captures, which fields each provider exposes, and common gotchas. `id` is the log's hashid (a string), not the internal integer primary key — every log identifier returned by this API is a hashid, matching the `GET` endpoints below; consumers that previously parsed `id` as an integer need to treat it as an opaque string instead. A request made with the public API key is capped at 10MB for the whole request body (413 above that) and 255 characters for `collector` (422 above that); private keys are not capped.

> Body parameter

```json
{
  "llm_request_log": {
    "raw_request": {},
    "collector": "string",
    "metadata": {},
    "declared": {
      "reporter": "string",
      "workload": {
        "id": "string",
        "key": "string",
        "name": "string",
        "description": "string"
      },
      "template": {
        "id": "string",
        "key": "string",
        "name": "string"
      }
    }
  }
}
```

<h3 id="create-llm-request-log-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|API key for authentication|
|Authorization|header|string|false|Bearer token with API key|
|body|body|object|true|none|
|» llm_request_log|body|object|true|none|
|»» raw_request|body|object|true|Complete raw request data in JSON format|
|»» collector|body|string¦null|false|Optional name/stamp identifying the collection method|
|»» metadata|body|object|false|Optional free-form client-supplied context, e.g. { "project_path": "/Users/me/my-project" }. See the log fields guide for conventions.|
|»» declared|body|object|false|Optional. Names the workload and template this call belongs to, so Coolhand attaches the log to them directly and skips template matching. Give `id` (the hashid of an existing record) or `key` (a stable identifier you choose; the record is created the first time it is seen). `id` wins over `key`. `name` and `description` are used only when a record is created — rename later with `PUT /api/v2/workloads/by_key/{external_key}`. A workload with no template gets a default one. An unknown or foreign `id` returns 422. With the public API key the number of declared workloads and templates per client is capped; over the cap the declaration is ignored and a warning is returned.|
|»»» reporter|body|string|false|Tool that reported the declaration, e.g. "squishling"|
|»»» workload|body|object|false|none|
|»»»» id|body|string|false|Hashid of an existing workload|
|»»»» key|body|string|false|Stable identifier, at most 255 characters|
|»»»» name|body|string|false|none|
|»»»» description|body|string|false|none|
|»»» template|body|object|false|none|
|»»»» id|body|string|false|Hashid of an existing template|
|»»»» key|body|string|false|Stable identifier, at most 255 characters|
|»»»» name|body|string|false|none|

> Example responses

> 201 Response

```json
{
  "id": "string",
  "collector": "string",
  "source_api": "string",
  "source_application": "string",
  "metadata": {},
  "source_api_result": "string",
  "stream_incomplete": true,
  "model": "string",
  "template_id": "string",
  "template_name": "string",
  "input_tokens": 0,
  "output_tokens": 0,
  "latency_ms": 0,
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "content_scrubbed_at": "2019-08-24T14:15:22Z",
  "message_count": 0,
  "user_message_count": 0,
  "ingest_evidence": {},
  "warnings": [
    "string"
  ]
}
```

<h3 id="create-llm-request-log-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success with a declared workload and template|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - agent-scoped credential cannot ingest new logs|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - invalid JSON in raw_request|Inline|

<h3 id="create-llm-request-log-responseschema">Response Schema</h3>

Status Code **201**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» collector|string¦null|false|none|none|
|» source_api|string¦null|false|none|none|
|» source_application|string¦null|false|none|none|
|» metadata|object|false|none|none|
|» source_api_result|string¦null|false|none|none|
|» stream_incomplete|boolean|false|none|none|
|» model|string¦null|false|none|none|
|» template_id|string¦null|false|none|none|
|» template_name|string¦null|false|none|none|
|» input_tokens|integer¦null|false|none|none|
|» output_tokens|integer¦null|false|none|none|
|» latency_ms|integer¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» content_scrubbed_at|string(date-time)¦null|false|none|none|
|» message_count|integer¦null|false|none|none|
|» user_message_count|integer¦null|false|none|none|
|» ingest_evidence|object|false|none|none|
|» warnings|[string]¦null|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
publicApiKey, privateApiKey, bearerAuth
</aside>

## List LLM Request Logs

<a id="opIdlist_llm_request_logs"></a>

`GET /api/v2/llm_request_logs`

Returns this client's LLM request logs as a bare JSON array (unlike GET /api/v2/llm_request_log_feedbacks's `{ feedback:, pagination: }` envelope - coolhand-cli's fetchLastSync relies on this response being `Array.isArray`, so the body shape is intentionally not wrapped). Pagination totals are exposed via `X-Page`/`X-Per-Page` response headers, plus `X-Total-Count`/`X-Total-Pages` when `include_total=true` is passed (omitted by default to skip the COUNT(*) query - analyze-claude-sessions's frequent per=1 dedup-cutoff poll never needs a total). Supports Ransack search via `q[...]` params (e.g. `q[source_api_in][]=claude_code`), sorting via `q[s]` (e.g. `created_at desc` for newest first; when no `q[s]` is supplied, the endpoint applies a stable default sort of `id desc` for newest first so pagination is deterministic - pass `q[s]` explicitly to override), and pagination via `page`/`per` (`per_page` also accepted; default 25, max 100). Requires the private API key - the public key is write-only and cannot read. `id` is always the log's hashid (not the internal integer PK) - the sort itself still orders by the real primary key internally, but a cutoff/cursor derived from results should key off `created_at`, not `id`, since hashids don't sort lexically in creation order. analyze-claude-sessions uses this to derive its dedup cutoff by requesting the newest claude_code/claude_cowork record (per=1), instead of a bespoke endpoint. Also supports named filters (applied on top of any q[...] filtering, not in place of it): template_id/workload_id (hashid), system_prompt_contains/user_prompt_contains/error_contains (case-insensitive substring), model, source_api, source_api_result, project_path (exact match against metadata.project_path), unmatched_only, days_back (unset by default - unlike search_logs's MCP tool, index has always returned unrestricted results and does not implicitly apply a 30-day window), and include_prompts (adds system_prompt/user_prompt, truncated to 500 chars, to each result). Every result carries `cost` (USD, priced by the same SQL as the dashboard's cost figures, so tiered pricing, cached-token discounts and reasoning tokens are applied; null when the log has no tokens or its model has no pricing). `since`/`until` (ISO8601; `since` inclusive, `until` exclusive; a missing offset means UTC and a `+` offset must be URL-encoded) bound `created_at` and replace `days_back` when either is given. `min_cost` (USD) keeps only logs whose `cost` is at least that, and `order=cost_desc` sorts by `cost`, highest first (replacing any `q[s]` sort); both are limited to logs that can be priced (those with a non-null `cost`), failed requests included, unlike the metrics' cost totals. On a client with a lot of history, combine `min_cost`/`order=cost_desc` with `since` or `days_back`: the cost is computed per log, so an unbounded query can time out (504). A malformed value for any of them returns 422.

<h3 id="list-llm-request-logs-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|Authorization|header|string|false|Bearer token with the private API key|
|q[source_api_in][]|query|array[string]|false|Filter to these source_api values (Ransack in-predicate)|
|q[s]|query|string|false|Sort expression, e.g. 'created_at desc'|
|page|query|integer|false|Page number|
|per|query|integer|false|Records per page (default 25, max 100; per_page also accepted)|
|per_page|query|integer|false|Alias for per, matching search_logs's MCP tool param name (same 25/100 bounds)|
|template_id|query|string|false|Filter by template hashid|
|workload_id|query|string|false|Filter by workload hashid (matches all templates in that workload)|
|system_prompt_contains|query|string|false|Case-insensitive substring to match in the system prompt|
|user_prompt_contains|query|string|false|Case-insensitive substring to match in the user prompt|
|error_contains|query|string|false|Case-insensitive substring to match in the failed request's error text|
|model|query|string|false|Filter by model name|
|source_api|query|string|false|Filter by source API (e.g. 'openai', 'anthropic', 'vertex')|
|source_api_result|query|string|false|Filter by result status: success, failed, operational, unmatched|
|source_application|query|string|false|Filter by exact source_application|
|project_path|query|string|false|Filter by exact match against metadata.project_path|
|unmatched_only|query|boolean|false|Only return logs with no assigned template|
|days_back|query|integer|false|Limit to logs created in the last N days (max 36500; no default - unrestricted unless given; ignored when since is given; with only until, the window is days_back long ending at until)|
|since|query|string(date-time)|false|ISO8601 lower bound (inclusive) on created_at. A date alone or a timestamp without an offset is UTC; encode a `+` offset as `%2B`|
|until|query|string(date-time)|false|ISO8601 upper bound (exclusive) on created_at; must be after since. With only until, days_back (if given) sets how far back the window starts|
|min_cost|query|number|false|Only logs whose per-log `cost` (USD) is at least this (0 to 1000000); unpriceable logs are excluded, priceable failed ones are not|
|order|query|string|false|`cost_desc` sorts by per-log `cost`, highest first (priceable logs only), replacing any q[s] sort|
|include_prompts|query|boolean|false|Include truncated system_prompt/user_prompt in each result|
|include_total|query|boolean|false|Include X-Total-Count/X-Total-Pages response headers (default: false, to skip the COUNT(*) query on this frequently-polled endpoint)|

#### Enumerated Values

|Parameter|Value|
|---|---|
|order|cost_desc|

> Example responses

> 200 Response

```json
[
  {
    "id": "string",
    "collector": "string",
    "source_api": "string",
    "source_application": "string",
    "metadata": {},
    "source_api_result": "string",
    "stream_incomplete": true,
    "model": "string",
    "template_id": "string",
    "template_name": "string",
    "input_tokens": 0,
    "output_tokens": 0,
    "latency_ms": 0,
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z",
    "content_scrubbed_at": "2019-08-24T14:15:22Z",
    "message_count": 0,
    "user_message_count": 0,
    "ingest_evidence": {},
    "cost": 0,
    "system_prompt": "string",
    "user_prompt": "string"
  }
]
```

<h3 id="list-llm-request-logs-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|returns only this client's logs for a human team member's UserClient key|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - days_back is not a positive integer|Inline|
|504|[Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5)|gateway timeout - the search exceeded the statement timeout|Inline|

<h3 id="list-llm-request-logs-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|true|none|none|
|» collector|string¦null|true|none|none|
|» source_api|string¦null|true|none|none|
|» source_application|string¦null|true|none|none|
|» metadata|object|true|none|none|
|» source_api_result|string¦null|true|none|none|
|» stream_incomplete|boolean|true|none|none|
|» model|string¦null|true|none|none|
|» template_id|string¦null|true|none|none|
|» template_name|string¦null|true|none|none|
|» input_tokens|integer¦null|true|none|none|
|» output_tokens|integer¦null|true|none|none|
|» latency_ms|integer¦null|true|none|none|
|» created_at|string(date-time)|true|none|none|
|» updated_at|string(date-time)|true|none|none|
|» content_scrubbed_at|string(date-time)¦null|true|none|none|
|» message_count|integer¦null|true|none|none|
|» user_message_count|integer¦null|true|none|none|
|» ingest_evidence|object|true|none|none|
|» cost|number¦null|true|none|none|
|» system_prompt|string¦null|false|none|none|
|» user_prompt|string¦null|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **504**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Summarize Failed LLM Request Logs

<a id="opIdsummarize_failed_llm_request_logs"></a>

`GET /api/v2/llm_request_logs/failure_summary`

Rolls this client's recent failed requests up by error pattern (error text and `source_api`) and by template, and sorts each pattern into whose problem it is: `client_error` (a 4xx the caller can fix), `rate_limit` (429), `server_error` (5xx), `provider_error` (no HTTP status) or `relayed_upstream` (an upstream vendor's account or key error surfaced through a relay such as typesafe). Failures inside a confirmed provider outage are left out and counted in `provider_outage_excluded_count`. Only directly-collected logs whose content has not been removed by retention are counted. `error_breakdown` lists the 50 most frequent patterns; the totals and `actionable_summary` count every pattern. Each pattern carries up to three example log ids; pass a pattern's text as `error_contains` to `GET /api/v2/llm_request_logs` to list its logs. Requires a private key; the public key and the agent-scoped credential are rejected.

<h3 id="summarize-failed-llm-request-logs-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|Authorization|header|string|false|Bearer token with the private API key|
|days_back|query|integer|false|Number of days to look back (default 7, max 36500)|

> Example responses

> 200 Response

```json
{
  "client_id": "string",
  "client_name": "string",
  "days_analyzed": 0,
  "total_failed_count": 0,
  "provider_outage_excluded_count": 0,
  "error_breakdown": [
    {
      "error_pattern": "string",
      "source_api": "string",
      "count": 0,
      "first_seen_at": "2019-08-24T14:15:22Z",
      "last_seen_at": "2019-08-24T14:15:22Z",
      "category": "client_error",
      "example_error_details": "string",
      "example_log_ids": [
        "string"
      ],
      "example_log_urls": [
        "string"
      ]
    }
  ],
  "by_template": [
    {
      "template_id": "string",
      "template_name": "string",
      "failed_count": 0,
      "error_patterns": [
        {}
      ],
      "example_log_ids": [
        "string"
      ],
      "example_log_urls": [
        "string"
      ]
    }
  ],
  "actionable_summary": {
    "client_fixable_count": 0,
    "server_side_count": 0
  }
}
```

<h3 id="summarize-failed-llm-request-logs-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|summarizes this client's failed logs|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable - days_back must be positive|Inline|
|504|[Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5)|gateway timeout - the summary took too long|Inline|

<h3 id="summarize-failed-llm-request-logs-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» client_id|string|true|none|none|
|» client_name|string|true|none|none|
|» days_analyzed|integer|true|none|none|
|» total_failed_count|integer|true|none|none|
|» provider_outage_excluded_count|integer|true|none|none|
|» error_breakdown|[object]|true|none|none|
|»» error_pattern|string|false|none|none|
|»» source_api|string¦null|false|none|none|
|»» count|integer|false|none|none|
|»» first_seen_at|string(date-time)|false|none|none|
|»» last_seen_at|string(date-time)|false|none|none|
|»» category|string|false|none|none|
|»» example_error_details|string|false|none|none|
|»» example_log_ids|[string]|false|none|none|
|»» example_log_urls|[string]|false|none|none|
|» by_template|[object]|true|none|none|
|»» template_id|string¦null|false|none|none|
|»» template_name|string|false|none|none|
|»» failed_count|integer|false|none|none|
|»» error_patterns|[object]|false|none|none|
|»» example_log_ids|[string]|false|none|none|
|»» example_log_urls|[string]|false|none|none|
|» actionable_summary|object|true|none|none|
|»» client_fixable_count|integer|false|none|none|
|»» server_side_count|integer|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|category|client_error|
|category|rate_limit|
|category|server_error|
|category|provider_error|
|category|relayed_upstream|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **504**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Get LLM Request Log Content

<a id="opIdget_llm_request_log_content"></a>

`GET /api/v2/llm_request_logs/{id}`

Fetches full input/output content for a single log by its ID (hashid). Accepts any of this client's private credentials: the client's own private API key, a team member's UserClient private key, an AdminClientCredential, or the scoped, rotating key of the client's agent user (see Clients::AgentUserProvisioner) used by the change-suggestion coding agent to ground a fix in the log it was told to look at. Supports section/max_chars for large logs and search_query for snippet search. Only directly-collected logs are fetchable here (matching index's `.client_logs` restriction) - internally generated records (evals, synthetic logs) 404 even when the hashid is known.

<h3 id="get-llm-request-log-content-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|id|path|string|true|Log hashid|
|X-API-Key|header|string|false|Any of this client's private credentials (see description)|
|section|query|string|false|full, beginning, or end (default: full)|
|max_chars|query|integer|false|Maximum characters to return per content field|
|search_query|query|string|false|Text to search for within the log content|
|include_thinking|query|boolean|false|Include thinking/reasoning response content (default: false)|
|include_turn_metrics|query|boolean|false|Include `turn_metrics`, the per-turn breakdown of a captured agent session: one entry per user message with `human`, `assistant_requests`, `tool_calls`, token sums and timestamps (default: false). `null` for logs that are not captured sessions. It holds no content, so it is still returned after the content scrub.|

> Example responses

> 200 Response

```json
{
  "id": "string",
  "url": "string",
  "collector": "string",
  "metadata": {},
  "model": "string",
  "source_api": "string",
  "source_application": "string",
  "source_api_result": "string",
  "stream_incomplete": true,
  "template_id": "string",
  "template_name": "string",
  "input_tokens": 0,
  "output_tokens": 0,
  "latency_ms": 0,
  "cost": 0,
  "cost_breakdown": {
    "total_cost": 0,
    "input_cost": 0,
    "output_cost": 0,
    "cached_input_cost": 0,
    "cache_creation_input_cost": 0,
    "reasoning_output_cost": 0
  },
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "content_scrubbed_at": "2019-08-24T14:15:22Z",
  "message_count": 0,
  "user_message_count": 0,
  "ingest_evidence": {},
  "system_prompt": "string",
  "user_prompt": "string",
  "output": "string",
  "truncated": true,
  "total_chars": {
    "system_prompt": 0,
    "user_prompt": 0,
    "output": 0
  },
  "search_query": "string",
  "matches": {
    "system_prompt": [
      "string"
    ],
    "user_prompt": [
      "string"
    ],
    "output": [
      "string"
    ]
  },
  "thinking_response": [
    "string"
  ],
  "turn_metrics": [
    {
      "index": 0,
      "human": true,
      "started_at": "string",
      "ended_at": "string",
      "assistant_requests": 0,
      "tool_calls": 0,
      "input_tokens": 0,
      "output_tokens": 0,
      "cache_read_tokens": 0,
      "cache_creation_tokens": 0
    }
  ]
}
```

<h3 id="get-llm-request-log-content-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success with a human team member's UserClient key|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - public (write-only) key cannot read|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - log is internally generated (bakeoff_comp), not a customer-facing record|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - max_chars is not a positive integer|Inline|

<h3 id="get-llm-request-log-content-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» url|string|false|none|none|
|» collector|string¦null|false|none|none|
|» metadata|object|false|none|none|
|» model|string¦null|false|none|none|
|» source_api|string¦null|false|none|none|
|» source_application|string¦null|false|none|none|
|» source_api_result|string¦null|false|none|none|
|» stream_incomplete|boolean|false|none|none|
|» template_id|string¦null|false|none|none|
|» template_name|string¦null|false|none|none|
|» input_tokens|integer¦null|false|none|none|
|» output_tokens|integer¦null|false|none|none|
|» latency_ms|integer¦null|false|none|none|
|» cost|number¦null|false|none|none|
|» cost_breakdown|object¦null|false|none|none|
|»» total_cost|number|false|none|none|
|»» input_cost|number|false|none|none|
|»» output_cost|number|false|none|none|
|»» cached_input_cost|number|false|none|none|
|»» cache_creation_input_cost|number|false|none|none|
|»» reasoning_output_cost|number|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» content_scrubbed_at|string(date-time)¦null|false|none|none|
|» message_count|integer¦null|false|none|none|
|» user_message_count|integer¦null|false|none|none|
|» ingest_evidence|object|false|none|none|
|» system_prompt|string¦null|false|none|none|
|» user_prompt|string¦null|false|none|none|
|» output|string¦null|false|none|none|
|» truncated|boolean|false|none|none|
|» total_chars|object|false|none|none|
|»» system_prompt|integer|false|none|none|
|»» user_prompt|integer|false|none|none|
|»» output|integer|false|none|none|
|» search_query|string|false|none|none|
|» matches|object|false|none|none|
|»» system_prompt|[string]|false|none|none|
|»» user_prompt|[string]|false|none|none|
|»» output|[string]|false|none|none|
|» thinking_response|[string]¦null|false|none|none|
|» turn_metrics|[object]¦null|false|none|none|
|»» index|integer|false|none|none|
|»» human|boolean|false|none|none|
|»» started_at|string¦null|false|none|none|
|»» ended_at|string¦null|false|none|none|
|»» assistant_requests|integer|false|none|none|
|»» tool_calls|integer|false|none|none|
|»» input_tokens|integer¦null|false|none|none|
|»» output_tokens|integer¦null|false|none|none|
|»» cache_read_tokens|integer¦null|false|none|none|
|»» cache_creation_tokens|integer¦null|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-llm-request-templates">LLM Request Templates</h1>

Read-only API endpoints for listing, searching and inspecting the prompt templates an LLM request log is matched against. Template mutation stays on the MCP surface.

## List LLM Request Templates

<a id="opIdlist_llm_request_templates"></a>

`GET /api/v2/llm_request_templates`

Returns this client's LLM request templates as a bare JSON array (the same body shape as
GET /api/v2/llm_request_logs, not the `{ feedback:, pagination: }` envelope used by
GET /api/v2/llm_request_log_feedbacks). Pagination metadata is always exposed via the
`X-Page`, `X-Per-Page`, `X-Total-Count` and `X-Total-Pages` response headers — unlike
/llm_request_logs, this endpoint has no `include_total` opt-out, because a client's
template count is small enough that counting the templates themselves is cheap.

**`log_count` is the expensive part of this response, not the pagination total.** It
aggregates over `llm_request_logs`, so its cost scales with how many logs the matched
templates hold rather than with how many templates come back — the `Unmatched` bucket
reached via `include_system=true` can hold every log that never matched a template.

**The 10-second guard is per *statement*, not per response — read this before sizing a
client timeout.** `#index` issues three statements inside it (the page load, the
pagination `COUNT`, and the grouped log count), and Postgres applies `statement_timeout`
to each one independently. Database time for a single response can therefore reach three
times that figure before anything is cancelled, and a `504` here means *one query*
exceeded 10 seconds — never that the response as a whole did. **Total response time is
not bounded by this endpoint.** Do not treat the absence of a `504` as evidence a
response was fast, and do not derive a client timeout from the 10-second number: size it
from observed end-to-end latency instead. Narrow with `workload_id`, `search`, or a
smaller `per` if you do hit a `504`.

`log_count` counts only directly-collected client logs — the same records
`GET /api/v2/llm_request_logs?template_id=…` returns — so the two numbers agree.
Internally generated records (evals, bakeoff comparisons, synthetic logs) are excluded,
which is why this can be lower than the count the `search_templates` MCP tool reports.

The client is always derived from the authenticating API key. There is no `client_id`
parameter and one cannot be supplied.

Requires the **private** API key — the public key is write-only and cannot read data back.

Results are ordered newest first (`created_at DESC`, with the internal primary key as a
tiebreaker so paging is deterministic when two templates share a timestamp).

**Prompt patterns are not included by default.** Pass `include_patterns=true` to add
`user_prompt_pattern` / `system_prompt_pattern` to every row, or fetch a single template
via `GET /api/v2/llm_request_templates/{id}`.

**System templates.** Every client has two system buckets, `Unmatched` and
`Ignored API Calls` (`LlmRequestTemplate::SYSTEM_TEMPLATE_NAMES`), created automatically
with the client. They are excluded from this list by default and returned when
`include_system=true` is passed — the `Unmatched` bucket is what you inspect when logs
are misrouting. Each row carries a `system_template` boolean so callers do not have to
match on names.

**Deprecated templates** are excluded by default and returned when
`include_deprecated=true` is passed. A deprecated row is identifiable by a non-null
`deprecated_at`. (The originating issue called this filter `deprecated`; it is named
`include_deprecated` here to match both `include_system` above and the existing
`search_templates` MCP parameter, and because `deprecated=true` would be ambiguous
between "only deprecated" and "also deprecated".)

**Archived workloads are not filtered out by default**, so the list agrees with
`GET /api/v2/llm_request_templates/{id}`, which can always fetch such a template by id.
Pass `include_archived=false` to hide templates whose workload has been archived (what the
`search_templates` MCP tool does by default).

**Metrics.** Pass `include_metrics=true` to add a `metrics` object to every row: the same
cost and performance numbers the dashboard's template table shows, computed by the same
SQL (`LlmCostSql`, so tiered pricing, cached-token discounts and reasoning tokens are
applied) in a fixed number of grouped queries for the whole page. Averages cover
non-failed directly-collected client logs inside the `days_back` window (default 28, the
dashboard's window, max 365); `request_count` and `error_rate` cover the same window;
`first_request_at`/`last_request_at` are lifetime; `sentiment_score` and
`revision_score` are all-time, as on the dashboard. `avg_cost_per_request` is null when no
log in the window could be priced. Metrics add one more set of aggregate statements to the
response, so expect it to be slower on a large page.

**Window.** `days_back` is a rolling lookback ending now. Pass `since` and/or `until`
(ISO8601; a missing offset means UTC, and a `+` offset must be URL-encoded as `%2B`)
for an explicit window instead: `since` is inclusive, `until` exclusive and defaulting to
now, and when `since` is given `days_back` is ignored and returned as null. With only
`until`, the window is `days_back` long ending there. The prior window behind
`error_rate_change` is the same length, immediately before the window. The resolved
bounds come back as `metrics.since`/`metrics.until`. A malformed timestamp, `since` not
before `until`, or a window over 365 days returns 422.

Additional counters over the same window, priced with the same cost expression as the dashboard:
`failure_count` (failed logs; `error_rate` is null when it is 0), `total_input_tokens`/
`total_output_tokens` (sums of the `input_tokens`/`output_tokens` columns over non-failed
logs), `priced_request_count` (non-failed logs with tokens whose model has pricing, i.e.
the logs `total_cost` and `avg_cost_per_request` cover; this excludes failed logs and logs with a zero token count, which the per-log `cost` on `GET /api/v2/llm_request_logs` does not, so summing that `cost` can exceed `total_cost`) and `long_context_request_count`
(priced logs that crossed their model's input-token pricing tier).

**Not included in this endpoint:** template version history. `LlmRequestTemplate`
versions `user_prompt_pattern`, `system_prompt_pattern`, `name`, `status`, `workload_id`
and the deprecation fields via PaperTrail, and a `versions` sub-resource was considered
alongside these two endpoints, but it is deliberately deferred to its own change
rather than shipped here — it is a distinct resource with its own response shape and
its own disclosure surface (historical prompt patterns). Template mutation likewise
stays on the MCP surface; this REST surface is read-only.

<h3 id="list-llm-request-templates-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|Authorization|header|string|false|Bearer token with the private API key|
|search|query|string|false|Case-insensitive substring match against the template name|
|external_key|query|string|false|Only the template declared with this key|
|reporter|query|string|false|Only templates declared by this reporter, e.g. squishling|
|workload_id|query|string|false|Filter to a single workload, by workload hashid. A hashid that does not decode, or that belongs to another client, returns 422 rather than an empty list.|
|status|query|string|false|Filter by status: draft, published, failure. Any other non-empty value returns 422; an empty value is treated as no filter.|
|include_deprecated|query|boolean|false|Include deprecated templates (default: false)|
|include_system|query|boolean|false|Include the Unmatched / Ignored API Calls system templates (default: false)|
|include_archived|query|boolean|false|Include templates of archived workloads (default: true)|
|include_patterns|query|boolean|false|Include user_prompt_pattern and system_prompt_pattern on every row (default: false)|
|include_metrics|query|boolean|false|Include a `metrics` object per template — the dashboard's cost and performance numbers (default: false)|
|days_back|query|integer|false|Lookback window in days for `metrics` (default 28; larger values are clamped to 365, whereas a `since` window over 365 days is a 422). Must be a positive integer; ignored unless metrics are requested.|
|since|query|string(date-time)|false|ISO8601 start (inclusive) of the `metrics` window; overrides `days_back`. A date alone or a timestamp without an offset is UTC; encode a `+` offset as `%2B`. Ignored unless metrics are requested.|
|until|query|string(date-time)|false|ISO8601 end (exclusive) of the `metrics` window (default: now), same formats as `since`. Ignored unless metrics are requested.|
|page|query|integer|false|Page number|
|per|query|integer|false|Records per page (default 25, max 100; per_page also accepted)|
|per_page|query|integer|false|Alias for per, matching search_templates's MCP param name (same 25/100 bounds)|

#### Enumerated Values

|Parameter|Value|
|---|---|
|status|draft|
|status|published|
|status|failure|

> Example responses

> 200 Response

```json
[
  {
    "id": "string",
    "name": "string",
    "external_key": "string",
    "reporter": "string",
    "status": "string",
    "version": "string",
    "group": "string",
    "workload_id": "string",
    "workload_name": "string",
    "system_template": true,
    "deprecated_at": "2019-08-24T14:15:22Z",
    "log_count": 0,
    "source_repository": "string",
    "source_file_path": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z",
    "metrics": {
      "days_back": 0,
      "since": "2019-08-24T14:15:22Z",
      "until": "2019-08-24T14:15:22Z",
      "request_count": 0,
      "failure_count": 0,
      "error_rate": 0,
      "error_rate_change": 0,
      "avg_cost_per_request": 0,
      "total_cost": 0,
      "priced_request_count": 0,
      "long_context_request_count": 0,
      "total_input_tokens": 0,
      "total_output_tokens": 0,
      "avg_input_tokens": 0,
      "avg_output_tokens": 0,
      "avg_latency_ms": 0,
      "correctness_score": 0,
      "sentiment_score": 0,
      "revision_score": 0,
      "first_request_at": "2019-08-24T14:15:22Z",
      "last_request_at": "2019-08-24T14:15:22Z"
    },
    "user_prompt_pattern": "string",
    "system_prompt_pattern": "string"
  }
]
```

<h3 id="list-llm-request-templates-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|returns this client's templates, newest first, with pagination headers|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - unrecognized status (also returned for an unknown workload_id)|Inline|
|504|[Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5)|gateway timeout - the log-count aggregate exceeded the statement timeout|Inline|

<h3 id="list-llm-request-templates-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» name|string|false|none|none|
|» external_key|string¦null|false|none|none|
|» reporter|string¦null|false|none|none|
|» status|string¦null|false|none|none|
|» version|string¦null|false|none|none|
|» group|string¦null|false|none|none|
|» workload_id|string|false|none|none|
|» workload_name|string|false|none|none|
|» system_template|boolean|false|none|none|
|» deprecated_at|string(date-time)¦null|false|none|none|
|» log_count|integer|false|none|none|
|» source_repository|string¦null|false|none|none|
|» source_file_path|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» metrics|object|false|none|none|
|»» days_back|integer¦null|true|none|none|
|»» since|string(date-time)|true|none|none|
|»» until|string(date-time)|true|none|none|
|»» request_count|integer|true|none|none|
|»» failure_count|integer|true|none|none|
|»» error_rate|number¦null|true|none|none|
|»» error_rate_change|number¦null|true|none|none|
|»» avg_cost_per_request|number¦null|true|none|none|
|»» total_cost|number¦null|true|none|none|
|»» priced_request_count|integer|true|none|none|
|»» long_context_request_count|integer|true|none|none|
|»» total_input_tokens|integer|true|none|none|
|»» total_output_tokens|integer|true|none|none|
|»» avg_input_tokens|integer¦null|true|none|none|
|»» avg_output_tokens|integer¦null|true|none|none|
|»» avg_latency_ms|number¦null|true|none|none|
|»» correctness_score|number¦null|true|none|none|
|»» sentiment_score|number¦null|true|none|none|
|»» revision_score|number¦null|true|none|none|
|»» first_request_at|string(date-time)¦null|true|none|none|
|»» last_request_at|string(date-time)¦null|true|none|none|
|» user_prompt_pattern|string¦null|false|none|none|
|» system_prompt_pattern|string¦null|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **504**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Show LLM Request Template

<a id="opIdshow_llm_request_template"></a>

`GET /api/v2/llm_request_templates/{id}`

Returns a single template belonging to the authenticating client, including
`user_prompt_pattern` and `system_prompt_pattern` — the full untruncated regexes, which
the list endpoint omits.

Unlike the list endpoint, this action applies no default filtering beyond client
ownership: a deprecated template or a system template (`Unmatched`,
`Ignored API Calls`) is reachable by id without any opt-in flag, because inspecting one
of those is the usual reason to fetch a template directly.

A template belonging to another client returns 404, not 403 — its existence is not
disclosed.

As on the list endpoint, `log_count` is the expensive part: it aggregates over
`llm_request_logs`, and fetching the `Unmatched` bucket by id counts every log that never
matched a template. That count is the one statement bounded by the 10-second
`statement_timeout`, so on this action the guard does correspond to a single query — but
it still bounds only that query, not the whole response (the record lookup and
authentication run outside it). A `504` means the count exceeded 10 seconds. See the list
endpoint for why total response time is not bounded either. `log_count` counts only
directly-collected client logs, matching
`GET /api/v2/llm_request_logs?template_id=…`.

Always includes a `metrics` object — the same cost and performance numbers the dashboard
shows for this template (see the list endpoint for the exact definitions). `days_back`
sets its lookback window (default 28, the dashboard's window; max 365); `since`/`until`
set an explicit window instead, exactly as on the list endpoint.

Requires the **private** API key.

<h3 id="show-llm-request-template-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|Authorization|header|string|false|Bearer token with the private API key|
|include_metrics|query|boolean|false|Include the `metrics` object (default: true); false omits it and skips window validation|
|days_back|query|integer|false|Lookback window in days for `metrics` (default 28, max 365)|
|since|query|string(date-time)|false|ISO8601 start (inclusive) of the `metrics` window; overrides `days_back`. A date alone or a timestamp without an offset is UTC; encode a `+` offset as `%2B`. Ignored unless metrics are requested.|
|until|query|string(date-time)|false|ISO8601 end (exclusive) of the `metrics` window (default: now), same formats as `since`. Ignored unless metrics are requested.|
|id|path|string|true|Template hashid (the `id` returned by the list endpoint)|

> Example responses

> 200 Response

```json
{
  "id": "string",
  "name": "string",
  "external_key": "string",
  "reporter": "string",
  "status": "string",
  "version": "string",
  "group": "string",
  "workload_id": "string",
  "workload_name": "string",
  "system_template": true,
  "deprecated_at": "2019-08-24T14:15:22Z",
  "log_count": 0,
  "source_repository": "string",
  "source_file_path": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "metrics": {
    "days_back": 0,
    "since": "2019-08-24T14:15:22Z",
    "until": "2019-08-24T14:15:22Z",
    "request_count": 0,
    "failure_count": 0,
    "error_rate": 0,
    "error_rate_change": 0,
    "avg_cost_per_request": 0,
    "total_cost": 0,
    "priced_request_count": 0,
    "long_context_request_count": 0,
    "total_input_tokens": 0,
    "total_output_tokens": 0,
    "avg_input_tokens": 0,
    "avg_output_tokens": 0,
    "avg_latency_ms": 0,
    "correctness_score": 0,
    "sentiment_score": 0,
    "revision_score": 0,
    "first_request_at": "2019-08-24T14:15:22Z",
    "last_request_at": "2019-08-24T14:15:22Z"
  },
  "user_prompt_pattern": "string",
  "system_prompt_pattern": "string"
}
```

<h3 id="show-llm-request-template-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|returns the full template including both prompt patterns|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - the public API key cannot read|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - the template belongs to another client|Inline|
|504|[Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5)|gateway timeout - the log-count aggregate exceeded the statement timeout|Inline|

<h3 id="show-llm-request-template-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» name|string|false|none|none|
|» external_key|string¦null|false|none|none|
|» reporter|string¦null|false|none|none|
|» status|string¦null|false|none|none|
|» version|string¦null|false|none|none|
|» group|string¦null|false|none|none|
|» workload_id|string|false|none|none|
|» workload_name|string|false|none|none|
|» system_template|boolean|false|none|none|
|» deprecated_at|string(date-time)¦null|false|none|none|
|» log_count|integer|false|none|none|
|» source_repository|string¦null|false|none|none|
|» source_file_path|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» metrics|object|false|none|none|
|»» days_back|integer¦null|true|none|none|
|»» since|string(date-time)|true|none|none|
|»» until|string(date-time)|true|none|none|
|»» request_count|integer|true|none|none|
|»» failure_count|integer|true|none|none|
|»» error_rate|number¦null|true|none|none|
|»» error_rate_change|number¦null|true|none|none|
|»» avg_cost_per_request|number¦null|true|none|none|
|»» total_cost|number¦null|true|none|none|
|»» priced_request_count|integer|true|none|none|
|»» long_context_request_count|integer|true|none|none|
|»» total_input_tokens|integer|true|none|none|
|»» total_output_tokens|integer|true|none|none|
|»» avg_input_tokens|integer¦null|true|none|none|
|»» avg_output_tokens|integer¦null|true|none|none|
|»» avg_latency_ms|number¦null|true|none|none|
|»» correctness_score|number¦null|true|none|none|
|»» sentiment_score|number¦null|true|none|none|
|»» revision_score|number¦null|true|none|none|
|»» first_request_at|string(date-time)¦null|true|none|none|
|»» last_request_at|string(date-time)¦null|true|none|none|
|» user_prompt_pattern|string¦null|false|none|none|
|» system_prompt_pattern|string¦null|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **504**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Create or update a Template by key

<a id="opIdcreate_or_update_a_template_by_key"></a>

`PUT /api/v2/llm_request_templates/by_key/{external_key}`

Creates the template identified by `external_key` — a stable identifier you choose, which may
contain slashes — or updates its display name and reporter if it already exists. A
template created this way is *declared*: it has no prompt patterns, so Coolhand never
regex-matches logs into it; logs reach it by declaring its key or id (see `declared` on
`POST /api/v2/llm_request_logs`). Creating one needs a workload: pass `workload_id` (hashid)
or `workload_key` (found or created). An existing template keeps its workload; naming a
different one returns 422, as does a key whose only holder is a deprecated template. Returns 201
when created and 200 when updated. When creating, a name another template already uses gets a
numeric suffix; renaming to a taken name returns 422. Requires the
**private** API key.

> Body parameter

```json
{
  "name": "string",
  "reporter": "string",
  "workload_id": "string",
  "workload_key": "string"
}
```

<h3 id="create-or-update-a-template-by-key-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|external_key|path|string|true|Stable identifier for the template (at most 255 characters)|
|body|body|object|false|none|
|» name|body|string|false|Display name (defaults to the key when created)|
|» reporter|body|string|false|Where the template came from, e.g. squishling|
|» workload_id|body|string|false|Hashid of the workload to create the template in|
|» workload_key|body|string|false|Key of the workload (created if new)|

> Example responses

> 200 Response

```json
{
  "id": "string",
  "name": "string",
  "external_key": "string",
  "reporter": "string",
  "status": "string",
  "version": "string",
  "group": "string",
  "workload_id": "string",
  "workload_name": "string",
  "system_template": true,
  "deprecated_at": "2019-08-24T14:15:22Z",
  "log_count": 0,
  "source_repository": "string",
  "source_file_path": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "user_prompt_pattern": "string",
  "system_prompt_pattern": "string"
}
```

<h3 id="create-or-update-a-template-by-key-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|updated|Inline|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|created|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - a new template needs a workload|Inline|

<h3 id="create-or-update-a-template-by-key-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» name|string|false|none|none|
|» external_key|string¦null|false|none|none|
|» reporter|string¦null|false|none|none|
|» status|string¦null|false|none|none|
|» version|string¦null|false|none|none|
|» group|string¦null|false|none|none|
|» workload_id|string|false|none|none|
|» workload_name|string|false|none|none|
|» system_template|boolean|false|none|none|
|» deprecated_at|string(date-time)¦null|false|none|none|
|» log_count|integer|false|none|none|
|» source_repository|string¦null|false|none|none|
|» source_file_path|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» user_prompt_pattern|string¦null|false|none|none|
|» system_prompt_pattern|string¦null|false|none|none|

Status Code **201**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» name|string|false|none|none|
|» external_key|string¦null|false|none|none|
|» reporter|string¦null|false|none|none|
|» status|string¦null|false|none|none|
|» version|string¦null|false|none|none|
|» group|string¦null|false|none|none|
|» workload_id|string|false|none|none|
|» workload_name|string|false|none|none|
|» system_template|boolean|false|none|none|
|» deprecated_at|string(date-time)¦null|false|none|none|
|» log_count|integer|false|none|none|
|» source_repository|string¦null|false|none|none|
|» source_file_path|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» user_prompt_pattern|string¦null|false|none|none|
|» system_prompt_pattern|string¦null|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-step-templates">Step Templates</h1>

Read-only API endpoints for the step templates (skills and other recurring steps detected in captured agent sessions) a client runs, with run counts, tool usage, user-turn stats and interactive vs automated efficiency.

## List Step Templates

<a id="opIdlist_step_templates"></a>

`GET /api/v2/step_templates`

Returns this client's published step templates, newest first, as a bare JSON array. A step
template is a skill or other recurring step Coolhand detects in captured agent sessions:
a `prompt_step` matches a user prompt such as a slash command, a `tool_step` matches tool
usage. Pagination metadata is exposed via the `X-Page`, `X-Per-Page`, `X-Total-Count` and
`X-Total-Pages` response headers.

Each row carries `sessions_count` (distinct sessions it appeared in), `occurrences_count` and
`last_seen_at`. Pass `include_metrics=true` to add a `metrics` object per row. It is off by
default because it runs several queries per step template, so `per` is capped at 25 when it
is set (the `X-Per-Page` header reports the size actually applied).

**Metrics.** `metrics` holds the same figures as the step template page, and says explicitly
where data is missing instead of leaving gaps to be guessed at:

- `total_runs` and `tool_stats` (share of runs using each tool, and average calls per run)
  exclude scrubbed prompt-step sessions, whose content is gone. `turn_stats` (user turns per
  run) still counts them, because the turn count survives the scrub. `tool_stats` and
  `turn_stats` are null when there is nothing to show.
- `efficiency` measures each run from the invocation onward, split into `interactive` (the user
  kept typing afterwards) and `automated` (nobody did) runs, plus `all`. A cohort with no runs is
  null. It is null for tool steps, which have no single invocation to measure, and for step templates with no recorded runs.
- `efficiency.unavailable_runs` counts runs with no per-turn snapshot (for example sessions
  scrubbed before it was captured). They are in none of the cohorts.
- Token figures (`median_tokens`, `p90_tokens`, `tokens_per_tool_call`) are null, and
  `tokens_available` is false, when no run in the cohort has token data. Captured sessions do not
  carry per-message token usage yet, so expect this today. When present, tokens are uncached
  input, cache writes and output; cache reads are excluded.
- `notes` lists, in plain sentences, each of the gaps above that applies to this step template.

The client is always derived from the authenticating API key. Requires the **private** API key.

<h3 id="list-step-templates-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|Authorization|header|string|false|Bearer token with the private API key|
|search|query|string|false|Case-insensitive substring match against the step template name|
|step_type|query|string|false|Only step templates of this type: prompt_step or tool_step|
|include_metrics|query|boolean|false|Include a `metrics` object per step template (default: false)|
|page|query|integer|false|Page number|
|per|query|integer|false|Records per page (default 25, max 100; per_page also accepted)|
|per_page|query|integer|false|Alias for per (same 25/100 bounds)|

> Example responses

> 200 Response

```json
[
  {
    "id": 0,
    "name": "string",
    "step_type": "prompt_step",
    "status": "string",
    "user_turn_pattern": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z",
    "sessions_count": 0,
    "occurrences_count": 0,
    "last_seen_at": "2019-08-24T14:15:22Z",
    "metrics": {
      "total_runs": 0,
      "tool_stats": [
        {
          "name": "string",
          "pct_of_runs": 0,
          "avg_per_run": 0
        }
      ],
      "turn_stats": {
        "avg": 0,
        "median": 0,
        "high": 0,
        "single_turn_pct": 0
      },
      "efficiency": {
        "interactive": {
          "runs": 0,
          "avg_turns_after": 0,
          "avg_tool_calls": 0,
          "avg_requests": 0,
          "token_runs": 0,
          "tokens_available": true,
          "median_tokens": 0,
          "p90_tokens": 0,
          "tokens_per_tool_call": 0
        },
        "automated": {
          "runs": 0,
          "avg_turns_after": 0,
          "avg_tool_calls": 0,
          "avg_requests": 0,
          "token_runs": 0,
          "tokens_available": true,
          "median_tokens": 0,
          "p90_tokens": 0,
          "tokens_per_tool_call": 0
        },
        "all": {
          "runs": 0,
          "avg_turns_after": 0,
          "avg_tool_calls": 0,
          "avg_requests": 0,
          "token_runs": 0,
          "tokens_available": true,
          "median_tokens": 0,
          "p90_tokens": 0,
          "tokens_per_tool_call": 0
        },
        "unavailable_runs": 0
      },
      "notes": [
        "string"
      ]
    }
  }
]
```

<h3 id="list-step-templates-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|returns this client's published step templates, newest first, with pagination headers|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - step_type is not prompt_step or tool_step|Inline|
|504|[Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5)|gateway timeout - a query exceeded the statement timeout|Inline|

<h3 id="list-step-templates-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|integer|false|none|none|
|» name|string|false|none|none|
|» step_type|string|false|none|none|
|» status|string|false|none|none|
|» user_turn_pattern|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» sessions_count|integer|false|none|none|
|» occurrences_count|integer|false|none|none|
|» last_seen_at|string(date-time)¦null|false|none|none|
|» metrics|object|false|none|none|
|»» total_runs|integer|true|none|none|
|»» tool_stats|[object]¦null|true|none|none|
|»»» name|string|false|none|none|
|»»» pct_of_runs|number|false|none|none|
|»»» avg_per_run|number|false|none|none|
|»» turn_stats|object¦null|true|none|none|
|»»» avg|number|false|none|none|
|»»» median|number|false|none|none|
|»»» high|integer|false|none|none|
|»»» single_turn_pct|number¦null|false|none|none|
|»» efficiency|object¦null|true|none|none|
|»»» interactive|object¦null|true|none|none|
|»»»» runs|integer|true|none|none|
|»»»» avg_turns_after|number|true|none|none|
|»»»» avg_tool_calls|number|true|none|none|
|»»»» avg_requests|number|true|none|none|
|»»»» token_runs|integer|true|none|none|
|»»»» tokens_available|boolean|true|none|none|
|»»»» median_tokens|integer¦null|true|none|none|
|»»»» p90_tokens|integer¦null|true|none|none|
|»»»» tokens_per_tool_call|integer¦null|true|none|none|
|»»» automated|object¦null|true|none|none|
|»»»» runs|integer|true|none|none|
|»»»» avg_turns_after|number|true|none|none|
|»»»» avg_tool_calls|number|true|none|none|
|»»»» avg_requests|number|true|none|none|
|»»»» token_runs|integer|true|none|none|
|»»»» tokens_available|boolean|true|none|none|
|»»»» median_tokens|integer¦null|true|none|none|
|»»»» p90_tokens|integer¦null|true|none|none|
|»»»» tokens_per_tool_call|integer¦null|true|none|none|
|»»» all|object¦null|true|none|none|
|»»»» runs|integer|true|none|none|
|»»»» avg_turns_after|number|true|none|none|
|»»»» avg_tool_calls|number|true|none|none|
|»»»» avg_requests|number|true|none|none|
|»»»» token_runs|integer|true|none|none|
|»»»» tokens_available|boolean|true|none|none|
|»»»» median_tokens|integer¦null|true|none|none|
|»»»» p90_tokens|integer¦null|true|none|none|
|»»»» tokens_per_tool_call|integer¦null|true|none|none|
|»»» unavailable_runs|integer|true|none|none|
|»» notes|[string]|true|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|step_type|prompt_step|
|step_type|tool_step|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **504**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Show Step Template

<a id="opIdshow_step_template"></a>

`GET /api/v2/step_templates/{id}`

Returns one published step template with its counts and, by default, its `metrics`. Pass
`include_metrics=false` to skip the metrics queries. A draft or failed step template, and one
belonging to another client, returns 404.

**Metrics.** `metrics` holds the same figures as the step template page, and says explicitly
where data is missing instead of leaving gaps to be guessed at:

- `total_runs` and `tool_stats` (share of runs using each tool, and average calls per run)
  exclude scrubbed prompt-step sessions, whose content is gone. `turn_stats` (user turns per
  run) still counts them, because the turn count survives the scrub. `tool_stats` and
  `turn_stats` are null when there is nothing to show.
- `efficiency` measures each run from the invocation onward, split into `interactive` (the user
  kept typing afterwards) and `automated` (nobody did) runs, plus `all`. A cohort with no runs is
  null. It is null for tool steps, which have no single invocation to measure, and for step templates with no recorded runs.
- `efficiency.unavailable_runs` counts runs with no per-turn snapshot (for example sessions
  scrubbed before it was captured). They are in none of the cohorts.
- Token figures (`median_tokens`, `p90_tokens`, `tokens_per_tool_call`) are null, and
  `tokens_available` is false, when no run in the cohort has token data. Captured sessions do not
  carry per-message token usage yet, so expect this today. When present, tokens are uncached
  input, cache writes and output; cache reads are excluded.
- `notes` lists, in plain sentences, each of the gaps above that applies to this step template.

The client is always derived from the authenticating API key. Requires the **private** API key.

<h3 id="show-step-template-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|Authorization|header|string|false|Bearer token with the private API key|
|include_metrics|query|boolean|false|Include `metrics` (default: true)|
|id|path|integer|true|Step template id (the `id` returned by the list endpoint)|

> Example responses

> 200 Response

```json
{
  "id": 0,
  "name": "string",
  "step_type": "prompt_step",
  "status": "string",
  "user_turn_pattern": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "sessions_count": 0,
  "occurrences_count": 0,
  "last_seen_at": "2019-08-24T14:15:22Z",
  "metrics": {
    "total_runs": 0,
    "tool_stats": [
      {
        "name": "string",
        "pct_of_runs": 0,
        "avg_per_run": 0
      }
    ],
    "turn_stats": {
      "avg": 0,
      "median": 0,
      "high": 0,
      "single_turn_pct": 0
    },
    "efficiency": {
      "interactive": {
        "runs": 0,
        "avg_turns_after": 0,
        "avg_tool_calls": 0,
        "avg_requests": 0,
        "token_runs": 0,
        "tokens_available": true,
        "median_tokens": 0,
        "p90_tokens": 0,
        "tokens_per_tool_call": 0
      },
      "automated": {
        "runs": 0,
        "avg_turns_after": 0,
        "avg_tool_calls": 0,
        "avg_requests": 0,
        "token_runs": 0,
        "tokens_available": true,
        "median_tokens": 0,
        "p90_tokens": 0,
        "tokens_per_tool_call": 0
      },
      "all": {
        "runs": 0,
        "avg_turns_after": 0,
        "avg_tool_calls": 0,
        "avg_requests": 0,
        "token_runs": 0,
        "tokens_available": true,
        "median_tokens": 0,
        "p90_tokens": 0,
        "tokens_per_tool_call": 0
      },
      "unavailable_runs": 0
    },
    "notes": [
      "string"
    ]
  }
}
```

<h3 id="show-step-template-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|returns the step template with counts and metrics|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - the public API key cannot read|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - the step template is a draft, missing, or belongs to another client|Inline|
|504|[Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5)|gateway timeout - a query exceeded the statement timeout|Inline|

<h3 id="show-step-template-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|integer|false|none|none|
|» name|string|false|none|none|
|» step_type|string|false|none|none|
|» status|string|false|none|none|
|» user_turn_pattern|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» sessions_count|integer|false|none|none|
|» occurrences_count|integer|false|none|none|
|» last_seen_at|string(date-time)¦null|false|none|none|
|» metrics|object|false|none|none|
|»» total_runs|integer|true|none|none|
|»» tool_stats|[object]¦null|true|none|none|
|»»» name|string|false|none|none|
|»»» pct_of_runs|number|false|none|none|
|»»» avg_per_run|number|false|none|none|
|»» turn_stats|object¦null|true|none|none|
|»»» avg|number|false|none|none|
|»»» median|number|false|none|none|
|»»» high|integer|false|none|none|
|»»» single_turn_pct|number¦null|false|none|none|
|»» efficiency|object¦null|true|none|none|
|»»» interactive|object¦null|true|none|none|
|»»»» runs|integer|true|none|none|
|»»»» avg_turns_after|number|true|none|none|
|»»»» avg_tool_calls|number|true|none|none|
|»»»» avg_requests|number|true|none|none|
|»»»» token_runs|integer|true|none|none|
|»»»» tokens_available|boolean|true|none|none|
|»»»» median_tokens|integer¦null|true|none|none|
|»»»» p90_tokens|integer¦null|true|none|none|
|»»»» tokens_per_tool_call|integer¦null|true|none|none|
|»»» automated|object¦null|true|none|none|
|»»»» runs|integer|true|none|none|
|»»»» avg_turns_after|number|true|none|none|
|»»»» avg_tool_calls|number|true|none|none|
|»»»» avg_requests|number|true|none|none|
|»»»» token_runs|integer|true|none|none|
|»»»» tokens_available|boolean|true|none|none|
|»»»» median_tokens|integer¦null|true|none|none|
|»»»» p90_tokens|integer¦null|true|none|none|
|»»»» tokens_per_tool_call|integer¦null|true|none|none|
|»»» all|object¦null|true|none|none|
|»»»» runs|integer|true|none|none|
|»»»» avg_turns_after|number|true|none|none|
|»»»» avg_tool_calls|number|true|none|none|
|»»»» avg_requests|number|true|none|none|
|»»»» token_runs|integer|true|none|none|
|»»»» tokens_available|boolean|true|none|none|
|»»»» median_tokens|integer¦null|true|none|none|
|»»»» p90_tokens|integer¦null|true|none|none|
|»»»» tokens_per_tool_call|integer¦null|true|none|none|
|»»» unavailable_runs|integer|true|none|none|
|»» notes|[string]|true|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|step_type|prompt_step|
|step_type|tool_step|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **504**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-workloads">Workloads</h1>

Read-only API endpoints for listing the workloads (groups of prompt templates) a client has, with per-workload counts and the same cost and performance rollup the dashboard shows.

## List Workloads

<a id="opIdlist_workloads"></a>

`GET /api/v2/workloads`

Returns this client's workloads — the groups of prompt templates that make up one task or
agent — as a bare JSON array, ordered by name. Pagination metadata is exposed via the
`X-Page`, `X-Per-Page`, `X-Total-Count` and `X-Total-Pages` response headers.

Each row carries the workload's active-template count (`template_count`), its draft
count, `log_count` and `last_activity` across every log attached to any of its templates
(all generators, so `log_count` can exceed the sum of the templates' own `log_count`, which
counts only directly-collected client logs).

`maturity` is how settled the workload is (`development`, `maturing`, `stable` or `dormant`).
It is recalculated nightly from the workload's age, traffic, quality, feedback and prompt
changes, and is null until the first calculation; a `maturity_override` set in the dashboard
takes precedence. `archive_suggested` is true once a workload has been dormant for over a week.

Archived workloads and the system workloads (`Unmatched`, `Embedding Requests`, …) are
excluded unless `include_archived` / `include_system` is passed.

**Metrics.** Pass `include_metrics=true` to add a `metrics` rollup per workload across all
of its templates: the same cost and performance numbers the dashboard shows, computed by
the same SQL (`LlmCostSql`, so tiered pricing, cached-token discounts and reasoning
tokens are applied) in a fixed number of grouped queries for the whole page. Averages
cover non-failed directly-collected client logs inside the `days_back` window (default 28,
the dashboard's window; max 365). See `GET /api/v2/llm_request_templates` for the field
definitions.

**Window.** `days_back` is a rolling lookback ending now. Pass `since` and/or `until`
(ISO8601; a missing offset means UTC, and a `+` offset must be URL-encoded as `%2B`)
for an explicit window instead: `since` is inclusive, `until` exclusive and defaulting to
now, and when `since` is given `days_back` is ignored and returned as null. With only
`until`, the window is `days_back` long ending there. The prior window behind
`error_rate_change` is the same length, immediately before the window. The resolved
bounds come back as `metrics.since`/`metrics.until`. A malformed timestamp, `since` not
before `until`, or a window over 365 days returns 422.

Additional counters over the same window, priced with the same cost expression as the dashboard:
`failure_count` (failed logs; `error_rate` is null when it is 0), `total_input_tokens`/
`total_output_tokens` (sums of the `input_tokens`/`output_tokens` columns over non-failed
logs), `priced_request_count` (non-failed logs with tokens whose model has pricing, i.e.
the logs `total_cost` and `avg_cost_per_request` cover; this excludes failed logs and logs with a zero token count, which the per-log `cost` on `GET /api/v2/llm_request_logs` does not, so summing that `cost` can exceed `total_cost`) and `long_context_request_count`
(priced logs that crossed their model's input-token pricing tier).

Pass `include_templates=true` to also list each workload's active templates with their
routing regex patterns.

The client is always derived from the authenticating API key. Requires the **private**
API key.

<h3 id="list-workloads-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|Authorization|header|string|false|Bearer token with the private API key|
|search|query|string|false|Case-insensitive substring match against the workload name|
|external_key|query|string|false|Only the workload declared with this key|
|reporter|query|string|false|Only workloads declared by this reporter, e.g. squishling|
|include_archived|query|boolean|false|Include archived workloads (default: false)|
|include_system|query|boolean|false|Include system workloads like Unmatched and Embedding Requests (default: false)|
|include_templates|query|boolean|false|Include each workload's active templates and their patterns (default: false)|
|include_metrics|query|boolean|false|Include a `metrics` rollup per workload (default: false)|
|days_back|query|integer|false|Lookback window in days for `metrics` (default 28; larger values are clamped to 365, whereas a `since` window over 365 days is a 422)|
|since|query|string(date-time)|false|ISO8601 start (inclusive) of the `metrics` window; overrides `days_back`. A date alone or a timestamp without an offset is UTC; encode a `+` offset as `%2B`. Ignored unless metrics are requested.|
|until|query|string(date-time)|false|ISO8601 end (exclusive) of the `metrics` window (default: now), same formats as `since`. Ignored unless metrics are requested.|
|page|query|integer|false|Page number|
|per|query|integer|false|Records per page (default 25, max 100; per_page also accepted)|
|per_page|query|integer|false|Alias for per (same 25/100 bounds)|

> Example responses

> 200 Response

```json
[
  {
    "id": "string",
    "name": "string",
    "description": "string",
    "external_key": "string",
    "reporter": "string",
    "archived": true,
    "system": true,
    "merged": true,
    "maturity": "development",
    "maturity_override": "development",
    "archive_suggested": true,
    "template_count": 0,
    "draft_template_count": 0,
    "log_count": 0,
    "last_activity": "2019-08-24T14:15:22Z",
    "templates": [
      {
        "id": "string",
        "name": "string",
        "status": "string",
        "user_prompt_pattern": "string",
        "system_prompt_pattern": "string"
      }
    ],
    "metrics": {
      "days_back": 0,
      "since": "2019-08-24T14:15:22Z",
      "until": "2019-08-24T14:15:22Z",
      "request_count": 0,
      "failure_count": 0,
      "error_rate": 0,
      "error_rate_change": 0,
      "avg_cost_per_request": 0,
      "total_cost": 0,
      "priced_request_count": 0,
      "long_context_request_count": 0,
      "total_input_tokens": 0,
      "total_output_tokens": 0,
      "avg_input_tokens": 0,
      "avg_output_tokens": 0,
      "avg_latency_ms": 0,
      "correctness_score": 0,
      "sentiment_score": 0,
      "revision_score": 0,
      "first_request_at": "2019-08-24T14:15:22Z",
      "last_request_at": "2019-08-24T14:15:22Z"
    }
  }
]
```

<h3 id="list-workloads-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|returns this client's workloads ordered by name, with pagination headers|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - days_back, since or until is invalid (not a positive integer / not ISO8601, since not before until, or window over 365 days)|Inline|
|504|[Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5)|gateway timeout - an aggregate exceeded the statement timeout|Inline|

<h3 id="list-workloads-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» name|string|false|none|none|
|» description|string¦null|false|none|none|
|» external_key|string¦null|false|none|none|
|» reporter|string¦null|false|none|none|
|» archived|boolean|false|none|none|
|» system|boolean|false|none|none|
|» merged|boolean|false|none|none|
|» maturity|string¦null|false|none|none|
|» maturity_override|string¦null|false|none|none|
|» archive_suggested|boolean|false|none|none|
|» template_count|integer|false|none|none|
|» draft_template_count|integer|false|none|none|
|» log_count|integer|false|none|none|
|» last_activity|string(date-time)¦null|false|none|none|
|» templates|[object]|false|none|none|
|»» id|string|false|none|none|
|»» name|string|false|none|none|
|»» status|string¦null|false|none|none|
|»» user_prompt_pattern|string¦null|false|none|none|
|»» system_prompt_pattern|string¦null|false|none|none|
|» metrics|object|false|none|none|
|»» days_back|integer¦null|true|none|none|
|»» since|string(date-time)|true|none|none|
|»» until|string(date-time)|true|none|none|
|»» request_count|integer|true|none|none|
|»» failure_count|integer|true|none|none|
|»» error_rate|number¦null|true|none|none|
|»» error_rate_change|number¦null|true|none|none|
|»» avg_cost_per_request|number¦null|true|none|none|
|»» total_cost|number¦null|true|none|none|
|»» priced_request_count|integer|true|none|none|
|»» long_context_request_count|integer|true|none|none|
|»» total_input_tokens|integer|true|none|none|
|»» total_output_tokens|integer|true|none|none|
|»» avg_input_tokens|integer¦null|true|none|none|
|»» avg_output_tokens|integer¦null|true|none|none|
|»» avg_latency_ms|number¦null|true|none|none|
|»» correctness_score|number¦null|true|none|none|
|»» sentiment_score|number¦null|true|none|none|
|»» revision_score|number¦null|true|none|none|
|»» first_request_at|string(date-time)¦null|true|none|none|
|»» last_request_at|string(date-time)¦null|true|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|maturity|development|
|maturity|maturing|
|maturity|stable|
|maturity|dormant|
|maturity_override|development|
|maturity_override|maturing|
|maturity_override|stable|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **504**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Create or update a Workload by key

<a id="opIdcreate_or_update_a_workload_by_key"></a>

`PUT /api/v2/workloads/by_key/{external_key}`

Creates the workload identified by `external_key` — a stable identifier you choose, which may
contain slashes — or updates its display name, description and reporter if it already
exists. The key itself never changes, so renaming a workload does not break logs that declare
it (see `declared` on `POST /api/v2/llm_request_logs`). Returns 201 when created and 200 when
updated. When creating, a name another workload already uses gets a numeric suffix ("Name (2)");
renaming to a taken name returns 422. Requires the **private** API key.

> Body parameter

```json
{
  "name": "string",
  "description": "string",
  "reporter": "string"
}
```

<h3 id="create-or-update-a-workload-by-key-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|external_key|path|string|true|Stable identifier for the workload (at most 255 characters)|
|body|body|object|false|none|
|» name|body|string|false|Display name (defaults to the key when created)|
|» description|body|string|false|none|
|» reporter|body|string|false|Where the workload came from, e.g. squishling|

> Example responses

> 200 Response

```json
{
  "id": "string",
  "name": "string",
  "description": "string",
  "external_key": "string",
  "reporter": "string",
  "archived": true,
  "system": true,
  "merged": true,
  "maturity": "development",
  "maturity_override": "development",
  "archive_suggested": true,
  "template_count": 0,
  "draft_template_count": 0,
  "log_count": 0,
  "last_activity": "2019-08-24T14:15:22Z"
}
```

<h3 id="create-or-update-a-workload-by-key-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|updated|Inline|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|created|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - the public key cannot write|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - the name is reserved or already taken|Inline|

<h3 id="create-or-update-a-workload-by-key-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» name|string|false|none|none|
|» description|string¦null|false|none|none|
|» external_key|string¦null|false|none|none|
|» reporter|string¦null|false|none|none|
|» archived|boolean|false|none|none|
|» system|boolean|false|none|none|
|» merged|boolean|false|none|none|
|» maturity|string¦null|false|none|none|
|» maturity_override|string¦null|false|none|none|
|» archive_suggested|boolean|false|none|none|
|» template_count|integer|false|none|none|
|» draft_template_count|integer|false|none|none|
|» log_count|integer|false|none|none|
|» last_activity|string(date-time)¦null|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|maturity|development|
|maturity|maturing|
|maturity|stable|
|maturity|dormant|
|maturity_override|development|
|maturity_override|maturing|
|maturity_override|stable|

Status Code **201**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|none|
|» name|string|false|none|none|
|» description|string¦null|false|none|none|
|» external_key|string¦null|false|none|none|
|» reporter|string¦null|false|none|none|
|» archived|boolean|false|none|none|
|» system|boolean|false|none|none|
|» merged|boolean|false|none|none|
|» maturity|string¦null|false|none|none|
|» maturity_override|string¦null|false|none|none|
|» archive_suggested|boolean|false|none|none|
|» template_count|integer|false|none|none|
|» draft_template_count|integer|false|none|none|
|» log_count|integer|false|none|none|
|» last_activity|string(date-time)¦null|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|maturity|development|
|maturity|maturing|
|maturity|stable|
|maturity|dormant|
|maturity_override|development|
|maturity_override|maturing|
|maturity_override|stable|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-cli-auth">CLI Auth</h1>

## Show CLI auth form — OAuth-style browser token handoff

<a id="opIdshow_cli_auth_form__oauthstyle_browser_token_handoff"></a>

`GET /cli/auth`

Displays the browser-based token authorization page for the Coolhand CLI.

**Flow overview:**
1. The CLI starts a local HTTP server and opens the browser to
   `GET /cli/auth?redirect_uri=http://localhost:<port>/cb&state=<random>&scope=<scope>`.
2. If the user is unauthenticated, they are redirected to `/users/sign_in`,
   which stores the CLI auth URL as the post-login return URL.
3. After authenticating, the user sees this page, selects (or creates) a
   Coolhand account, checks the confirmation box(es), and clicks Connect.
4. The server redirects to `redirect_uri` with token(s) in the query string
   (see `POST /cli/auth`).

**`scope` parameter:**
- Omitted entirely — defaults to `public` only (backward compatible with
  callers written before scope was configurable).
- `public` — returns only the public API key (`token`). Use for log
  ingest and REST API calls.
- `private` — returns only the private MCP key (`private_token`). The UI
  displays an owner-consent confirmation checkbox; the CLI Connect button
  is disabled until it's checked, and the form is rejected with 422 if it
  is submitted without it. Only request private scope when the CLI needs
  to call the `/mcp` endpoint.

Regardless of which scope is requested, the page always renders both the
public and private key checkboxes and pre-checks only the requested
one(s), so the user can grant more than was asked for without re-running
the CLI with a different `--scope`.
- `public,private` (or repeated/space-separated) — returns both keys.
  Requesting an explicit `scope` with zero valid values (e.g. `scope=`)
  is rejected with `400 Bad Request` — a CLI must ask for at least one
  of `public` or `private`.

**Security:** `redirect_uri` must be an `http://` URL with host
`localhost`, `127.0.0.1`, or `::1`. HTTPS and non-localhost hosts are
rejected with `400 Bad Request`.

<h3 id="show-cli-auth-form-—-oauth-style-browser-token-handoff-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|redirect_uri|query|string|true|Localhost HTTP callback URL for the CLI (e.g. `http://localhost:59123/cb`)|
|state|query|string|true|Opaque CSRF state string echoed back in the callback. Max 256 characters.|
|scope|query|string|false|Key scope(s) to request: `public` (default), `private`, or `public,private`|

> Example responses

> 200 Response

```
"string"
```

<h3 id="show-cli-auth-form-—-oauth-style-browser-token-handoff-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Both scopes requested shows both keys|string|
|302|[Found](https://tools.ietf.org/html/rfc7231#section-6.4.3)|Unauthenticated — redirected to sign in|string|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Explicit but empty scope|string|

<aside class="success">
This operation does not require authentication
</aside>

## Submit CLI auth form — issues token callback redirect

<a id="opIdsubmit_cli_auth_form__issues_token_callback_redirect"></a>

`POST /cli/auth`

Processes the CLI auth form submission and redirects the browser to the
CLI's local callback URL with API key(s) in the query string.

**Callback query parameters:**
| Parameter | Always present | Description |
|---|---|---|
| `token` | Only when `scope[]` includes `public` | Public API key (`ch_pub_*`). Use for log ingest and REST API calls. |
| `private_token` | Only when `scope[]` includes `private` | Private MCP key (`ch_priv_*`). Required for `POST /mcp`. |
| `state` | ✓ | Echoed back from the request — verify this matches your initial state to prevent CSRF. |
| `client_name` | ✓ | Human-readable name of the selected Coolhand account. |
| `client_id` | ✓ | Hashid of the selected Coolhand account. |

At least one of `token` / `private_token` is always present — submitting an
empty `scope[]` is rejected with `422 Unprocessable Entity`.

**Using the private key:**
Pass `private_token` as the `X-API-Key` header when calling `POST /mcp`.
The public `token` is used everywhere else (SDK configuration, ingest endpoint).
Never embed the private key in client-side code or commit it to source control.

**New client creation:**
Pass `new_client=1` and `new_client_name=<name>` instead of `client_id` to
create a new Coolhand account on the fly. The callback will carry the new
account's freshly generated keys.

> Body parameter

```yaml
string

```

<h3 id="submit-cli-auth-form-—-issues-token-callback-redirect-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|string|true|Localhost HTTP callback URL (must match the GET request value)|

> Example responses

> 302 Response

```
"string"
```

<h3 id="submit-cli-auth-form-—-issues-token-callback-redirect-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|302|[Found](https://tools.ietf.org/html/rfc7231#section-6.4.3)|Success — new client created, token returned|string|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Invalid redirect_uri|string|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthenticated — authentication required|string|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|No client selected|string|

<aside class="success">
This operation does not require authentication
</aside>

## Cancel a CLI auth request the user did not initiate

<a id="opIdcancel_a_cli_auth_request_the_user_did_not_initiate"></a>

`POST /cli/auth/deny`

Handles the "I didn't request this" escape hatch on the CLI auth screen.
Never redirects to the CLI's `redirect_uri` — instead sends the user to
their own dashboard and posts a Slack alert so the team can investigate a
possible spoofed or malicious CLI auth link. No token is issued.

The request URI included in that alert is rebuilt server-side from the
validated `redirect_uri` / `state` / `scope` params, so there is no
caller-supplied field for it — a tampered form cannot inject text into
the alert.

> Body parameter

```yaml
string

```

<h3 id="cancel-a-cli-auth-request-the-user-did-not-initiate-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|string|true|Localhost HTTP callback URL (must match the GET request value)|

> Example responses

> 302 Response

```
"string"
```

<h3 id="cancel-a-cli-auth-request-the-user-did-not-initiate-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|302|[Found](https://tools.ietf.org/html/rfc7231#section-6.4.3)|Success — redirected away from the CLI callback|string|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthenticated — authentication required|string|

<aside class="success">
This operation does not require authentication
</aside>

<h1 id="coolhand-llm-request-logging-api-inference-apis">Inference APIs</h1>

## List inference model pricing metadata

<a id="opIdlist_inference_model_pricing_metadata"></a>

`GET /api/v2/inference_apis`

Returns a list of all inference models tracked by Coolhand, including per-token
pricing metadata.

**Authentication:**
Authentication is optional. Unauthenticated callers are rate-limited (see below).
Authenticated callers bypass the rate limit entirely. Pass a **public** API key via the
`X-API-Key` header or as a `Bearer` token in the `Authorization` header. Sign up at
coolhand.ai to get a free API key. A private key is not accepted here — this endpoint
only recognizes public keys (and rejects a private key the same way it would an invalid
one).

**How pricing data is gathered:**
Pricing data is collected by the Godfrey agent, an automated system that
periodically fetches and parses pricing pages published by model providers.
All records undergo human review before being considered authoritative.
The `sources` field on each record links to the original provider pricing
page used as the data source.

**Cost units:**
Every `_per_token` field is a raw USD cost-per-token value. Multiply by 1,000,000 for
the "per 1M tokens" pricing commonly published by providers.
`per_cache_storage_cost_per_hour_per_token` is the one exception: it's priced per hour
of storage, not per request — an ongoing hourly charge for holding tokens in a cache
(as Gemini's explicit context caching bills), not a one-time per-token cost.

**Capabilities:**
Each record carries a `capabilities` array of tags for features the model is known to
support (e.g. `function_calling`, `vision`). A tag is only ever a positive claim; `null`
means the capabilities are not recorded (unknown), not that the model lacks them. Filter with
`capability` (see below).

**Rate limiting:**
Requests are rate limited to 1 request per minute per IP address. Exceeding the limit
returns a `429 Too Many Requests` response. Requests authenticated with a **private** API
key are never rate limited. A public API key is accepted but does not lift the limit — it
is designed to be published in web pages, so it can't prove who is calling.

<h3 id="list-inference-model-pricing-metadata-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|API key for authentication|
|Authorization|header|string|false|Bearer token with API key|
|q[source_api_eq]|query|string|false|Filter by API identifier (e.g. 'openai', 'anthropic'). For some values (e.g. 'opencode', 'openrouter', 'azure', 'bedrock', 'vertex') this is a hosting gateway that re-lists another vendor's models at its own pricing, distinct from the model's actual vendor — see q[provider_eq].|
|q[model_eq]|query|string|false|Filter by the exact model identifier passed in API calls to the source API itself — e.g. if your code calls OpenAI with model: 'gpt-4o', pass q[model_eq]=gpt-4o here, not the display name (see the model field on the response schema below). Combine with q[source_api_eq] to fetch a single model, since (source_api, model) is unique.|
|q[model_type_eq]|query|string|false|Filter by model type: 'llm' for text-generating models, 'system_one' for decision models (e.g. TypeSafe's Jev) that return typed answers instead of generated text.|
|q[size_tier_eq]|query|string|false|Filter LLMs by size tier: 'micro' (on-device), 'small', 'medium', 'large' or 'extra_large' (frontier flagship). Unclassified and System One models are excluded.|
|q[provider_eq]|query|string|false|Filter by the model's underlying vendor, regardless of which source_api/gateway serves it. Values are lowercase (e.g. 'openai', 'anthropic', 'google') and matched case-sensitively.|
|q[context_window_gteq]|query|integer|false|Only models whose context window is at least this many tokens. Models whose context window is unknown (null) are excluded. Other integer predicates (_lteq, _gt, _lt, _eq) work the same way; text predicates such as _cont return 400.|
|q[max_output_tokens_gteq]|query|integer|false|Only models that can generate at least this many tokens in one response. Models whose limit is unknown (null) are excluded. Other integer predicates (_lteq, _gt, _lt, _eq) work the same way; text predicates such as _cont return 400.|
|q[weights_access_eq]|query|string|false|Filter by whether the model's weights can be downloaded: 'closed', 'open_permissive' (OSI-style license such as Apache-2.0 or MIT) or 'open_restricted' (custom or community license with use limits, e.g. Llama). Models whose status is unknown (null) are excluded. To list every open-weights model pass q[weights_access_in][]=open_permissive&q[weights_access_in][]=open_restricted.|
|q[knowledge_cutoff_gteq]|query|string|false|Only models whose knowledge cutoff is on or after this date (YYYY-MM-DD). Models with an unknown (null) cutoff are excluded. The _lteq, _lt, _gt, _eq and _null predicates work the same way.|
|q[s]|query|string|false|Sort expression, e.g. 'model desc'. Defaults to source_api then model. Other ransackable columns (pricing, max_output_tokens, deprecation_notes, sources, not_human_reviewed, slug) can be filtered the same q[column_predicate] way; not enumerated individually here since #index only ever shows the summary fields documented in the response schema below — see GET /api/v2/inference_apis/{id} for the full field set those filter.|
|available_for_bakeoff|query|boolean|false|If true, only return bakeoff-eligible models. Not a Ransack predicate (not under q[...]) — like include_deprecated below, it changes which set is returned rather than narrowing a search.|
|capability|query|array|false|Only return models tagged with ALL of the given capabilities. Repeat the param (capability[]=function_calling&capability[]=vision) or comma-separate it (capability=function_calling,vision). Models whose capabilities are not recorded (null) never match. An unrecognized tag returns 400. Not a Ransack predicate: q[capabilities_cont] and similar are rejected. Tags: `function_calling` (Accepts tool/function definitions and can return tool calls); `structured_output` (Can constrain responses to a JSON schema (Gemini's schema-less JSON mode counts too)); `reasoning` (Produces reasoning/thinking output before the final answer); `vision` (Accepts image input); `streaming` (Can stream responses incrementally); `caching` (Supports prompt/context caching).|
|input_modality|query|string|false|Only return models whose input_modalities contain every value given. Comma-separated (input_modality=image,pdf) or repeated (input_modality[]=image). Allowed values: text, image, audio, video, pdf, file. Models whose modalities are unknown (null) are excluded. An unrecognized value returns 400. Not a Ransack predicate.|
|output_modality|query|string|false|Only return models whose output_modalities contain every value given. Same syntax as input_modality. Allowed values: text, image, audio, video, embeddings, rerank, decision.|
|include_deprecated|query|boolean|false|Include deprecated models. Defaults to true. Pass false to hide them. Not a Ransack predicate — it changes which set is returned rather than narrowing it.|
|q[id_eq]|query|string|false|NOT a supported filter — id was intentionally removed from ransackable_attributes. Documented here only to show the resulting contract: an unrecognized predicate returns 400 rather than silently ignoring the filter and returning the whole catalog.|

> Example responses

> 200 Response

```json
[
  {
    "id": 0,
    "source_api": "string",
    "model": "string",
    "display_name": "string",
    "provider": "string",
    "model_type": "llm",
    "size_tier": "micro",
    "context_window": 0,
    "per_input_cost_per_token": 0.1,
    "per_output_cost_per_token": 0.1,
    "per_cached_input_cost_per_token": 0.1,
    "per_cache_creation_input_cost_per_token": 0.1,
    "per_cache_creation_5m_input_cost_per_token": 0.1,
    "per_cache_creation_1h_input_cost_per_token": 0.1,
    "per_cache_storage_cost_per_hour_per_token": 0.1,
    "capabilities": [
      "function_calling"
    ],
    "max_output_tokens": 0,
    "weights_access": "closed",
    "weights_license": "string",
    "available_for_bakeoff": true,
    "input_modalities": [
      "text"
    ],
    "output_modalities": [
      "text"
    ],
    "deprecated_at": "2019-08-24T14:15:22Z",
    "deprecation_notes": "string",
    "knowledge_cutoff": "2019-08-24",
    "sources": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z"
  }
]
```

<h3 id="list-inference-model-pricing-metadata-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success - unauthenticated|Inline|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|invalid filter|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - invalid API key|Inline|
|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|rate limit exceeded|Inline|

<h3 id="list-inference-model-pricing-metadata-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|integer|false|none|Internal record ID|
|» source_api|string|false|none|Provider API identifier used to route requests (e.g. 'openai_api', 'anthropic_api')|
|» model|string|false|none|Model identifier passed in API calls (e.g. 'gpt-4o', 'claude-3-5-sonnet-20241022')|
|» display_name|string|false|none|Human-readable model name|
|» provider|string¦null|false|none|Provider name (e.g. 'OpenAI', 'Anthropic', 'Google')|
|» model_type|string|false|none|'llm' for text-generating models; 'system_one' for decision models that return typed answers instead of generated text|
|» size_tier|string¦null|false|none|Size class of an LLM, from 'micro' (on-device) to 'extra_large' (frontier flagship); null when not yet classified or for System One models|
|» context_window|integer¦null|false|none|Maximum context window in tokens (whether output counts against it varies by provider; not USD, not thousands of tokens). Null when unknown — don't assume small or large.|
|» per_input_cost_per_token|number(float)|false|none|Cost per input token in USD|
|» per_output_cost_per_token|number(float)|false|none|Cost per output token in USD|
|» per_cached_input_cost_per_token|number(float)¦null|false|none|Cost per cached (cache-read) input token in USD|
|» per_cache_creation_input_cost_per_token|number(float)¦null|false|none|Cost per cache-creation (cache-write) input token in USD, when priced separately from cache reads and not further split by TTL|
|» per_cache_creation_5m_input_cost_per_token|number(float)¦null|false|none|Cost per cache-creation input token with a 5-minute TTL in USD|
|» per_cache_creation_1h_input_cost_per_token|number(float)¦null|false|none|Cost per cache-creation input token with a 1-hour TTL in USD|
|» per_cache_storage_cost_per_hour_per_token|number(float)¦null|false|none|Cost per token held in a cache, per hour of storage, in USD — a distinct unit from every other cost field above (which are per-token, not per-token-per-hour). Only populated for providers that bill an explicit storage fee for caching (e.g. Gemini context caching); reference pricing, not used by Coolhand's own cost estimation.|
|» capabilities|[string]¦null|false|none|Capability tags this model is known to support: `function_calling` (Accepts tool/function definitions and can return tool calls); `structured_output` (Can constrain responses to a JSON schema (Gemini's schema-less JSON mode counts too)); `reasoning` (Produces reasoning/thinking output before the final answer); `vision` (Accepts image input); `streaming` (Can stream responses incrementally); `caching` (Supports prompt/context caching). A tag is only ever a positive claim. null means the model's capabilities are NOT RECORDED (unknown), not that it has none — never read null, or a tag's absence, as "lacks tool calling" or similar.|
|» max_output_tokens|integer¦null|false|none|Most tokens the model can generate in a single response, in tokens. This is the model's limit, not a request's max_tokens, and reasoning/thinking tokens count toward it. null means unknown — not unlimited.|
|» weights_access|string¦null|false|none|Whether the model's weights can be downloaded: closed, open_permissive (OSI-style license) or open_restricted (custom/community license with use limits). Describes the model, not the hosting provider. null means unknown — not closed.|
|» weights_license|string¦null|false|none|License name for an open-weights model, e.g. 'Apache-2.0'; null when unknown or closed.|
|» available_for_bakeoff|boolean|false|none|Whether this model is available for Coolhand comparison runs (bakeoffs)|
|» input_modalities|[string]¦null|false|none|Media types the model accepts as input. null means not recorded (unknown), which is different from a text-only model (['text']).|
|» output_modalities|[string]¦null|false|none|Media types the model can produce as output. null means not recorded (unknown).|
|» deprecated_at|string(date-time)¦null|false|none|ISO 8601 timestamp when the model was or will be deprecated by the provider. Null if active.|
|» deprecation_notes|string¦null|false|none|Additional context about the deprecation, such as a recommended successor model|
|» knowledge_cutoff|string(date)¦null|false|none|Training-data (knowledge) cutoff as an ISO 8601 date. Providers that publish only a month are stored as the first of that month, so treat the day as unreliable. Null when unknown, which is common.|
|» sources|string¦null|false|none|URL to the provider pricing page used as the source for this record|
|» created_at|string(date-time)|false|none|ISO 8601 timestamp when this record was first created|
|» updated_at|string(date-time)|false|none|ISO 8601 timestamp when this record was last updated|

#### Enumerated Values

|Property|Value|
|---|---|
|model_type|llm|
|model_type|system_one|
|size_tier|micro|
|size_tier|small|
|size_tier|medium|
|size_tier|large|
|size_tier|extra_large|
|weights_access|closed|
|weights_access|open_restricted|
|weights_access|open_permissive|

Status Code **400**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **429**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
publicApiKey, bearerAuth, None
</aside>

## Fetch a single inference model's full record

<a id="opIdfetch_a_single_inference_models_full_record"></a>

`GET /api/v2/inference_apis/{id}`

Returns every field #index's summary response has, plus the fields #index omits: the
internal `not_human_reviewed` review-status flag, the `slug` used in this model's public
page URL, the batch and reasoning-output per-token pricing columns, `edge_model` /
`downstep_model`, `pricing_tiers`, and `history` (`index` has never exposed any of these).
`context_window` (maximum context window in tokens; null when unknown) and `max_output_tokens`
(the most tokens the model can generate in one response; reasoning tokens count toward it; null
when unknown) are on both, as are `weights_access` (`closed`, `open_permissive` or
`open_restricted`; null when unknown) and `weights_license`.
Same authentication and rate limiting as #index.

**`history`:** past pricing/status changes, most recent first, reconstructed from this
record's audit trail. Each entry's `whodunnit` is normalized to `"automated"` (an
automated pricing scan or cross-check) or `"manual"` (a human edit) — never an internal
user/admin id. Each changed attribute in `changes` includes raw `before`/`after` values
plus a human-readable `description`.

**`last_change_detected_at`:** the timestamp of the most recently *detected* pricing/status
change, not a literal "last time we checked" timestamp — a scan that finds no change
leaves no trace, so this can under-report true scan frequency for a model whose data
hasn't moved recently.

**`edge_model` / `downstep_model`:** curated comparison references — a newer "same tier"
model, and a cheaper alternative, respectively. Each is a minimal `{slug, display_name}`
object, or `null` if none is set or the related model has no slug.

**`pricing_tiers`:** pricing overrides that replace the base rates for a request once a
condition is met: `input_token_threshold` (a flat higher rate for the whole request past a
large input-token threshold, `condition_trigger`) or `utc_time_window` (a different rate
during recurring UTC hours, e.g. peak-hour pricing, given by `active_utc_weekdays` and
`active_utc_hours`). An empty array if none are configured for this model.

<h3 id="fetch-a-single-inference-model's-full-record-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|id|path|string|true|The model's slug (e.g. 'openai-gpt-4o'), matching its public page URL at /inference-apis/:slug — not the internal numeric id, which isn't a stable public identifier and isn't filterable via q[...] on #index either.|
|X-API-Key|header|string|false|API key for authentication|
|Authorization|header|string|false|Bearer token with API key|

> Example responses

> 200 Response

```json
{
  "id": 0,
  "slug": "string",
  "source_api": "string",
  "model": "string",
  "display_name": "string",
  "provider": "string",
  "model_type": "llm",
  "size_tier": "micro",
  "context_window": 0,
  "per_input_cost_per_token": 0.1,
  "per_output_cost_per_token": 0.1,
  "per_cached_input_cost_per_token": 0.1,
  "per_cache_creation_input_cost_per_token": 0.1,
  "per_cache_creation_5m_input_cost_per_token": 0.1,
  "per_cache_creation_1h_input_cost_per_token": 0.1,
  "per_cache_storage_cost_per_hour_per_token": 0.1,
  "capabilities": [
    "function_calling"
  ],
  "max_output_tokens": 0,
  "weights_access": "closed",
  "weights_license": "string",
  "available_for_bakeoff": true,
  "input_modalities": [
    "string"
  ],
  "output_modalities": [
    "string"
  ],
  "deprecated_at": "2019-08-24T14:15:22Z",
  "deprecation_notes": "string",
  "knowledge_cutoff": "2019-08-24",
  "sources": "string",
  "updated_at": "2019-08-24T14:15:22Z",
  "created_at": "2019-08-24T14:15:22Z",
  "not_human_reviewed": true,
  "per_input_cost_batch_per_token": 0.1,
  "per_output_cost_batch_per_token": 0.1,
  "per_reasoning_output_cost_per_token": 0.1,
  "edge_model": {
    "slug": "string",
    "display_name": "string"
  },
  "downstep_model": {
    "slug": "string",
    "display_name": "string"
  },
  "pricing_tiers": [
    {
      "condition_type": "input_token_threshold",
      "condition_trigger": 0,
      "active_utc_weekdays": [
        0
      ],
      "active_utc_hours": [
        0
      ],
      "condition_description": "string",
      "per_input_cost_per_token": 0.1,
      "per_output_cost_per_token": 0.1,
      "per_cached_input_cost_per_token": 0.1,
      "per_cache_creation_input_cost_per_token": 0.1,
      "per_cache_creation_5m_input_cost_per_token": 0.1,
      "per_cache_creation_1h_input_cost_per_token": 0.1,
      "per_reasoning_output_cost_per_token": 0.1,
      "notes": "string"
    }
  ],
  "last_change_detected_at": "2019-08-24T14:15:22Z",
  "history": [
    {
      "changed_at": "2019-08-24T14:15:22Z",
      "whodunnit": "automated",
      "initial": true,
      "changes": {
        "property1": {
          "before": null,
          "after": null,
          "description": "string"
        },
        "property2": {
          "before": null,
          "after": null,
          "description": "string"
        }
      }
    }
  ]
}
```

<h3 id="fetch-a-single-inference-model's-full-record-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|model not found|Inline|

<h3 id="fetch-a-single-inference-model's-full-record-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|integer|false|none|none|
|» slug|string|false|none|Matches the :id path segment used to fetch this record|
|» source_api|string|false|none|none|
|» model|string|false|none|none|
|» display_name|string|false|none|none|
|» provider|string¦null|false|none|none|
|» model_type|string|false|none|none|
|» size_tier|string¦null|false|none|none|
|» context_window|integer¦null|false|none|Maximum context window in tokens; null when unknown|
|» per_input_cost_per_token|number(float)|false|none|none|
|» per_output_cost_per_token|number(float)|false|none|none|
|» per_cached_input_cost_per_token|number(float)¦null|false|none|none|
|» per_cache_creation_input_cost_per_token|number(float)¦null|false|none|none|
|» per_cache_creation_5m_input_cost_per_token|number(float)¦null|false|none|none|
|» per_cache_creation_1h_input_cost_per_token|number(float)¦null|false|none|none|
|» per_cache_storage_cost_per_hour_per_token|number(float)¦null|false|none|none|
|» capabilities|[string]¦null|false|none|Capability tags this model is known to support: `function_calling` (Accepts tool/function definitions and can return tool calls); `structured_output` (Can constrain responses to a JSON schema (Gemini's schema-less JSON mode counts too)); `reasoning` (Produces reasoning/thinking output before the final answer); `vision` (Accepts image input); `streaming` (Can stream responses incrementally); `caching` (Supports prompt/context caching). A tag is only ever a positive claim. null means the model's capabilities are NOT RECORDED (unknown), not that it has none — never read null, or a tag's absence, as "lacks tool calling" or similar.|
|» max_output_tokens|integer¦null|false|none|none|
|» weights_access|string¦null|false|none|Whether the model's weights can be downloaded; null when unknown|
|» weights_license|string¦null|false|none|License name for an open-weights model, e.g. 'Apache-2.0'|
|» available_for_bakeoff|boolean|false|none|none|
|» input_modalities|[string]¦null|false|none|none|
|» output_modalities|[string]¦null|false|none|none|
|» deprecated_at|string(date-time)¦null|false|none|none|
|» deprecation_notes|string¦null|false|none|none|
|» knowledge_cutoff|string(date)¦null|false|none|none|
|» sources|string¦null|false|none|none|
|» updated_at|string(date-time)|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» not_human_reviewed|boolean|false|none|True if this record has an automated flag pending human review — not exposed on #index.|
|» per_input_cost_batch_per_token|number(float)¦null|false|none|none|
|» per_output_cost_batch_per_token|number(float)¦null|false|none|none|
|» per_reasoning_output_cost_per_token|number(float)¦null|false|none|none|
|» edge_model|object¦null|false|none|Curated 'newer, same tier' comparison model, or null if none is set|
|»» slug|string|false|none|none|
|»» display_name|string|false|none|none|
|» downstep_model|object¦null|false|none|Curated 'cheaper alternative' comparison model, or null if none is set|
|»» slug|string|false|none|none|
|»» display_name|string|false|none|none|
|» pricing_tiers|[object]|false|none|Pricing overrides configured for this model, if any|
|»» condition_type|string|false|none|none|
|»» condition_trigger|integer¦null|false|none|Input-token threshold (strictly above) for input_token_threshold tiers; null otherwise|
|»» active_utc_weekdays|[integer]¦null|false|none|ISO weekdays (1 = Monday) a utc_time_window tier applies on; null otherwise|
|»» active_utc_hours|[integer]¦null|false|none|UTC hours (0-23) a utc_time_window tier applies in; null otherwise|
|»» condition_description|string|false|none|Human-readable condition|
|»» per_input_cost_per_token|number(float)|false|none|none|
|»» per_output_cost_per_token|number(float)|false|none|none|
|»» per_cached_input_cost_per_token|number(float)¦null|false|none|none|
|»» per_cache_creation_input_cost_per_token|number(float)¦null|false|none|none|
|»» per_cache_creation_5m_input_cost_per_token|number(float)¦null|false|none|none|
|»» per_cache_creation_1h_input_cost_per_token|number(float)¦null|false|none|none|
|»» per_reasoning_output_cost_per_token|number(float)¦null|false|none|none|
|»» notes|string¦null|false|none|none|
|» last_change_detected_at|string(date-time)¦null|false|none|Timestamp of the most recently detected pricing/status change — see the endpoint description above for why this differs from a literal scan timestamp|
|» history|[object]|false|none|Past pricing/status changes, most recent first|
|»» changed_at|string(date-time)|false|none|none|
|»» whodunnit|string|false|none|none|
|»» initial|boolean|false|none|True for the record's initial creation entry|
|»» changes|object|false|none|Keyed by changed attribute name|
|»»» **additionalProperties**|object|false|none|none|
|»»»» before|any|false|none|none|
|»»»» after|any|false|none|none|
|»»»» description|string|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|model_type|llm|
|model_type|system_one|
|size_tier|micro|
|size_tier|small|
|size_tier|medium|
|size_tier|large|
|size_tier|extra_large|
|weights_access|closed|
|weights_access|open_restricted|
|weights_access|open_permissive|
|condition_type|input_token_threshold|
|condition_type|utc_time_window|
|whodunnit|automated|
|whodunnit|manual|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
publicApiKey, bearerAuth, None
</aside>

<h1 id="coolhand-llm-request-logging-api-llm-model-reviews">LLM Model Reviews</h1>

## List LLM models awaiting human review

<a id="opIdlist_llm_models_awaiting_human_review"></a>

`GET /api/v2/llm_model_reviews`

The "Needs Review" queue from the admin LLM Models page: models Godfrey or the models.dev
cross-check changed that no human has confirmed, plus models whose only open item is an
unreviewed scheduled price. Client deprecation and repricing notices are held for a model
until it is approved.

**This endpoint is not available to customer API keys.** It accepts only Coolhand's own
private client key; a valid private key for any other client receives `403`.

**Pagination:** `page` and `per_page` (max 100), with totals in the `X-Page`, `X-Per-Page`,
`X-Total-Count` and `X-Total-Pages` response headers.

<h3 id="list-llm-models-awaiting-human-review-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|page|query|integer|false|none|
|per_page|query|integer|false|none|

> Example responses

> 200 Response

```json
[
  {
    "id": 0,
    "source_api": "string",
    "model": "string",
    "display_name": "string",
    "slug": "string",
    "sources": "string",
    "per_input_cost_per_token": 0,
    "per_output_cost_per_token": 0,
    "deprecated_at": "2019-08-24T14:15:22Z",
    "deprecation_notes": "string",
    "not_human_reviewed": true,
    "awaiting_review": true,
    "models_dev_flagged_at": "2019-08-24T14:15:22Z",
    "models_dev_mismatch_details": [
      {}
    ],
    "upcoming_prices": [
      {
        "id": 0,
        "effective_start_at": "2019-08-24T14:15:22Z",
        "per_input_cost_per_token": 0,
        "per_output_cost_per_token": 0,
        "not_human_reviewed": true,
        "source_url": "string",
        "notes": "string"
      }
    ]
  }
]
```

<h3 id="list-llm-models-awaiting-human-review-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|the review queue|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing or public key|Inline|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|forbidden - a valid private key belonging to another client|Inline|

<h3 id="list-llm-models-awaiting-human-review-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|integer|false|none|none|
|» source_api|string|false|none|none|
|» model|string|false|none|none|
|» display_name|string¦null|false|none|none|
|» slug|string¦null|false|none|none|
|» sources|string¦null|false|none|Where the rates were read from|
|» per_input_cost_per_token|number|false|none|Live input rate, USD per token (x 1,000,000 for $/M)|
|» per_output_cost_per_token|number|false|none|Live output rate, USD per token|
|» deprecated_at|string(date-time)¦null|false|none|Retirement date. A future date is an announced retirement.|
|» deprecation_notes|string¦null|false|none|none|
|» not_human_reviewed|boolean|false|none|The model's own review flag|
|» awaiting_review|boolean|false|none|True while the model's flag or any upcoming scheduled price is unreviewed|
|» models_dev_flagged_at|string(date-time)¦null|false|none|none|
|» models_dev_mismatch_details|[object]¦null|false|none|Fields where models.dev disagrees with the stored value|
|» upcoming_prices|[object]|false|none|Scheduled, not-yet-effective prices, soonest first|
|»» id|integer|false|none|none|
|»» effective_start_at|string(date-time)|false|none|none|
|»» per_input_cost_per_token|number|false|none|none|
|»» per_output_cost_per_token|number|false|none|none|
|»» not_human_reviewed|boolean|false|none|none|
|»» source_url|string¦null|false|none|none|
|»» notes|string¦null|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **403**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Show a model awaiting review, with the agent's changes

<a id="opIdshow_a_model_awaiting_review_with_the_agents_changes"></a>

`GET /api/v2/llm_model_reviews/{id}`

One queue entry plus `agent_changes`, the before/after pairs of Godfrey's last write. Coolhand's own private key only.

<h3 id="show-a-model-awaiting-review,-with-the-agent's-changes-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|id|path|integer|true|none|

> Example responses

> 200 Response

```json
{
  "id": 0,
  "source_api": "string",
  "model": "string",
  "display_name": "string",
  "slug": "string",
  "sources": "string",
  "per_input_cost_per_token": 0,
  "per_output_cost_per_token": 0,
  "deprecated_at": "2019-08-24T14:15:22Z",
  "deprecation_notes": "string",
  "not_human_reviewed": true,
  "awaiting_review": true,
  "models_dev_flagged_at": "2019-08-24T14:15:22Z",
  "models_dev_mismatch_details": [
    {}
  ],
  "upcoming_prices": [
    {
      "id": 0,
      "effective_start_at": "2019-08-24T14:15:22Z",
      "per_input_cost_per_token": 0,
      "per_output_cost_per_token": 0,
      "not_human_reviewed": true,
      "source_url": "string",
      "notes": "string"
    }
  ],
  "agent_changes": {}
}
```

<h3 id="show-a-model-awaiting-review,-with-the-agent's-changes-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|the model|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found|Inline|

<h3 id="show-a-model-awaiting-review,-with-the-agent's-changes-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|integer|false|none|none|
|» source_api|string|false|none|none|
|» model|string|false|none|none|
|» display_name|string¦null|false|none|none|
|» slug|string¦null|false|none|none|
|» sources|string¦null|false|none|Where the rates were read from|
|» per_input_cost_per_token|number|false|none|Live input rate, USD per token (x 1,000,000 for $/M)|
|» per_output_cost_per_token|number|false|none|Live output rate, USD per token|
|» deprecated_at|string(date-time)¦null|false|none|Retirement date. A future date is an announced retirement.|
|» deprecation_notes|string¦null|false|none|none|
|» not_human_reviewed|boolean|false|none|The model's own review flag|
|» awaiting_review|boolean|false|none|True while the model's flag or any upcoming scheduled price is unreviewed|
|» models_dev_flagged_at|string(date-time)¦null|false|none|none|
|» models_dev_mismatch_details|[object]¦null|false|none|Fields where models.dev disagrees with the stored value|
|» upcoming_prices|[object]|false|none|Scheduled, not-yet-effective prices, soonest first|
|»» id|integer|false|none|none|
|»» effective_start_at|string(date-time)|false|none|none|
|»» per_input_cost_per_token|number|false|none|none|
|»» per_output_cost_per_token|number|false|none|none|
|»» not_human_reviewed|boolean|false|none|none|
|»» source_url|string¦null|false|none|none|
|»» notes|string¦null|false|none|none|
|» agent_changes|object|false|none|Attribute => [before, after] for what Godfrey's last write changed|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Set a model's retirement date and notes

<a id="opIdset_a_models_retirement_date_and_notes"></a>

`PATCH /api/v2/llm_model_reviews/{id}`

Fixes a missing or wrong retirement date on a model awaiting review, so it can be approved
with the right data. Only `deprecated_at` and `deprecation_notes` are writable; send the keys
you want changed, and `null` (or an empty string) clears one. This does **not** approve the
model: call `POST .../pass` afterwards.

This never reaches clients: the retirement notice is queued when the model is approved, so a
mistyped date can still be corrected first. A moved or cleared date does retract a notice that no
longer holds, as the dashboard edit form does.
Coolhand's own private key only.

> Body parameter

```json
{
  "deprecated_at": "string",
  "deprecation_notes": "string"
}
```

<h3 id="set-a-model's-retirement-date-and-notes-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|body|body|object|false|none|
|» deprecated_at|body|string¦null|false|`YYYY-MM-DD` (midnight UTC) or an ISO 8601 timestamp|
|» deprecation_notes|body|string¦null|false|Shown to clients, e.g. the shutdown date and replacement|
|id|path|integer|true|none|

> Example responses

> 200 Response

```json
{
  "id": 0,
  "source_api": "string",
  "model": "string",
  "display_name": "string",
  "slug": "string",
  "sources": "string",
  "per_input_cost_per_token": 0,
  "per_output_cost_per_token": 0,
  "deprecated_at": "2019-08-24T14:15:22Z",
  "deprecation_notes": "string",
  "not_human_reviewed": true,
  "awaiting_review": true,
  "models_dev_flagged_at": "2019-08-24T14:15:22Z",
  "models_dev_mismatch_details": [
    {}
  ],
  "upcoming_prices": [
    {
      "id": 0,
      "effective_start_at": "2019-08-24T14:15:22Z",
      "per_input_cost_per_token": 0,
      "per_output_cost_per_token": 0,
      "not_human_reviewed": true,
      "source_url": "string",
      "notes": "string"
    }
  ],
  "agent_changes": {}
}
```

<h3 id="set-a-model's-retirement-date-and-notes-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|updated|Inline|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|forbidden - a valid private key belonging to another client|Inline|
|409|[Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8)|conflict - not awaiting review|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable - unparseable date or nothing to change|Inline|

<h3 id="set-a-model's-retirement-date-and-notes-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|integer|false|none|none|
|» source_api|string|false|none|none|
|» model|string|false|none|none|
|» display_name|string¦null|false|none|none|
|» slug|string¦null|false|none|none|
|» sources|string¦null|false|none|Where the rates were read from|
|» per_input_cost_per_token|number|false|none|Live input rate, USD per token (x 1,000,000 for $/M)|
|» per_output_cost_per_token|number|false|none|Live output rate, USD per token|
|» deprecated_at|string(date-time)¦null|false|none|Retirement date. A future date is an announced retirement.|
|» deprecation_notes|string¦null|false|none|none|
|» not_human_reviewed|boolean|false|none|The model's own review flag|
|» awaiting_review|boolean|false|none|True while the model's flag or any upcoming scheduled price is unreviewed|
|» models_dev_flagged_at|string(date-time)¦null|false|none|none|
|» models_dev_mismatch_details|[object]¦null|false|none|Fields where models.dev disagrees with the stored value|
|» upcoming_prices|[object]|false|none|Scheduled, not-yet-effective prices, soonest first|
|»» id|integer|false|none|none|
|»» effective_start_at|string(date-time)|false|none|none|
|»» per_input_cost_per_token|number|false|none|none|
|»» per_output_cost_per_token|number|false|none|none|
|»» not_human_reviewed|boolean|false|none|none|
|»» source_url|string¦null|false|none|none|
|»» notes|string¦null|false|none|none|
|» agent_changes|object|false|none|Attribute => [before, after] for what Godfrey's last write changed|

Status Code **403**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **409**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|[string]|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|[string]|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Approve a model awaiting review

<a id="opIdapprove_a_model_awaiting_review"></a>

`POST /api/v2/llm_model_reviews/{id}/pass`

The API form of the admin Pass Review button: clears the review flags, confirms the model's
agent-scheduled prices, and for an announced retirement queues the client notice. Check the
rates and dates with `GET` first; there is no undo here.

There is intentionally no reject action. Rejecting can revert or delete the record, so it
stays in the admin dashboard.

Pass `ignore_mismatched_fields: true` to also stop the models.dev cross-check from
re-flagging the fields it currently disagrees on. Coolhand's own private key only.

> Body parameter

```json
{
  "ignore_mismatched_fields": true
}
```

<h3 id="approve-a-model-awaiting-review-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|body|body|object|false|none|
|» ignore_mismatched_fields|body|boolean|false|none|
|id|path|integer|true|none|

> Example responses

> 200 Response

```json
{
  "id": 0,
  "source_api": "string",
  "model": "string",
  "display_name": "string",
  "slug": "string",
  "sources": "string",
  "per_input_cost_per_token": 0,
  "per_output_cost_per_token": 0,
  "deprecated_at": "2019-08-24T14:15:22Z",
  "deprecation_notes": "string",
  "not_human_reviewed": true,
  "awaiting_review": true,
  "models_dev_flagged_at": "2019-08-24T14:15:22Z",
  "models_dev_mismatch_details": [
    {}
  ],
  "upcoming_prices": [
    {
      "id": 0,
      "effective_start_at": "2019-08-24T14:15:22Z",
      "per_input_cost_per_token": 0,
      "per_output_cost_per_token": 0,
      "not_human_reviewed": true,
      "source_url": "string",
      "notes": "string"
    }
  ],
  "agent_changes": {}
}
```

<h3 id="approve-a-model-awaiting-review-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|approved|Inline|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|forbidden - a valid private key belonging to another client|Inline|
|409|[Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8)|conflict - nothing to approve|Inline|

<h3 id="approve-a-model-awaiting-review-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|integer|false|none|none|
|» source_api|string|false|none|none|
|» model|string|false|none|none|
|» display_name|string¦null|false|none|none|
|» slug|string¦null|false|none|none|
|» sources|string¦null|false|none|Where the rates were read from|
|» per_input_cost_per_token|number|false|none|Live input rate, USD per token (x 1,000,000 for $/M)|
|» per_output_cost_per_token|number|false|none|Live output rate, USD per token|
|» deprecated_at|string(date-time)¦null|false|none|Retirement date. A future date is an announced retirement.|
|» deprecation_notes|string¦null|false|none|none|
|» not_human_reviewed|boolean|false|none|The model's own review flag|
|» awaiting_review|boolean|false|none|True while the model's flag or any upcoming scheduled price is unreviewed|
|» models_dev_flagged_at|string(date-time)¦null|false|none|none|
|» models_dev_mismatch_details|[object]¦null|false|none|Fields where models.dev disagrees with the stored value|
|» upcoming_prices|[object]|false|none|Scheduled, not-yet-effective prices, soonest first|
|»» id|integer|false|none|none|
|»» effective_start_at|string(date-time)|false|none|none|
|»» per_input_cost_per_token|number|false|none|none|
|»» per_output_cost_per_token|number|false|none|none|
|»» not_human_reviewed|boolean|false|none|none|
|»» source_url|string¦null|false|none|none|
|»» notes|string¦null|false|none|none|
|» agent_changes|object|false|none|Attribute => [before, after] for what Godfrey's last write changed|

Status Code **403**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **409**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|[string]|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-optimization-feedback-links">Optimization Feedback Links</h1>

## Link feedback as evidence

<a id="opIdlink_feedback_as_evidence"></a>

`POST /api/v2/optimizations/{optimization_id}/feedback_links`

Attaches an existing LlmRequestLogFeedback to an optimization as supporting evidence. Requires a private credential (the client's own private API key, a team member's UserClient private key, or an AdminClientCredential) or a Doorkeeper Bearer token - the public `api_key` is rejected on this endpoint. Breaking change: the response `id` field is now the evidence link's hashid (a string), not the internal integer primary key - pass it back as-is to the corresponding `DELETE .../{id}` endpoint; consumers that previously parsed or stored it as an integer need to treat it as an opaque string.

> Body parameter

```json
{
  "feedback_id": "string",
  "feedback_ids": [
    "string"
  ],
  "note": "string"
}
```

<h3 id="link-feedback-as-evidence-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|optimization_id|path|string|true|Optimization hashid|
|X-API-Key|header|string|false|Any of this client's private credentials (see description) - not the public api_key|
|Authorization|header|string|false|Bearer token with the private API key, or a Doorkeeper access token|
|body|body|object|true|none|
|» feedback_id|body|string|false|Feedback hashid to link|
|» feedback_ids|body|[string]|false|Bulk mode, used instead of `feedback_id`: up to 100 feedback hashids to link in one call. The response is `{ linked, already_linked, errored, not_found }` (status 200; `errored` counts links that failed for another reason). Already-linked ids are counted, and unknown, malformed and other-client ids are all reported together in `not_found`. Invalid input returns 422.|
|» note|body|string¦null|false|Optional note explaining the link|

> Example responses

> 200 Response

```json
{
  "linked": 0,
  "already_linked": 0,
  "errored": 0,
  "not_found": [
    "string"
  ]
}
```

<h3 id="link-feedback-as-evidence-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|bulk mode - feedback_ids linked|Inline|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - public (write-only) key cannot link evidence|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - feedback does not belong to this client|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - feedback is already linked to this optimization|Inline|

<h3 id="link-feedback-as-evidence-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» linked|integer|true|none|none|
|» already_linked|integer|true|none|none|
|» errored|integer|true|none|none|
|» not_found|[string]|true|none|none|

Status Code **201**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|The evidence link's hashid - pass this back as the :id path param to unlink it|
|» optimization_id|string|false|none|Optimization hashid|
|» note|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» feedback_id|string|false|none|Feedback hashid|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|[string]|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Unlink feedback evidence

<a id="opIdunlink_feedback_evidence"></a>

`DELETE /api/v2/optimizations/{optimization_id}/feedback_links/{id}`

Removes a feedback-evidence link from an optimization. Requires a private credential (see the create operation's description) - the public `api_key` is rejected.

<h3 id="unlink-feedback-evidence-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|optimization_id|path|string|true|Optimization hashid|
|id|path|string|true|The link's hashid, as returned in the create response's `id` field. Breaking change: this was previously the raw integer primary key.|
|X-API-Key|header|string|false|Any of this client's private credentials (see description) - not the public api_key|
|Authorization|header|string|false|Bearer token with the private API key, or a Doorkeeper access token|

> Example responses

> 401 Response

```json
{
  "error": "string"
}
```

<h3 id="unlink-feedback-evidence-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|success - no content|None|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - link does not exist|Inline|

<h3 id="unlink-feedback-evidence-responseschema">Response Schema</h3>

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-optimization-log-links">Optimization Log Links</h1>

## Link an LLM request log as evidence

<a id="opIdlink_an_llm_request_log_as_evidence"></a>

`POST /api/v2/optimizations/{optimization_id}/log_links`

Attaches an existing LlmRequestLog to an optimization as supporting evidence. Requires a private credential (see the feedback-links create operation's description) - the public `api_key` is rejected on this endpoint.

> Body parameter

```json
{
  "log_id": "string",
  "note": "string"
}
```

<h3 id="link-an-llm-request-log-as-evidence-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|optimization_id|path|string|true|Optimization hashid|
|X-API-Key|header|string|false|Any of this client's private credentials (see description) - not the public api_key|
|Authorization|header|string|false|Bearer token with the private API key, or a Doorkeeper access token|
|body|body|object|true|none|
|» log_id|body|string|true|LLM request log hashid to link|
|» note|body|string¦null|false|Optional note explaining the link|

> Example responses

> 201 Response

```json
{
  "id": "string",
  "optimization_id": "string",
  "note": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "log_id": "string"
}
```

<h3 id="link-an-llm-request-log-as-evidence-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - public (write-only) key cannot link evidence|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - log does not belong to this client|Inline|

<h3 id="link-an-llm-request-log-as-evidence-responseschema">Response Schema</h3>

Status Code **201**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|The evidence link's hashid - pass this back as the :id path param to unlink it|
|» optimization_id|string|false|none|Optimization hashid|
|» note|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» log_id|string|false|none|LLM request log hashid|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Unlink log evidence

<a id="opIdunlink_log_evidence"></a>

`DELETE /api/v2/optimizations/{optimization_id}/log_links/{id}`

Removes a log-evidence link from an optimization. Requires a private credential (see the create operation's description) - the public `api_key` is rejected.

<h3 id="unlink-log-evidence-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|optimization_id|path|string|true|Optimization hashid|
|id|path|string|true|The link's hashid, as returned in the create response's `id` field. Breaking change: this was previously the raw integer primary key.|
|X-API-Key|header|string|false|Any of this client's private credentials (see description) - not the public api_key|
|Authorization|header|string|false|Bearer token with the private API key, or a Doorkeeper access token|

> Example responses

> 401 Response

```json
{
  "error": "string"
}
```

<h3 id="unlink-log-evidence-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|success - no content|None|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - link does not exist|Inline|

<h3 id="unlink-log-evidence-responseschema">Response Schema</h3>

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-optimization-eval-links">Optimization Eval Links</h1>

## Link an LLM request eval as evidence

<a id="opIdlink_an_llm_request_eval_as_evidence"></a>

`POST /api/v2/optimizations/{optimization_id}/eval_links`

Attaches an existing LlmRequestEval to an optimization as supporting evidence. Requires a private credential (see the feedback-links create operation's description) - the public `api_key` is rejected on this endpoint.

> Body parameter

```json
{
  "eval_id": "string",
  "note": "string"
}
```

<h3 id="link-an-llm-request-eval-as-evidence-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|optimization_id|path|string|true|Optimization hashid|
|X-API-Key|header|string|false|Any of this client's private credentials (see description) - not the public api_key|
|Authorization|header|string|false|Bearer token with the private API key, or a Doorkeeper access token|
|body|body|object|true|none|
|» eval_id|body|string|true|LLM request eval hashid to link|
|» note|body|string¦null|false|Optional note explaining the link|

> Example responses

> 201 Response

```json
{
  "id": "string",
  "optimization_id": "string",
  "note": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "eval_id": "string"
}
```

<h3 id="link-an-llm-request-eval-as-evidence-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|success|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - public (write-only) key cannot link evidence|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - eval does not belong to this client|Inline|

<h3 id="link-an-llm-request-eval-as-evidence-responseschema">Response Schema</h3>

Status Code **201**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|false|none|The evidence link's hashid - pass this back as the :id path param to unlink it|
|» optimization_id|string|false|none|Optimization hashid|
|» note|string¦null|false|none|none|
|» created_at|string(date-time)|false|none|none|
|» eval_id|string|false|none|LLM request eval hashid|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

## Unlink eval evidence

<a id="opIdunlink_eval_evidence"></a>

`DELETE /api/v2/optimizations/{optimization_id}/eval_links/{id}`

Removes an eval-evidence link from an optimization. Requires a private credential (see the create operation's description) - the public `api_key` is rejected.

<h3 id="unlink-eval-evidence-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|optimization_id|path|string|true|Optimization hashid|
|id|path|string|true|The link's hashid, as returned in the create response's `id` field. Breaking change: this was previously the raw integer primary key.|
|X-API-Key|header|string|false|Any of this client's private credentials (see description) - not the public api_key|
|Authorization|header|string|false|Bearer token with the private API key, or a Doorkeeper access token|

> Example responses

> 401 Response

```json
{
  "error": "string"
}
```

<h3 id="unlink-eval-evidence-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|success - no content|None|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing API key|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - link does not exist|Inline|

<h3 id="unlink-eval-evidence-responseschema">Response Schema</h3>

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-optimizations">Optimizations</h1>

## List Optimizations

<a id="opIdlist_optimizations"></a>

`GET /api/v2/optimizations`

Returns this client's optimizations — Coolhand's recommendations for cheaper, faster or better
prompts and workflows — as a bare JSON array, highest impact first by default. Pagination
metadata is exposed via the `X-Page`, `X-Per-Page`, `X-Total-Count` and `X-Total-Pages`
response headers.

Use it to see what already exists before proposing something new. A dismissed optimization
carries `dismissal_explanation` and `dismissed_by`, and a reopened one `reopen_explanation`
and `reopened_at`. `pr_number` and `pr_url` are present once a pull or merge request is linked,
and `optimization_thesis` when the optimization has one. `warnings` is an array of annotations
(`kind`, `message`, `reason`, `feedback_ids`, `feedback_workload_ids`, `created_at`) and is present
when something needs a reviewer's attention, for example feedback linked from a different
workload. These fields are omitted, not null, when they don't apply.

An id filter (`optimization_id`, `template_id`, `workload_id`) that doesn't belong to this
client returns 404, identical to one that doesn't exist.

The client is always derived from the authenticating API key. Requires the **private**
API key.

<h3 id="list-optimizations-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Private API key for authentication|
|Authorization|header|string|false|Bearer token with the private API key|
|optimization_id|query|string|false|Only this optimization|
|template_id|query|string|false|Only optimizations on this template|
|workload_id|query|string|false|Only optimizations on templates in this workload|
|status|query|string|false|Filter by status|
|optimization_type|query|string|false|Filter by optimization type|
|category|query|string|false|Filter by category|
|search|query|string|false|Case-insensitive substring match against title, analysis or plan|
|days_back|query|integer|false|Only optimizations created (or reopened) within this many days|
|sort_by|query|string|false|Sort order (default: impact_desc, highest impact first)|
|page|query|integer|false|Page number|
|per|query|integer|false|Records per page (default 25, max 100; per_page also accepted)|
|per_page|query|integer|false|Alias for per (same 25/100 bounds)|

#### Enumerated Values

|Parameter|Value|
|---|---|
|status|draft|
|status|proposed|
|status|dismissed|
|status|completed|
|status|queued|
|optimization_type|improvement|
|optimization_type|suggestion|
|optimization_type|setup|
|optimization_type|error_fix|
|optimization_type|operational|
|optimization_type|wildcard_report|
|category|cost_reduction|
|category|quality_improvement|
|category|maintenance|
|category|feature_suggestion|
|category|best_practices|
|category|model_deprecation|
|category|system_one_migration|
|category|task_decomposition|
|category|runtime_tool_install|
|sort_by|impact_desc|
|sort_by|complexity_asc|
|sort_by|created_at_desc|

> Example responses

> 200 Response

```json
[
  {
    "id": "string",
    "title": "string",
    "status": "draft",
    "optimization_type": "improvement",
    "category": "cost_reduction",
    "complexity": "string",
    "impact": "string",
    "client_name": "string",
    "template_id": "string",
    "template_name": "string",
    "workload_name": "string",
    "created_at": "2019-08-24T14:15:22Z"
  }
]
```

<h3 id="list-optimizations-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|returns this client's optimizations, highest impact first, with pagination headers|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing or invalid private API key|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - an id filter doesn't match one of this client's records|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable entity - sort_by, status, optimization_type, category or days_back is invalid|Inline|
|504|[Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5)|gateway timeout - the query exceeded the statement timeout|Inline|

<h3 id="list-optimizations-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|string|true|none|none|
|» title|string|true|none|none|
|» status|string|true|none|none|
|» optimization_type|string|true|none|none|
|» category|string¦null|true|none|none|
|» complexity|string¦null|true|none|none|
|» impact|string¦null|true|none|none|
|» client_name|string¦null|true|none|none|
|» template_id|string¦null|true|none|none|
|» template_name|string¦null|true|none|none|
|» workload_name|string¦null|true|none|none|
|» created_at|string(date-time)|true|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|status|draft|
|status|proposed|
|status|dismissed|
|status|completed|
|status|queued|
|optimization_type|improvement|
|optimization_type|suggestion|
|optimization_type|setup|
|optimization_type|error_fix|
|optimization_type|operational|
|optimization_type|wildcard_report|
|category|cost_reduction|
|category|quality_improvement|
|category|maintenance|
|category|feature_suggestion|
|category|best_practices|
|category|model_deprecation|
|category|system_one_migration|
|category|task_decomposition|
|category|runtime_tool_install|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

Status Code **504**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|object|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
privateApiKey, bearerAuth
</aside>

<h1 id="coolhand-llm-request-logging-api-osx-desktop-versions">OSX Desktop Versions</h1>

## Check the latest and minimum-supported version of the Coolhand macOS desktop app

<a id="opIdcheck_the_latest_and_minimumsupported_version_of_the_coolhand_macos_desktop_app"></a>

`GET /api/v2/osx_desktop_versions`

Returns the most recent released version of the Coolhand macOS desktop app, plus the
oldest version still supported against the API, so the (unsigned, non-auto-updating)
desktop client can show an update banner on launch. Backed by a hand-maintained config
file, not a database table — see OsxDesktopVersionCatalog.

**Authentication:**
Authentication is optional. Unauthenticated callers are rate-limited (see below).
Callers authenticated with a **private** API key bypass the rate limit entirely. Pass it
via the `X-API-Key` header or as a `Bearer` token in the `Authorization` header. A public
API key is accepted but does not lift the limit — it is designed to be published in web
pages, so it can't prove who is calling.

**Filtering:**
With no `q[...]` filter, this returns the single most recent release. Pass
`q[version_eq]=<version>` to fetch a specific past release's metadata instead —
`minimum_supported_version` in the response is always the current floor regardless of
which release the filter matched. This is the only supported filter (not real Ransack —
this data isn't database-backed).

**Rate limiting:**
Unauthenticated requests are rate limited to 1 request per minute per IP address.
Exceeding the limit returns a `429 Too Many Requests` response. Authenticated requests
are never rate limited.

<h3 id="check-the-latest-and-minimum-supported-version-of-the-coolhand-macos-desktop-app-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|API key for authentication|
|Authorization|header|string|false|Bearer token with API key|
|q[version_eq]|query|string|false|Fetch a specific past release by exact version string instead of the most recent.|
|q[version_cont]|query|string|false|NOT a supported filter — version_eq is the only recognized predicate. Documented here only to show the resulting contract: an unrecognized predicate returns 400.|

> Example responses

> 200 Response

```json
{
  "latest_version": "string",
  "minimum_supported_version": "string",
  "released_at": "2019-08-24T14:15:22Z",
  "download_url": "string",
  "release_notes_url": "string"
}
```

<h3 id="check-the-latest-and-minimum-supported-version-of-the-coolhand-macos-desktop-app-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|invalid filter|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - invalid API key|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|no matching version|Inline|
|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|rate limit exceeded|Inline|

<h3 id="check-the-latest-and-minimum-supported-version-of-the-coolhand-macos-desktop-app-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» latest_version|string|true|none|Semver, no 'v' prefix. The most recent release matching the filter (or overall, with no filter).|
|» minimum_supported_version|string¦null|true|none|Semver. The oldest build still allowed against the API — a nag, not a kill switch. Independent of the version_eq filter above. Null if no release is currently flagged as the floor.|
|» released_at|string(date-time)¦null|true|none|ISO 8601 timestamp.|
|» download_url|string|true|none|Stable coolhandlabs.com URL that redirects to the current installer — see DownloadsController. Not a raw storage-provider URL, so it stays valid even if the backing storage moves.|
|» release_notes_url|string¦null|true|none|Shown as a 'What's new' link.|

Status Code **400**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **429**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
publicApiKey, bearerAuth, None
</aside>

<h1 id="coolhand-llm-request-logging-api-public-content">Public Content</h1>

## List and search public content

<a id="opIdlist_and_search_public_content"></a>

`GET /api/v2/public_content`

Lists the published Coolhand help center. This is the same content served as HTML at
`/help/:slug` and as markdown at `/help/:slug.md`.

**Authentication:** optional for reads. Unauthenticated callers are rate limited to 30
requests per minute; authenticated callers are not. Pass a key via the `X-API-Key`
header, as a `Bearer` token, or as the `api_key` query parameter.

**Writes:** editing a page that is already published does not change it. The change is
queued as a revision for a human to approve and the response is `202` with the revision
attached; the live page is untouched. Drafts and archived pages are updated in place (`200`).
`DELETE` archives rather than destroys.

**Search:** pass `q=your query` for relevance-ranked results. This runs the same Postgres
full-text query the website's own search uses, so the API and the site rank identically.
Quoted phrases, `-exclusions` and `or` are supported. Each result carries a
`search_headline` — the matching passage with `<mark>` tags around the matched terms — so
you can see why something matched without fetching its body.

`q` also accepts the structured filter form, in which case relevance search moves to the
`full_text` key: `q[full_text]=your query`, `q[tags_cont]`, `q[article_kind_eq]`,
`q[help_category_slug_eq]`, `q[s]=published_at desc`.

Note that `q[body_cont]` is deliberately not supported — an unbounded substring scan over
multi-KB markdown has no supporting index. Use `q[full_text]` instead.

**Pagination:** `page` and `per_page` (max 100). Totals are returned in the `X-Page`,
`X-Per-Page`, `X-Total-Count` and `X-Total-Pages` response headers. Article bodies are
omitted from list responses; fetch a single article for the full markdown.

<h3 id="list-and-search-public-content-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Coolhand API key. Optional; raises the rate limit when supplied.|
|q|query|string|false|Relevance search. Supports quoted phrases, -exclusions and `or`. Omit for a full listing. A search leaves out `noindex` pages for callers other than Coolhand's own agent; the listing does not.|
|category|query|string|false|Restrict to one section slug (see `/categories`). Applies to the bare `q` search and to a plain listing.|
|corpus|query|string|false|`help` returns only /help pages, leaving out /updates posts. Same scope as `category`.:|
|page|query|integer|false|none|
|per_page|query|integer|false|Results per page. Maximum 100, default 25.|

#### Detailed descriptions

**corpus**: `help` returns only /help pages, leaving out /updates posts. Same scope as `category`.:
 * `help` 
 

> Example responses

> 200 Response

```json
[
  {
    "slug": "string",
    "title": "string",
    "answer": "string",
    "article_kind": "reference",
    "tags": [
      "string"
    ],
    "category": "string",
    "url": "string",
    "markdown_url": "string",
    "reading_time_minutes": 0,
    "search_headline": "string",
    "published_at": "2019-08-24T14:15:22Z",
    "updated_content_at": "2019-08-24T14:15:22Z"
  }
]
```

<h3 id="list-and-search-public-content-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - invalid API key|Inline|

<h3 id="list-and-search-public-content-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» slug|string|false|none|URL-safe identifier; also the article's path under /help|
|» title|string|false|none|none|
|» answer|string¦null|false|none|A short, self-contained answer to the question the article addresses|
|» article_kind|string|false|none|none|
|» tags|[string]|false|none|none|
|» category|string|false|none|Slug of the section this article belongs to|
|» url|string|false|none|Public HTML page|
|» markdown_url|string|false|none|Machine-readable markdown twin of the same page|
|» reading_time_minutes|integer¦null|false|none|none|
|» search_headline|string¦null|false|none|On a relevance search, the matching passage with <mark> tags around the matched terms. Null on a plain listing.|
|» published_at|string(date-time)¦null|false|none|none|
|» updated_content_at|string(date-time)¦null|false|none|When the prose last changed. Not bumped by background re-renders.|

#### Enumerated Values

|Property|Value|
|---|---|
|article_kind|reference|
|article_kind|concept|
|article_kind|how_to|
|article_kind|troubleshooting|
|article_kind|faq_answer|
|article_kind|release_note|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="success">
This operation does not require authentication
</aside>

## Create a help center article

<a id="opIdcreate_a_help_center_article"></a>

`POST /api/v2/public_content`

Creates a help center article.

**This endpoint is not available to customer API keys.** It edits pages on
coolhandlabs.com rather than tenant-scoped data, so it accepts only Coolhand's own
private client key. A valid private key belonging to any other client receives `403`.
Per-user credentials (a `UserClient` or an `AdminClientCredential`) are also rejected,
even for Coolhand, so authorship of public pages is never attributed to an individual's
personal key.

Articles are drafted by Coolhand's automated help center agents and are **human-reviewed
before publication**: a created article always lands as an unreviewed `draft`, whatever
status is supplied. Publication happens through the admin interface.

> Body parameter

```json
{
  "slug": "string",
  "title": "string",
  "answer": "string",
  "body": "string",
  "category_slug": "string",
  "article_kind": "reference",
  "tags": [
    "string"
  ],
  "source_refs": [
    "string"
  ]
}
```

<h3 id="create-a-help-center-article-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|body|body|object|false|none|
|» slug|body|string|true|URL-safe identifier, lowercase with hyphens|
|» title|body|string|true|none|
|» answer|body|string|false|40-60 word self-contained answer. Required before the article can be published.|
|» body|body|string|true|Markdown. Cross-reference other articles with [[slug]].|
|» category_slug|body|string|true|Must reference an existing section; list them with `GET /api/v2/public_content/categories`|
|» article_kind|body|string|false|none|
|» tags|body|[string]|false|Free-form unless the section restricts them (see `allowed_tags` on `/categories`); a disallowed tag is refused with `422`.|
|» source_refs|body|[string]|false|Docs, spec operations or source files this article was derived from|

#### Enumerated Values

|Parameter|Value|
|---|---|
|» article_kind|reference|
|» article_kind|concept|
|» article_kind|how_to|
|» article_kind|troubleshooting|
|» article_kind|faq_answer|
|» article_kind|release_note|

> Example responses

> 401 Response

```json
{
  "error": "string"
}
```

<h3 id="create-a-help-center-article-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|created|None|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - missing or public key|Inline|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|forbidden - a valid private key belonging to another client|Inline|
|409|[Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8)|conflict - that slug already exists|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable - a tag outside the section's vocabulary|Inline|

<h3 id="create-a-help-center-article-responseschema">Response Schema</h3>

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **403**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **409**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|[string]|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|[string]|false|none|none|

<aside class="success">
This operation does not require authentication
</aside>

## List sections and their tag vocabulary

<a id="opIdlist_sections_and_their_tag_vocabulary"></a>

`GET /api/v2/public_content/categories`

Lists every section an article can be filed under, with the URL prefix it is served from and
the tags it accepts. Use a section's `slug` as `category_slug` on create.

**Authentication:** optional, rate limited like the other reads.

<h3 id="list-sections-and-their-tag-vocabulary-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|Coolhand API key. Optional; raises the rate limit when supplied.|

> Example responses

> 200 Response

```json
[
  {
    "slug": "string",
    "name": "string",
    "title": "string",
    "description": "string",
    "url_prefix": "/help",
    "position": 0,
    "sort_strategy": "position",
    "og_image_url": "string",
    "allowed_tags": [
      "string"
    ]
  }
]
```

<h3 id="list-sections-and-their-tag-vocabulary-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|unauthorized - invalid API key|Inline|

<h3 id="list-sections-and-their-tag-vocabulary-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» slug|string|false|none|Pass as `category_slug` when creating an article|
|» name|string|false|none|none|
|» title|string¦null|false|none|Page title; falls back to `name` when null|
|» description|string|false|none|Intro copy; the section page's meta description|
|» url_prefix|string|false|none|Where this section's articles are served|
|» position|integer|false|none|Order in the help sidebar|
|» sort_strategy|string|false|none|none|
|» og_image_url|string¦null|false|none|https share image|
|» allowed_tags|[string]¦null|false|none|The only tags this section accepts. Null means any tag is accepted; an empty array means none are.|

#### Enumerated Values

|Property|Value|
|---|---|
|url_prefix|/help|
|url_prefix|/updates|
|sort_strategy|position|
|sort_strategy|published_at_desc|

Status Code **401**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

<aside class="success">
This operation does not require authentication
</aside>

## Create a section

<a id="opIdcreate_a_section"></a>

`POST /api/v2/public_content/categories`

Creates a `/help` section. Like every write on this surface it accepts only Coolhand's own
private client key, and an agent identity is refused. A section's URL prefix is not a field: the
`/updates` feed is the single built-in `updates` section.

Sections are structure rather than prose, so a change applies immediately instead of going
through the revision queue. A new section stays out of the help navigation until it holds a
published article.

> Body parameter

```json
{
  "slug": "string",
  "name": "string",
  "title": "string",
  "description": "string",
  "position": 0,
  "sort_strategy": "position",
  "og_image_url": "string",
  "allowed_tags": [
    "string"
  ]
}
```

<h3 id="create-a-section-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|body|body|object|false|none|
|» slug|body|string|true|Lowercase with hyphens. Fixed once created.|
|» name|body|string|true|none|
|» title|body|string|false|none|
|» description|body|string|true|none|
|» position|body|integer|false|Non-negative integer. Defaults to after the last section.|
|» sort_strategy|body|string|false|none|
|» og_image_url|body|string|false|https URL|
|» allowed_tags|body|[string]¦null|false|Omit or send null to accept any tag|

#### Enumerated Values

|Parameter|Value|
|---|---|
|» sort_strategy|position|
|» sort_strategy|published_at_desc|

> Example responses

> 201 Response

```json
{
  "slug": "string",
  "name": "string",
  "title": "string",
  "description": "string",
  "url_prefix": "/help",
  "position": 0,
  "sort_strategy": "position",
  "og_image_url": "string",
  "allowed_tags": [
    "string"
  ]
}
```

<h3 id="create-a-section-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|created|Inline|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|forbidden - a valid private key belonging to another client|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable - a taken slug, an invalid value or an agent identity|Inline|

<h3 id="create-a-section-responseschema">Response Schema</h3>

Status Code **201**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» slug|string|false|none|Pass as `category_slug` when creating an article|
|» name|string|false|none|none|
|» title|string¦null|false|none|Page title; falls back to `name` when null|
|» description|string|false|none|Intro copy; the section page's meta description|
|» url_prefix|string|false|none|Where this section's articles are served|
|» position|integer|false|none|Order in the help sidebar|
|» sort_strategy|string|false|none|none|
|» og_image_url|string¦null|false|none|https share image|
|» allowed_tags|[string]¦null|false|none|The only tags this section accepts. Null means any tag is accepted; an empty array means none are.|

#### Enumerated Values

|Property|Value|
|---|---|
|url_prefix|/help|
|url_prefix|/updates|
|sort_strategy|position|
|sort_strategy|published_at_desc|

Status Code **403**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|[string]|false|none|none|

<aside class="success">
This operation does not require authentication
</aside>

## Edit a section

<a id="opIdedit_a_section"></a>

`PATCH /api/v2/public_content/categories/{slug}`

Edits a section's text, order, tag vocabulary or share image. Same authorization as create.

A section's slug is its path and cannot change: it is in the section page's URL, and a rename
would re-address indexed pages with no redirect. Narrowing `allowed_tags` is refused while an
article in the section carries a tag the new list drops, since every later edit of that article
would fail validation. The `updates` section's `allowed_tags` is defined in code and cannot be
edited.

> Body parameter

```json
{
  "name": "string",
  "title": "string",
  "description": "string",
  "position": 0,
  "sort_strategy": "position",
  "og_image_url": "string",
  "allowed_tags": [
    "string"
  ]
}
```

<h3 id="edit-a-section-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|body|body|object|false|none|
|» name|body|string|false|none|
|» title|body|string|false|none|
|» description|body|string|false|none|
|» position|body|integer|false|none|
|» sort_strategy|body|string|false|none|
|» og_image_url|body|string|false|none|
|» allowed_tags|body|[string]¦null|false|Send null to remove the restriction; [] permits no tags|
|slug|path|string|true|Section slug|

#### Enumerated Values

|Parameter|Value|
|---|---|
|» sort_strategy|position|
|» sort_strategy|published_at_desc|

> Example responses

> 200 Response

```json
{
  "slug": "string",
  "name": "string",
  "title": "string",
  "description": "string",
  "url_prefix": "/help",
  "position": 0,
  "sort_strategy": "position",
  "og_image_url": "string",
  "allowed_tags": [
    "string"
  ]
}
```

<h3 id="edit-a-section-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|updated|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - no section with that slug|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable - an invalid value or tags that would strand articles|Inline|

<h3 id="edit-a-section-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» slug|string|false|none|Pass as `category_slug` when creating an article|
|» name|string|false|none|none|
|» title|string¦null|false|none|Page title; falls back to `name` when null|
|» description|string|false|none|Intro copy; the section page's meta description|
|» url_prefix|string|false|none|Where this section's articles are served|
|» position|integer|false|none|Order in the help sidebar|
|» sort_strategy|string|false|none|none|
|» og_image_url|string¦null|false|none|https share image|
|» allowed_tags|[string]¦null|false|none|The only tags this section accepts. Null means any tag is accepted; an empty array means none are.|

#### Enumerated Values

|Property|Value|
|---|---|
|url_prefix|/help|
|url_prefix|/updates|
|sort_strategy|position|
|sort_strategy|published_at_desc|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|[string]|false|none|none|

<aside class="success">
This operation does not require authentication
</aside>

## Delete a section

<a id="opIddelete_a_section"></a>

`DELETE /api/v2/public_content/categories/{slug}`

Deletes a section, returning it. Only an empty section can be deleted: one that still holds any
article, including drafts and archived ones, is refused with `422`, and so is `updates`.

<h3 id="delete-a-section-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|slug|path|string|true|Section slug|

> Example responses

> 200 Response

```json
{
  "slug": "string",
  "name": "string",
  "title": "string",
  "description": "string",
  "url_prefix": "/help",
  "position": 0,
  "sort_strategy": "position",
  "og_image_url": "string",
  "allowed_tags": [
    "string"
  ]
}
```

<h3 id="delete-a-section-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|deleted|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable - the section still holds articles, or is `updates`|Inline|

<h3 id="delete-a-section-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» slug|string|false|none|Pass as `category_slug` when creating an article|
|» name|string|false|none|none|
|» title|string¦null|false|none|Page title; falls back to `name` when null|
|» description|string|false|none|Intro copy; the section page's meta description|
|» url_prefix|string|false|none|Where this section's articles are served|
|» position|integer|false|none|Order in the help sidebar|
|» sort_strategy|string|false|none|none|
|» og_image_url|string¦null|false|none|https share image|
|» allowed_tags|[string]¦null|false|none|The only tags this section accepts. Null means any tag is accepted; an empty array means none are.|

#### Enumerated Values

|Property|Value|
|---|---|
|url_prefix|/help|
|url_prefix|/updates|
|sort_strategy|position|
|sort_strategy|published_at_desc|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|[string]|false|none|none|

<aside class="success">
This operation does not require authentication
</aside>

## Fetch a single public page

<a id="opIdfetch_a_single_public_page"></a>

`GET /api/v2/public_content/{slug}`

Returns one article including its full markdown body and table of contents. Only
published articles are visible; drafts return `404` to everyone except Coolhand's own
agent credential.

<h3 id="fetch-a-single-public-page-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|false|none|
|slug|path|string|true|Article slug|

> Example responses

> 200 Response

```json
{
  "slug": "string",
  "title": "string",
  "answer": "string",
  "article_kind": "reference",
  "tags": [
    "string"
  ],
  "category": "string",
  "url": "string",
  "markdown_url": "string",
  "reading_time_minutes": 0,
  "published_at": "2019-08-24T14:15:22Z",
  "updated_content_at": "2019-08-24T14:15:22Z",
  "body": "string",
  "noindex": true,
  "toc": [
    {}
  ]
}
```

<h3 id="fetch-a-single-public-page-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found|None|

<h3 id="fetch-a-single-public-page-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» slug|string|false|none|URL-safe identifier; also the article's path under /help|
|» title|string|false|none|none|
|» answer|string¦null|false|none|A short, self-contained answer to the question the article addresses|
|» article_kind|string|false|none|none|
|» tags|[string]|false|none|none|
|» category|string|false|none|Slug of the section this article belongs to|
|» url|string|false|none|Public HTML page|
|» markdown_url|string|false|none|Machine-readable markdown twin of the same page|
|» reading_time_minutes|integer¦null|false|none|none|
|» published_at|string(date-time)¦null|false|none|none|
|» updated_content_at|string(date-time)¦null|false|none|When the prose last changed. Not bumped by background re-renders.|
|» body|string|false|none|Full markdown source|
|» noindex|boolean|false|none|none|
|» toc|[object]|false|none|Extracted heading structure, nested h3s under their h2|

#### Enumerated Values

|Property|Value|
|---|---|
|article_kind|reference|
|article_kind|concept|
|article_kind|how_to|
|article_kind|troubleshooting|
|article_kind|faq_answer|
|article_kind|release_note|

<aside class="success">
This operation does not require authentication
</aside>

## Update a help center article

<a id="opIdupdate_a_help_center_article"></a>

`PATCH /api/v2/public_content/{slug}`

Updates an existing article. Same authorization rule as create: Coolhand's own private
client key only.

Every write is attributed in the article's version history, and flags the article as
needing human review.

**Editing a published article does not change it.** Live pages are indexed, so a change to
one is queued as a revision for a human to approve and the response is `202` with the
revision attached; the live page is untouched. Drafts and archived articles are written
through directly (`200`).

These are refused with `422` rather than queued, on a published page as well: a tag the target
section does not allow, a `category_slug` that names no section, and an unknown
`article_kind`. When the request also moves the page, tags are checked against the destination
section.

> Body parameter

```json
{
  "title": "string",
  "answer": "string",
  "body": "string",
  "category_slug": "string",
  "article_kind": "string",
  "tags": [
    "string"
  ],
  "source_refs": [
    "string"
  ]
}
```

<h3 id="update-a-help-center-article-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|body|body|object|false|none|
|» title|body|string|false|none|
|» answer|body|string|false|none|
|» body|body|string|false|none|
|» category_slug|body|string|false|none|
|» article_kind|body|string|false|none|
|» tags|body|[string]|false|Free-form unless the section restricts them (see `allowed_tags` on `/categories`).|
|» source_refs|body|[string]|false|none|
|slug|path|string|true|Article slug|

> Example responses

> 202 Response

```json
{
  "slug": "string",
  "title": "string",
  "answer": "string",
  "article_kind": "reference",
  "tags": [
    "string"
  ],
  "category": "string",
  "url": "string",
  "markdown_url": "string",
  "reading_time_minutes": 0,
  "published_at": "2019-08-24T14:15:22Z",
  "updated_content_at": "2019-08-24T14:15:22Z",
  "body": "string",
  "noindex": true,
  "toc": [
    {}
  ],
  "status": "string",
  "not_human_reviewed": true,
  "source_refs": [
    "string"
  ],
  "last_edited_by": "string",
  "revision": {
    "id": 0,
    "status": "string",
    "author": "string",
    "stale": true,
    "changed_fields": [
      "string"
    ]
  }
}
```

<h3 id="update-a-help-center-article-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|updated|None|
|202|[Accepted](https://tools.ietf.org/html/rfc7231#section-6.3.3)|accepted - the page is published, so the change was queued for review|Inline|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|forbidden - another client's private key|Inline|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|not found - no page with that slug|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable - a disallowed tag, an unknown category_slug or an unknown article_kind|Inline|

<h3 id="update-a-help-center-article-responseschema">Response Schema</h3>

Status Code **202**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» slug|string|false|none|URL-safe identifier; also the article's path under /help|
|» title|string|false|none|none|
|» answer|string¦null|false|none|A short, self-contained answer to the question the article addresses|
|» article_kind|string|false|none|none|
|» tags|[string]|false|none|none|
|» category|string|false|none|Slug of the section this article belongs to|
|» url|string|false|none|Public HTML page|
|» markdown_url|string|false|none|Machine-readable markdown twin of the same page|
|» reading_time_minutes|integer¦null|false|none|none|
|» published_at|string(date-time)¦null|false|none|none|
|» updated_content_at|string(date-time)¦null|false|none|When the prose last changed. Not bumped by background re-renders.|
|» body|string|false|none|Full markdown source|
|» noindex|boolean|false|none|none|
|» toc|[object]|false|none|Extracted heading structure, nested h3s under their h2|
|» status|string|false|none|none|
|» not_human_reviewed|boolean|false|none|none|
|» source_refs|[string]|false|none|none|
|» last_edited_by|string|false|none|none|
|» revision|object|false|none|none|
|»» id|integer|false|none|none|
|»» status|string|false|none|none|
|»» author|string|false|none|none|
|»» stale|boolean|false|none|The page changed after this revision was written.|
|»» changed_fields|[string]|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|article_kind|reference|
|article_kind|concept|
|article_kind|how_to|
|article_kind|troubleshooting|
|article_kind|faq_answer|
|article_kind|release_note|

Status Code **403**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **404**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» error|string|false|none|none|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|[string]|false|none|none|

<aside class="success">
This operation does not require authentication
</aside>

## Archive a page

<a id="opIdarchive_a_page"></a>

`DELETE /api/v2/public_content/{slug}`

Soft delete. The page stops being served and drops out of both feeds, `llms.txt` and the
sitemap; inbound `[[slug]]` cross-links degrade to plain text. The row, its history and its
slug all survive, and the URL then answers **410 Gone** rather than 404 — it was indexed,
and 410 gets it dropped promptly. Restore it with `PATCH` and `status: "published"`.

Retiring a page is a publication decision, so an agent identity is refused here for the same
reason it may not publish. Revisions still queued against the page are closed.

<h3 id="archive-a-page-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|slug|path|string|true|Article slug|

> Example responses

> 200 Response

```json
{
  "slug": "string",
  "title": "string",
  "answer": "string",
  "article_kind": "reference",
  "tags": [
    "string"
  ],
  "category": "string",
  "url": "string",
  "markdown_url": "string",
  "reading_time_minutes": 0,
  "published_at": "2019-08-24T14:15:22Z",
  "updated_content_at": "2019-08-24T14:15:22Z",
  "body": "string",
  "noindex": true,
  "toc": [
    {}
  ],
  "status": "string",
  "not_human_reviewed": true,
  "source_refs": [
    "string"
  ],
  "last_edited_by": "string"
}
```

<h3 id="archive-a-page-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|archived|Inline|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|unprocessable - already archived, or an agent tried to archive|Inline|

<h3 id="archive-a-page-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» slug|string|false|none|URL-safe identifier; also the article's path under /help|
|» title|string|false|none|none|
|» answer|string¦null|false|none|A short, self-contained answer to the question the article addresses|
|» article_kind|string|false|none|none|
|» tags|[string]|false|none|none|
|» category|string|false|none|Slug of the section this article belongs to|
|» url|string|false|none|Public HTML page|
|» markdown_url|string|false|none|Machine-readable markdown twin of the same page|
|» reading_time_minutes|integer¦null|false|none|none|
|» published_at|string(date-time)¦null|false|none|none|
|» updated_content_at|string(date-time)¦null|false|none|When the prose last changed. Not bumped by background re-renders.|
|» body|string|false|none|Full markdown source|
|» noindex|boolean|false|none|none|
|» toc|[object]|false|none|Extracted heading structure, nested h3s under their h2|
|» status|string|false|none|none|
|» not_human_reviewed|boolean|false|none|none|
|» source_refs|[string]|false|none|none|
|» last_edited_by|string|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|article_kind|reference|
|article_kind|concept|
|article_kind|how_to|
|article_kind|troubleshooting|
|article_kind|faq_answer|
|article_kind|release_note|

Status Code **422**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» errors|[string]|false|none|none|

<aside class="success">
This operation does not require authentication
</aside>

## List the review queue for a page

<a id="opIdlist_the_review_queue_for_a_page"></a>

`GET /api/v2/public_content/{slug}/revisions`

Changes proposed against this page. A change to an already-published page is queued here
rather than applied, whoever made it. Coolhand's own private key only — this exposes
unpublished prose.

<h3 id="list-the-review-queue-for-a-page-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|status|query|string|false|Filter by status: pending, applied, rejected, superseded.|
|slug|path|string|true|Page slug|

> Example responses

> 200 Response

```json
[
  {
    "id": 0,
    "status": "pending",
    "author": "string",
    "stale": true,
    "changed_fields": [
      "string"
    ]
  }
]
```

<h3 id="list-the-review-queue-for-a-page-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline|

<h3 id="list-the-review-queue-for-a-page-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|integer|false|none|none|
|» status|string|false|none|none|
|» author|string|false|none|none|
|» stale|boolean|false|none|The page changed after this revision was written.|
|» changed_fields|[string]|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|status|pending|
|status|applied|
|status|rejected|
|status|superseded|

<aside class="success">
This operation does not require authentication
</aside>

## List Article Reviewer passes for a page

<a id="opIdlist_article_reviewer_passes_for_a_page"></a>

`GET /api/v2/public_content/{slug}/reviews`

The Article Reviewer's scored passes over this page and over each queued revision of it,
newest first: the four scores with their full reasons, the outcome and why it was blocked,
and the claim ledger. Coolhand's own private key only — the reasons quote unpublished prose.

Add `?include=transcript` for the reviewer's full agent transcript, which can be very large.
It is not declared as a parameter because rswag cannot generate a parameter named `include`.

<h3 id="list-article-reviewer-passes-for-a-page-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|revision_id|query|integer|false|Only the passes on this queued revision.|
|subject|query|string|false|`draft` returns only the passes on the page itself.|
|slug|path|string|true|Page slug|

> Example responses

> 200 Response

```json
[
  {
    "id": 0,
    "pass_number": 0,
    "revision_id": 0,
    "total": 0,
    "outcome": "published",
    "blocked_reason": "string",
    "auto_published": true,
    "scores": {},
    "reasons": {},
    "claim_ledger": [
      {
        "claim": "string",
        "status": "verified",
        "evidence": "string"
      }
    ],
    "scanner_hits": [
      {
        "field": "string",
        "category": "string",
        "match": "string"
      }
    ],
    "model": "string",
    "reviewed_at": "2019-08-24T14:15:22Z"
  }
]
```

<h3 id="list-article-reviewer-passes-for-a-page-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|success|Inline|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|not the Coolhand credential|None|

<h3 id="list-article-reviewer-passes-for-a-page-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|integer|false|none|none|
|» pass_number|integer|false|none|1 is the first review; 2 follows one automatic revision.|
|» revision_id|integer¦null|false|none|The queued revision reviewed, or null for the page itself.|
|» total|integer|false|none|Sum of the four scores, out of 20.|
|» outcome|string¦null|false|none|none|
|» blocked_reason|string¦null|false|none|none|
|» auto_published|boolean|false|none|none|
|» scores|object|false|none|brand_voice, accuracy, audience and seo_aeo, each 1-5.|
|» reasons|object|false|none|The reviewer's reason for each score, keyed like `scores`.|
|» claim_ledger|[object]|false|none|none|
|»» claim|string|false|none|none|
|»» status|string|false|none|none|
|»» evidence|string|false|none|none|
|» scanner_hits|[object]|false|none|Internal detail the pre-publish scan found in the text; any hit blocks publication.|
|»» field|string|false|none|none|
|»» category|string|false|none|none|
|»» match|string|false|none|none|
|» model|string¦null|false|none|none|
|» reviewed_at|string(date-time)|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|outcome|published|
|outcome|revise|
|outcome|held|
|outcome|failed|
|status|verified|
|status|unverifiable|
|status|incorrect|

<aside class="success">
This operation does not require authentication
</aside>

## Reject a queued revision

<a id="opIdreject_a_queued_revision"></a>

`POST /api/v2/public_content/{slug}/revisions/{id}/reject`

Closes the revision without touching the live page. `review_note` is required — a rejection
the author cannot learn anything from is a dead end. An agent identity is refused: an agent
must not be able to terminally discard a person's queued change.

There is no matching approve endpoint. Applying a change to a live page requires a
signed-in admin, which an API key cannot present, so approval happens in the admin review
queue rather than here.

> Body parameter

```json
{
  "review_note": "string"
}
```

<h3 id="reject-a-queued-revision-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|X-API-Key|header|string|true|none|
|body|body|object|false|none|
|» review_note|body|string|true|none|
|slug|path|string|true|Page slug|
|id|path|integer|true|Revision id|

> Example responses

> 200 Response

```json
{
  "id": 0,
  "status": "pending",
  "author": "string",
  "stale": true,
  "changed_fields": [
    "string"
  ]
}
```

<h3 id="reject-a-queued-revision-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|rejected|Inline|

<h3 id="reject-a-queued-revision-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» id|integer|false|none|none|
|» status|string|false|none|none|
|» author|string|false|none|none|
|» stale|boolean|false|none|The page changed after this revision was written.|
|» changed_fields|[string]|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|status|pending|
|status|applied|
|status|rejected|
|status|superseded|

<aside class="success">
This operation does not require authentication
</aside>

# Schemas

<h2 id="tocS_client_file">client_file</h2>
<!-- backwards compatibility -->
<a id="schemaclient_file"></a>
<a id="schema_client_file"></a>
<a id="tocSclient_file"></a>
<a id="tocsclient_file"></a>

```json
{
  "id": "abc123",
  "name": "Q1 Report",
  "file_type": "document",
  "status": "draft",
  "description": "string",
  "metadata": {
    "project_path": "/Users/me/my-project"
  },
  "created_at": "2026-11-09T18:37:17+00:00"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|string|false|none|Client file hashid|
|name|string|false|none|Display name for the file|
|file_type|string|false|none|One of slide_deck, report, document|
|status|string|false|none|One of draft, published, archived|
|description|string¦null|false|none|Optional free-text description|
|metadata|object|false|none|Optional free-form client-supplied context (e.g. { "project_path": "..." })|
|created_at|[shared_created_at](#schemashared_created_at)|false|none|Date and time when object was created formatted according to RFC 3339. Timezone is UTC|

<h2 id="tocS_llm_request_log_feedback">llm_request_log_feedback</h2>
<!-- backwards compatibility -->
<a id="schemallm_request_log_feedback"></a>
<a id="schema_llm_request_log_feedback"></a>
<a id="tocSllm_request_log_feedback"></a>
<a id="tocsllm_request_log_feedback"></a>

```json
{
  "id": "abc123xyz789",
  "client_id": "xyz789abc123",
  "llm_request_log_id": "abc123xyz789",
  "workload_id": "xyz789abc123",
  "like": true,
  "sentiment": "like",
  "creator_type": "human",
  "explanation": "Great response! Very helpful and accurate.",
  "revised_output": "This is a dummy revised output",
  "llm_provider_unique_id": "req_1234567890abcdef",
  "original_output": "Dear John Doe,\n\nThank you for reaching out to us regarding the issue with your recent order #12345...",
  "client_unique_id": "email-service-1760025972258",
  "creator_unique_id": "user-789",
  "collector": "coolhand-node-0.1.0",
  "coolhand_fingerprint_id": "fp_abc123xyz789",
  "created_at": "2026-11-09T18:37:17+00:00",
  "updated_at": "2026-11-09T18:37:17+00:00",
  "content_scrubbed_at": "2026-10-06T03:30:00Z",
  "had_revised_output": true,
  "had_explanation": true
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|string|false|none|Unique hashid identifier for the feedback entry. Use this to reference the feedback in update requests.|
|client_id|string|false|none|Hashid of the client that owns this feedback entry.|
|llm_request_log_id|string¦null|false|none|🎯 Exact Match - Hashid of the LLM request log this feedback is linked to. Provides exact matching to connect feedback to a specific logged request.|
|workload_id|string¦null|false|none|📦 Workload Association - Hashid of the workload this feedback is associated with. Set automatically when a valid workload_hashid is provided in the request.|
|like|boolean¦null|false|none|👍 Low Signal - Boolean like/dislike rating (deprecated, use sentiment instead). Computed from sentiment for backwards compatibility: like=true, dislike=false, neutral/nil=nil.|
|sentiment|string¦null|false|none|🎭 Sentiment Rating - String sentiment value: 'like', 'dislike', or 'neutral'. Preferred over boolean 'like' field. Takes precedence if both are provided.|
|creator_type|string¦null|false|none|🧑‍🤝‍🤖 Creator Type - What kind of creator submitted this feedback: 'human' (a person), 'agent' (an AI agent or automated tool), or 'unknown'. Defaults to 'unknown' when omitted.|
|explanation|string¦null|false|none|💬 Medium Signal - End user explanation of why the response was good or bad. Valuable qualitative data for understanding user preferences and improving model performance.|
|revised_output|string¦null|false|none|⭐ Best Signal - End user revision of the LLM response. The highest value data for improving quality scores. This is the user's improved version of what the AI should have said.|
|llm_provider_unique_id|string¦null|false|none|🎯 Exact Match - The x-request-id from the LLM API response (e.g., 'req_xxxxxxx'). Provides exact matching to connect feedback to the specific LLM provider request.|
|original_output|string¦null|false|none|🔍 Fuzzy Match - The original LLM response text. Provides fuzzy matching but isn't 100% reliable. Use when you don't have llm_provider_unique_id or llm_request_log_id.|
|client_unique_id|string¦null|false|none|🔗 Your Internal Matcher - Connect to an identifier from your system for internal matching. This helps you correlate feedback with your own request tracking system.|
|creator_unique_id|string¦null|false|none|👤 User Tracking - Unique ID to match feedback to the end user who created it. Useful for analyzing feedback patterns by user and preventing duplicate feedback.|
|collector|string¦null|false|none|🏷️ Metadata - Optional name/stamp identifying the collection method or SDK version. Helps track which system or version collected the feedback.|
|coolhand_fingerprint_id|string¦null|false|none|🔒 Optional - Unique fingerprint ID set by the CoolhandJS SDK (https://github.com/Coolhand-Labs/coolhand-js). DO NOT set this field when calling the API directly - it is reserved for CoolhandJS.|
|created_at|[shared_created_at](#schemashared_created_at)|false|none|Date and time when object was created formatted according to RFC 3339. Timezone is UTC|
|updated_at|[shared_updated_at](#schemashared_updated_at)|false|none|Date and time when object was updated formatted according to RFC 3339. Timezone is UTC|
|content_scrubbed_at|string(date-time)¦null|false|none|Set once the feedback is past the 90-day retention window and its text (explanation, original_output, revised_output) has been removed. Scores and identifiers are kept.|
|had_revised_output|boolean¦null|false|none|Only set on scrubbed feedback: whether it carried a revised_output before the text was removed.|
|had_explanation|boolean¦null|false|none|Only set on scrubbed feedback: whether it carried an explanation before the text was removed.|

#### Enumerated Values

|Property|Value|
|---|---|
|sentiment|like|
|sentiment|dislike|
|sentiment|neutral|
|creator_type|human|
|creator_type|agent|
|creator_type|unknown|

<h2 id="tocS_create_llm_request_log_feedback_params">create_llm_request_log_feedback_params</h2>
<!-- backwards compatibility -->
<a id="schemacreate_llm_request_log_feedback_params"></a>
<a id="schema_create_llm_request_log_feedback_params"></a>
<a id="tocScreate_llm_request_log_feedback_params"></a>
<a id="tocscreate_llm_request_log_feedback_params"></a>

```json
{
  "llm_request_log_id": "abc123xyz789",
  "like": true,
  "sentiment": "like",
  "explanation": "Great response! Very helpful and accurate.",
  "revised_output": "This is a dummy revised output",
  "llm_provider_unique_id": "req_1234567890abcdef",
  "original_output": "Dear John Doe,\n\nThank you for reaching out to us regarding the issue with your recent order #12345. I am sorry to hear that the product arrived damaged and is not working properly. Please accept my sincere apologies for any inconvenience this may have caused.\n\nAs a valued customer of ours for the past 3 years, your satisfaction is incredibly important to us. Rest assured, we are committed to resolving this issue promptly for you. I will arrange for a replacement of the damaged item to be sent out to you as soon as possible. You should receive a confirmation email with the tracking details shortly.\n\nIf there is anything else we can assist you with, please do not hesitate to let us know. We truly appreciate your loyalty and thank you for bringing this matter to our attention.\n\nBest regards,\n\n[Your Name]\nCustomer Service Team",
  "client_unique_id": "email-service-1760025972258",
  "creator_unique_id": "user-789",
  "collector": "coolhand-node-0.1.0",
  "workload_hashid": "abc123def456",
  "coolhand_fingerprint_id": "fp_abc123xyz789",
  "focus_section": "specific section of the response",
  "focus_range": {
    "start": 100,
    "end": 130
  },
  "parent_feedback_hashid": "xyz789abc123"
}

```

## Feedback API - Field Guide

All fields are optional, but here's how to get the best results:

### Matching Fields
- **llm_request_log_id** 🎯 *Exact Match* - Hashid from the Coolhand API response when the original LLM request was logged
- **llm_provider_unique_id** 🎯 *Exact Match* - The x-request-id from the LLM API response (e.g., "req_xxxxxxx")
- **original_output** 🔍 *Fuzzy Match* - The original LLM response text. Provides fuzzy matching but isn't 100% reliable
- **client_unique_id** 🔗 *Your Internal Matcher* - Connect to an identifier from your system for internal matching
- **workload_hashid** 📦 *Workload Association* - Optional. Associate feedback with a specific workload to increase fuzzy match success rate

### Quality Data
- **revised_output** ⭐ *Best Signal* - End user revision of the LLM response. The highest value data for improving quality scores
- **explanation** 💬 *Medium Signal* - End user explanation of why the response was good or bad. Valuable qualitative data
- **sentiment** 🎭 *Preferred* - String sentiment: "like", "dislike", or "neutral". Preferred over boolean like
- **like** 👍 *Low Signal (Deprecated)* - Boolean like/dislike. Use sentiment instead
- **creator_unique_id** 👤 *User Tracking* - Unique ID to match feedback to the end user who created it
- **collector** 🏷️ *Metadata* - Optional name/stamp identifying the collection method

### Partial Feedback (Section-Specific)
- **focus_section** 📍 *Required for partial* - The specific text section being rated. When present, this creates partial feedback
- **focus_range** 📏 *Optional* - Character positions {start, end} to identify exact location
- **parent_feedback_hashid** 🔗 *Optional* - Direct reference to parent feedback (skips auto-matching)

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|llm_request_log_id|string|false|none|🎯 Exact Match - Hashid of the LLM request log from the Coolhand API response when the original LLM request was logged. Provides exact matching to connect feedback to a specific logged request. A raw integer FK is also still accepted for backward compatibility.|
|like|boolean|false|none|👍 Low Signal - Boolean like/dislike rating (deprecated, use sentiment instead). Use true for positive feedback, false for negative, or null/omit for neutral.|
|sentiment|string¦null|false|none|🎭 Sentiment Rating - String sentiment value: 'like', 'dislike', or 'neutral'. Preferred over boolean 'like' field. Takes precedence if both are provided.|
|explanation|string|false|none|💬 Medium Signal - End user explanation of why the response was good or bad. Valuable qualitative data for understanding user preferences and improving model performance. (5-5000 characters)|
|revised_output|string|false|none|⭐ Best Signal - End user revision of the LLM response. The highest value data for improving quality scores. This is the user's improved version of what the AI should have said. (PostgreSQL text field - up to 1GB)|
|llm_provider_unique_id|string|false|none|🎯 Exact Match - The x-request-id from the LLM API response (e.g., 'req_xxxxxxx'). Provides exact matching to connect feedback to the specific LLM provider request.|
|original_output|string|false|none|🔍 Fuzzy Match - The original LLM response text. Provides fuzzy matching but isn't 100% reliable. Use when you don't have llm_provider_unique_id or llm_request_log_id. (PostgreSQL text field - up to 1GB)|
|client_unique_id|string|false|none|🔗 Your Internal Matcher - Connect to an identifier from your system for internal matching. This helps you correlate feedback with your own request tracking system.|
|creator_unique_id|string|false|none|👤 User Tracking - Unique ID to match feedback to the end user who created it. Useful for analyzing feedback patterns by user and preventing duplicate feedback.|
|collector|string¦null|false|none|🏷️ Metadata - Optional name/stamp identifying the collection method or SDK version. Helps track which system or version collected the feedback.|
|workload_hashid|string¦null|false|none|📦 Workload Association - Hashid of the workload to associate this feedback with. Providing a workload increases the fuzzy match success rate by narrowing the search scope. If the workload doesn't exist or doesn't belong to your client, a warning will be added but the feedback will still be saved.|
|coolhand_fingerprint_id|string¦null|false|none|🔒 Optional - Unique fingerprint ID set automatically by the CoolhandJS SDK (https://github.com/Coolhand-Labs/coolhand-js). DO NOT set this field when calling the API directly - it is reserved for internal use by CoolhandJS and will be ignored or may cause unexpected behavior if set manually.|
|focus_section|string¦null|false|none|📍 Partial Feedback - The specific text section this feedback targets. When present, indicates this is a partial feedback on a specific part of the response. Requires original_output to be provided.|
|focus_range|object¦null|false|none|📏 Position Range - Character positions of the focus_section within original_output. Format: {start: integer, end: integer}. Useful when the same text appears multiple times in the response.|
|» start|integer|false|none|Start character position (0-indexed)|
|» end|integer|false|none|End character position (exclusive)|
|parent_feedback_hashid|string¦null|false|none|🔗 Direct Parent Reference - Hashid of an existing parent feedback to associate this partial feedback with. If provided, skips automatic parent matching. If invalid, a warning is added but feedback is still saved.|

#### Enumerated Values

|Property|Value|
|---|---|
|sentiment|like|
|sentiment|dislike|
|sentiment|neutral|

<h2 id="tocS_llm_request_log">llm_request_log</h2>
<!-- backwards compatibility -->
<a id="schemallm_request_log"></a>
<a id="schema_llm_request_log"></a>
<a id="tocSllm_request_log"></a>
<a id="tocsllm_request_log"></a>

```json
{
  "id": 56382,
  "collector": "nodejs-sdk-v1.2.0",
  "metadata": {
    "project_path": "/Users/me/my-project"
  },
  "created_at": "2026-11-09T18:37:17+00:00",
  "updated_at": "2026-11-09T18:37:17+00:00",
  "content_scrubbed_at": "2026-10-06T03:30:00Z",
  "message_count": 5,
  "user_message_count": 2,
  "stream_incomplete": false,
  "ingest_evidence": {
    "max_output_tokens": {
      "truncated": true
    }
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|integer|false|none|LLM Request Log ID|
|collector|string¦null|false|none|Optional name/stamp identifying the collection method (e.g., 'nodejs-sdk-v1.2.0', 'ruby-gem-v2.1.3')|
|metadata|object|false|none|Optional free-form client-supplied context (e.g. { "project_path": "..." })|
|created_at|[shared_created_at](#schemashared_created_at)|false|none|Date and time when object was created formatted according to RFC 3339. Timezone is UTC|
|updated_at|[shared_updated_at](#schemashared_updated_at)|false|none|Date and time when object was updated formatted according to RFC 3339. Timezone is UTC|
|content_scrubbed_at|string(date-time)¦null|false|none|Set once the log is past the 90-day retention window and its content (prompts, responses, raw payload and metadata) has been removed. Token counts, latency and other metadata are kept.|
|message_count|integer¦null|false|none|Number of messages in the request, when a message list was present. Null for logs ingested before this field existed that have not yet passed the 90-day retention window.|
|user_message_count|integer¦null|false|none|Number of user-role messages in the request (the turns of a chat), when a message list was present. Null for logs ingested before this field existed that have not yet passed the 90-day retention window.|
|stream_incomplete|boolean|false|none|True when the client abandoned a streamed response before it ended, so the logged body is partial. SDKs mark it by sending raw_request.stream_incomplete = true; the column is set when the log is processed, so the create response always shows false. Token counts are null unless the provider's final usage event arrived before the cut-off, and latency is not recorded.|
|ingest_evidence|object|false|none|Facts Coolhand extracted while processing the log, grouped by topic (max_output_tokens, context_window, modalities, capabilities). A group appears only when the payload carried that signal. Always {} in the create response, since processing happens afterwards.|

<h2 id="tocS_llm_request_log_full">llm_request_log_full</h2>
<!-- backwards compatibility -->
<a id="schemallm_request_log_full"></a>
<a id="schema_llm_request_log_full"></a>
<a id="tocSllm_request_log_full"></a>
<a id="tocsllm_request_log_full"></a>

```json
{
  "id": 56382,
  "collector": "nodejs-sdk-v1.2.0",
  "metadata": {
    "project_path": "/Users/me/my-project"
  },
  "created_at": "2026-11-09T18:37:17+00:00",
  "updated_at": "2026-11-09T18:37:17+00:00",
  "content_scrubbed_at": "2026-10-06T03:30:00Z",
  "message_count": 5,
  "user_message_count": 2,
  "stream_incomplete": false,
  "ingest_evidence": {
    "max_output_tokens": {
      "truncated": true
    }
  },
  "raw_request": {
    "id": 1,
    "timestamp": "2025-08-20T14:54:36.864Z",
    "method": "POST",
    "url": "https://api.openai.com/v1/chat/completions",
    "headers": {},
    "request_body": {
      "model": "gpt-3.5-turbo",
      "temperature": 0.7,
      "stream": false,
      "messages": [
        {
          "role": "user",
          "content": "You are a helpful customer service representative..."
        }
      ]
    },
    "response_body": {
      "id": "chatcmpl-C6eUvEvH5k5JAPTNKluyJgf4xEHaz",
      "object": "chat.completion",
      "created": 1755701677,
      "model": "gpt-3.5-turbo-0125",
      "choices": [
        {
          "index": 0,
          "message": {
            "role": "assistant",
            "content": "Dear John Doe,\n\nThank you for reaching out..."
          }
        }
      ],
      "usage": {
        "prompt_tokens": 195,
        "completion_tokens": 175,
        "total_tokens": 370
      }
    },
    "status_code": 200,
    "protocol": "fetch"
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|integer|false|none|LLM Request Log ID|
|collector|string¦null|false|none|Optional name/stamp identifying the collection method (e.g., 'nodejs-sdk-v1.2.0', 'ruby-gem-v2.1.3')|
|metadata|object|false|none|Optional free-form client-supplied context (e.g. { "project_path": "..." })|
|created_at|[shared_created_at](#schemashared_created_at)|false|none|Date and time when object was created formatted according to RFC 3339. Timezone is UTC|
|updated_at|[shared_updated_at](#schemashared_updated_at)|false|none|Date and time when object was updated formatted according to RFC 3339. Timezone is UTC|
|content_scrubbed_at|string(date-time)¦null|false|none|Set once the log is past the 90-day retention window and its content (prompts, responses, raw payload and metadata) has been removed. Token counts, latency and other metadata are kept.|
|message_count|integer¦null|false|none|Number of messages in the request, when a message list was present. Null for logs ingested before this field existed that have not yet passed the 90-day retention window.|
|user_message_count|integer¦null|false|none|Number of user-role messages in the request (the turns of a chat), when a message list was present. Null for logs ingested before this field existed that have not yet passed the 90-day retention window.|
|stream_incomplete|boolean|false|none|True when the client abandoned a streamed response before it ended, so the logged body is partial. SDKs mark it by sending raw_request.stream_incomplete = true; the column is set when the log is processed, so the create response always shows false. Token counts are null unless the provider's final usage event arrived before the cut-off, and latency is not recorded.|
|ingest_evidence|object|false|none|Facts Coolhand extracted while processing the log, grouped by topic (max_output_tokens, context_window, modalities, capabilities). A group appears only when the payload carried that signal. Always {} in the create response, since processing happens afterwards.|
|raw_request|object|false|none|Complete raw request data in JSON format|

<h2 id="tocS_create_llm_request_log_params">create_llm_request_log_params</h2>
<!-- backwards compatibility -->
<a id="schemacreate_llm_request_log_params"></a>
<a id="schema_create_llm_request_log_params"></a>
<a id="tocScreate_llm_request_log_params"></a>
<a id="tocscreate_llm_request_log_params"></a>

```json
{
  "raw_request": {
    "id": 1,
    "timestamp": "2025-08-20T14:54:36.864Z",
    "method": "POST",
    "url": "https://api.openai.com/v1/chat/completions",
    "headers": {},
    "request_body": {
      "model": "gpt-3.5-turbo",
      "temperature": 0.7,
      "messages": [
        {
          "role": "user",
          "content": "Hello, world!"
        }
      ]
    },
    "response_body": {
      "choices": [
        {
          "message": {
            "content": "Hello! How can I help you today?"
          }
        }
      ]
    },
    "status_code": 200
  },
  "collector": "ruby-gem-v2.1.3",
  "metadata": {
    "project_path": "/Users/me/my-project"
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|raw_request|object|true|none|Complete raw request data in JSON format. Can contain any structure. Set stream_incomplete: true when the response stream was abandoned before it ended and response_body is partial.|
|collector|string¦null|false|none|Optional name/stamp identifying the collection method (e.g., 'nodejs-sdk-v1.2.0', 'ruby-gem-v2.1.3')|
|metadata|object|false|none|Optional free-form client-supplied context (e.g. { "project_path": "..." })|

<h2 id="tocS_shared_created_at">shared_created_at</h2>
<!-- backwards compatibility -->
<a id="schemashared_created_at"></a>
<a id="schema_shared_created_at"></a>
<a id="tocSshared_created_at"></a>
<a id="tocsshared_created_at"></a>

```json
"2026-11-09T18:37:17+00:00"

```

Date and time when object was created formatted according to RFC 3339. Timezone is UTC 

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|*anonymous*|string(date-time)|false|none|Date and time when object was created formatted according to RFC 3339. Timezone is UTC|

<h2 id="tocS_shared_updated_at">shared_updated_at</h2>
<!-- backwards compatibility -->
<a id="schemashared_updated_at"></a>
<a id="schema_shared_updated_at"></a>
<a id="tocSshared_updated_at"></a>
<a id="tocsshared_updated_at"></a>

```json
"2026-11-09T18:37:17+00:00"

```

Date and time when object was updated formatted according to RFC 3339. Timezone is UTC 

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|*anonymous*|string(date-time)|false|none|Date and time when object was updated formatted according to RFC 3339. Timezone is UTC|

<h2 id="tocS_shared_discarded_at_attr">shared_discarded_at_attr</h2>
<!-- backwards compatibility -->
<a id="schemashared_discarded_at_attr"></a>
<a id="schema_shared_discarded_at_attr"></a>
<a id="tocSshared_discarded_at_attr"></a>
<a id="tocsshared_discarded_at_attr"></a>

```json
"2019-08-24T14:15:22Z"

```

Set to current time if you want to **soft delete** this object. Use RFC 3339 format.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|*anonymous*|string(date-time)¦null|false|none|Set to current time if you want to **soft delete** this object. Use RFC 3339 format.|

<h2 id="tocS_shared_confirmed_at">shared_confirmed_at</h2>
<!-- backwards compatibility -->
<a id="schemashared_confirmed_at"></a>
<a id="schema_shared_confirmed_at"></a>
<a id="tocSshared_confirmed_at"></a>
<a id="tocsshared_confirmed_at"></a>

```json
"2019-08-24T14:15:22Z"

```

Date and time when object was confirmed. Use RFC 3339 format.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|*anonymous*|string(date-time)¦null|false|none|Date and time when object was confirmed. Use RFC 3339 format.|

<h2 id="tocS_shared_expired_at">shared_expired_at</h2>
<!-- backwards compatibility -->
<a id="schemashared_expired_at"></a>
<a id="schema_shared_expired_at"></a>
<a id="tocSshared_expired_at"></a>
<a id="tocsshared_expired_at"></a>

```json
"2019-08-24T14:15:22Z"

```

Date and time when object was EXPIRED. Use RFC 3339 format.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|*anonymous*|string(date-time)¦null|false|none|Date and time when object was EXPIRED. Use RFC 3339 format.|

<h2 id="tocS_shared_destroy_attr">shared_destroy_attr</h2>
<!-- backwards compatibility -->
<a id="schemashared_destroy_attr"></a>
<a id="schema_shared_destroy_attr"></a>
<a id="tocSshared_destroy_attr"></a>
<a id="tocsshared_destroy_attr"></a>

```json
true

```

Set to true if you want to **hard delete** this object

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|*anonymous*|boolean|false|none|Set to true if you want to **hard delete** this object|

<h2 id="tocS_shared_unprocessable_entity_error">shared_unprocessable_entity_error</h2>
<!-- backwards compatibility -->
<a id="schemashared_unprocessable_entity_error"></a>
<a id="schema_shared_unprocessable_entity_error"></a>
<a id="tocSshared_unprocessable_entity_error"></a>
<a id="tocsshared_unprocessable_entity_error"></a>

```json
{
  "errors": {
    "__field_name__": [
      "Password should be at least 6 chars long",
      "Password should contain at least one number"
    ]
  }
}

```

Error object

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|errors|object|false|none|Contains error details.|
|» __field_name__|[string]|false|none|Instead of field `__field_name__` you can expect a field name in the request body which caused an error.<br>e.g. "email", "password".<br>There could be multiple errors for a single field.<br>There could be multiple `__field_name__`.<br>If it is impossible to map error to a key in the request body, `__field_name__` will be `system`.|

<h2 id="tocS_shared_missing_property_error">shared_missing_property_error</h2>
<!-- backwards compatibility -->
<a id="schemashared_missing_property_error"></a>
<a id="schema_shared_missing_property_error"></a>
<a id="tocSshared_missing_property_error"></a>
<a id="tocsshared_missing_property_error"></a>

```json
{
  "errors": {
    "property1": [
      "can't be blank"
    ],
    "property2": [
      "can't be blank"
    ]
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|errors|object|false|none|none|
|» **additionalProperties**|[string]|false|none|none|

<h2 id="tocS_shared_success">shared_success</h2>
<!-- backwards compatibility -->
<a id="schemashared_success"></a>
<a id="schema_shared_success"></a>
<a id="tocSshared_success"></a>
<a id="tocsshared_success"></a>

```json
{
  "message": "User deleted."
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|message|string|true|none|none|

<h2 id="tocS_shared_unauthorized_error">shared_unauthorized_error</h2>
<!-- backwards compatibility -->
<a id="schemashared_unauthorized_error"></a>
<a id="schema_shared_unauthorized_error"></a>
<a id="tocSshared_unauthorized_error"></a>
<a id="tocsshared_unauthorized_error"></a>

```json
{
  "message": "Unauthorized"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|message|string|true|none|none|

<h2 id="tocS_shared_not_found_error">shared_not_found_error</h2>
<!-- backwards compatibility -->
<a id="schemashared_not_found_error"></a>
<a id="schema_shared_not_found_error"></a>
<a id="tocSshared_not_found_error"></a>
<a id="tocsshared_not_found_error"></a>

```json
{
  "errors": {
    "chapterfeedback": [
      "Couldn't locate the ChapterFeedback record"
    ]
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|errors|object|false|none|Contains error details.|
|» ^[a-z]+$|[string]|false|none|none|

