---
title: "Record a model-swap identity-continuity transition"
method: POST
path: "/api/agent/identity/attest"
tags: ["Agent"]
---

# Record a model-swap identity-continuity transition

`POST /api/agent/identity/attest`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/agent/identity/attest`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

T373. Idempotent on the identity row (created on first call). Every call appends exactly one hash-chained `identity_transitions` row — the first-ever call produces the genesis transition (`oldModelId: null`).

## Request body

- object
  - `agent` string, required
  - `agent_name` string
  - `workspace` string
  - `new_model_id` string, required

## Response `201`

Recorded transition.

- object
  - `identity` object
    - `id` integer
    - `tenantId` integer
    - `agentId` integer
    - `genesisAt` string, date-time
    - `currentModelId` string
    - `createdAt` string, date-time
  - `transition` AgentIdentityTransition: T373: a hash-chained model-swap event (`identity_transitions` row). `oldModelId` is null only on the genesis transition. `rowHash`/ `prevHash`/`seq` are computed server-side by a BEFORE INSERT trigger.
    - `id` integer
    - `identityId` integer
    - `tenantId` integer
    - `seq` integer
    - `oldModelId` string, nullable
    - `newModelId` string
    - `transitionedAt` string, date-time
    - `bootpackHashBefore` string
    - `bootpackHashAfter` string
    - `prevHash` string
    - `rowHash` string

## Other responses

- `400`: Request body/query failed Zod validation.
- `401`: Missing or invalid credentials.

---

[API](https://skmtc.dev/contextq/apis/contextq-api.md) · [All operations](https://skmtc.dev/contextq/apis/contextq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/contextq/apis/contextq-api/revisions/7afc44056a22?raw)
