> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tai42.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete a conversation thread

> Forget ONE conversation thread: its agent checkpoint, its answer records and its thread
indexes, so a later message on the same address starts a memory the deleted turns never
touched. A LINKED person's aggregated ``bridge:@person:{id}`` thread is forgotten across
every route index it spans.

Forgetting is ABSOLUTE: a valid id on its own route always succeeds, even when nothing is
stored. An aged-out thread whose answer records already expired under the retention TTL,
or one never seen, answers ``removed=0`` and never a 404 — and its checkpoint is deleted
regardless, because that memory defaults to keep-forever and is otherwise left behind once
the records lapse. A route-keyed id MUST carry the route's ``bridge:{route_name}:`` prefix;
an id belonging to another route is a loud 400, the sole guard stopping a delete on one
route from wiping another route's memory. A person ``bridge:@person:{id}`` thread whose
person is unknown, or whose ``route_name`` is not one of the person's routes, is a loud
404. A turn IN FLIGHT on the thread (an ``accepted`` intake still holding a live lease) is
a 409: its completion re-writes checkpoint state and re-stamps the indexes behind the
delete, half-forgetting the memory — retry once it drains. The guard is re-checked under
the FIFO, so a turn admitted while the lock is being taken is refused before any teardown,
never left to re-create memory behind the delete. A ``route_name`` that is not a valid
slug, or a blank ``thread_id``, is a 400.

Caller authority is the door's grantable write action — the SAME write grant that creates
a route deletes routes and forgets threads — never a per-thread owner check.

The teardown runs in an order an interruption cannot strand: the checkpoint FIRST — its
memory is reachable only through the indexes once this call returns, so it must go while
the indexes still name the thread to bring a re-run back — then the records and the indexes
together, the index being the durable marker of an owed reclamation and torn down LAST.
Idempotent under re-run, so a partial completion is FINISHED by a retry.

The whole teardown runs under the thread's per-thread FIFO (the lock an operator send and
an in-flight turn take), so an operator send already in flight on the thread within this
worker drains BEFORE the delete rather than half-behind it; a full queue is the loud,
retriable 503 that FIFO raises before anything is torn down. As a live-caller sync door the
acquisition is bounded by ``sync_door_wait_seconds``: a wait past it — behind a turn possibly
HITL-paused on another worker — is the loud, retriable 503 ``ThreadBusyError`` rather than a
block past the proxy timeout.

Returns ``{"removed", "route_name", "thread_id"}``, where ``removed`` counts the answer
records this call deleted (0 when a prior run already cleared them, when their rows had
expired under the retention TTL, or when the id was never stored).



## OpenAPI

````yaml /openapi.json delete /api/conversations/{route_name}/thread
openapi: 3.1.0
info:
  description: The operator HTTP surface served under /api/*.
  title: tai42-skeleton API
  version: 14.0.2
servers: []
security: []
paths:
  /api/conversations/{route_name}/thread:
    delete:
      tags:
        - conversations
      summary: Delete a conversation thread
      description: >-
        Forget ONE conversation thread: its agent checkpoint, its answer records
        and its thread

        indexes, so a later message on the same address starts a memory the
        deleted turns never

        touched. A LINKED person's aggregated ``bridge:@person:{id}`` thread is
        forgotten across

        every route index it spans.


        Forgetting is ABSOLUTE: a valid id on its own route always succeeds,
        even when nothing is

        stored. An aged-out thread whose answer records already expired under
        the retention TTL,

        or one never seen, answers ``removed=0`` and never a 404 — and its
        checkpoint is deleted

        regardless, because that memory defaults to keep-forever and is
        otherwise left behind once

        the records lapse. A route-keyed id MUST carry the route's
        ``bridge:{route_name}:`` prefix;

        an id belonging to another route is a loud 400, the sole guard stopping
        a delete on one

        route from wiping another route's memory. A person
        ``bridge:@person:{id}`` thread whose

        person is unknown, or whose ``route_name`` is not one of the person's
        routes, is a loud

        404. A turn IN FLIGHT on the thread (an ``accepted`` intake still
        holding a live lease) is

        a 409: its completion re-writes checkpoint state and re-stamps the
        indexes behind the

        delete, half-forgetting the memory — retry once it drains. The guard is
        re-checked under

        the FIFO, so a turn admitted while the lock is being taken is refused
        before any teardown,

        never left to re-create memory behind the delete. A ``route_name`` that
        is not a valid

        slug, or a blank ``thread_id``, is a 400.


        Caller authority is the door's grantable write action — the SAME write
        grant that creates

        a route deletes routes and forgets threads — never a per-thread owner
        check.


        The teardown runs in an order an interruption cannot strand: the
        checkpoint FIRST — its

        memory is reachable only through the indexes once this call returns, so
        it must go while

        the indexes still name the thread to bring a re-run back — then the
        records and the indexes

        together, the index being the durable marker of an owed reclamation and
        torn down LAST.

        Idempotent under re-run, so a partial completion is FINISHED by a retry.


        The whole teardown runs under the thread's per-thread FIFO (the lock an
        operator send and

        an in-flight turn take), so an operator send already in flight on the
        thread within this

        worker drains BEFORE the delete rather than half-behind it; a full queue
        is the loud,

        retriable 503 that FIFO raises before anything is torn down. As a
        live-caller sync door the

        acquisition is bounded by ``sync_door_wait_seconds``: a wait past it —
        behind a turn possibly

        HITL-paused on another worker — is the loud, retriable 503
        ``ThreadBusyError`` rather than a

        block past the proxy timeout.


        Returns ``{"removed", "route_name", "thread_id"}``, where ``removed``
        counts the answer

        records this call deleted (0 when a prior run already cleared them, when
        their rows had

        expired under the retention TTL, or when the id was never stored).
      operationId: delete_api_conversations_route_name_thread
      parameters:
        - in: path
          name: route_name
          required: true
          schema:
            type: string
        - description: The thread to forget, as the send door returned it.
          in: query
          name: thread_id
          required: true
          schema:
            minLength: 1
            pattern: \S
            title: Thread Id
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/ThreadDeleteResult'
                required:
                  - data
                type: object
          description: Success.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Malformed request.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid api key.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Resource not found.
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Conflict with the current resource state.
        '501':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: >-
            A dependency this route needs is temporarily unavailable; retry
            shortly.
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ThreadDeleteResult:
      description: >-
        A thread forget. ``removed`` counts the answer records this call
        deleted.
      properties:
        removed:
          title: Removed
          type: integer
        route_name:
          title: Route Name
          type: string
        thread_id:
          title: Thread Id
          type: string
      required:
        - removed
        - route_name
        - thread_id
      title: ThreadDeleteResult
      type: object
    Error:
      properties:
        code:
          description: >-
            Stable machine-readable reason a client keys a dedicated error state
            on, present on refusals that opt in (e.g. a 501 not-configured
            refusal). Optional: absent when the error carries only a
            human-readable message.
          type: string
        error:
          type: string
      required:
        - error
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: x-api-key
      type: apiKey

````