---
title: "Agent batch completion callback"
method: POST
path: "agentBatchCompleted"
tags: ["Agent API"]
---

# Agent batch completion callback

`POST agentBatchCompleted` (webhook)

KLinePic sends this request to the caller-supplied callbackUrl when a batch reaches a terminal state.

## Headers

- `x-kline-event` 'batch.completed', required
- `x-kline-batch-job-id` string, required
- `x-kline-signature` string

## Payload

- AgentBatchCallbackPayload
  - `event` 'batch.completed', required
  - `ok` boolean, required: True when the batch completed successfully. False means the batch reached failed or cancelled.
  - `requestId` string: Caller request id from batch creation or retry when supplied.
  - `job` AgentBatchJob, required
    - `id` string
    - `status` 'queued' | 'running' | 'completed' | 'failed' | 'cancelled'
    - `total` integer
    - `completed` integer
    - `success` integer
    - `failed` integer
    - `retryRequestAvailable` boolean: True when the underlying batch job retained a safe retry payload. Public Agent retry requests still send a full batch payload; the server uses the source job to rerun failed trades only.
    - `callback` object
      - `configured` true
      - `attempts` integer
      - `maxAttempts` integer
      - `lastAttemptAt` string, date-time
      - `nextAttemptAt` string, date-time
      - `deliveredAt` string, date-time
      - `error` string
    - `results` object[]
      - `tradeId` string
      - `status` string
      - `fileName` string
      - `imageUrl` string, uri: Absolute URL for downloading this PNG.
      - `signedImageUrl` string, uri: Temporary signed URL for downloading this PNG without sending an API key.
  - `links` AgentBatchLinks, required
    - `status` string, uri, required
    - `wait` string, uri, required
    - `events` string, uri, required
    - `manifest` string, uri, required
    - `archive` string, uri, required
  - `signedLinks` AgentSignedBatchLinks
    - `manifest` string, uri, required: Temporary signed manifest URL that can be fetched without an API key.
    - `archive` string, uri, required: Temporary signed ZIP archive URL that can be fetched without an API key.
    - `expiresAt` string, date-time, required
    - `expiresAtUnix` integer, required

## Acknowledgement `200`

Callback accepted.

## Other responses

- `204`: Callback accepted with no response body.

---

[API](https://skmtc.dev/klinepic/apis/klinepic-agent-api.md) · [All operations](https://skmtc.dev/klinepic/apis/klinepic-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/klinepic/apis/klinepic-agent-api/revisions/1c0680282e2c?raw)
