---
title: "Finalize a direct foreground segment"
method: POST
path: "/api/v1/agent/persistent/segments/finalize"
tags: ["agent"]
---

# Finalize a direct foreground segment

`POST /api/v1/agent/persistent/segments/finalize`

## Request

- Base URL: `https://composal.com` (the document declares no server; this is the origin it was published from)
- URL: `https://composal.com/api/v1/agent/persistent/segments/finalize`
- Auth: HTTP bearer

Publish the canonical outcome for a SQL direct conversation through its original scoped worker identity. Exact acknowledged retries return the same receipt after retirement; this endpoint grants no inference or tool authority. Current read access and canonical model/tool settlement remain required.

## Request body

- object
  - `scope` object, required
    - `task_id` string, required
    - `segment_id` string, required
    - `generation` integer, required
    - `claim_id` string, required
  - `result` object, required
    - `text` string, required
    - `truncated` boolean, required

## Response `200`

No-store trusted Activity response

- object
  - `organization_id` string, required
  - `agent_id` string, required
  - `task_id` string, required
  - `operation_key` string, required
  - `conversation_id` string, required
  - `version` string, required
  - `scope` object, required
    - `task_id` string, required
    - `segment_id` string, required
    - `generation` integer, required
    - `claim_id` string, required
  - `outcome` 'completed' | 'waiting' | 'failed', required
  - `checkpoint_sequence` integer, required

## Other responses

- `401`: Invalid or expired scoped worker identity
- `403`: Current task authority unavailable
- `404`: Task or organization unavailable
- `409`: Canonical attachment or generation requires reconciliation
- `422`: Invalid or oversized request
- `502`: Bad gateway
- `503`: State or scheduler configuration temporarily unavailable

---

[API](https://skmtc.dev/composal/apis/vex-api.md) - [All operations](https://skmtc.dev/composal/apis/vex-api/llms.txt) - [OpenAPI document](https://skmtc.dev/composal/apis/vex-api/revisions/19698ba051dc?raw)
