---
title: "Stream API v2 completion"
method: POST
path: "/get_completion_v2"
---

# Stream API v2 completion

`POST /get_completion_v2`

## Request

- Base URL: `https://api-integration-v2-qd6wo466iq-uc.a.run.app`
- URL: `https://api-integration-v2-qd6wo466iq-uc.a.run.app/get_completion_v2`
- Auth: HTTP bearer

Starts an SSE agent run. When allowances are enabled, consumerId and usageRequestId are required. An in-progress response may finish above the limit; the next request is rejected. Every request must use the integration owner's API key. Errors with X-Agent-Run-Admitted: false were rejected before reserving a run. If that header is absent after an interruption, check chat status using the same usageRequestId before retrying. A failed response stays in chat history. Its attachments are not sent again in later turns; attach them again to retry. Other messages and their successful attachments remain available.

## Request body

- GetCompletionV2Request
  - `apiIntegrationId` string, required
  - `message` string, required
  - `agent` string: Agency entry point. The integration default is used when omitted.
  - `chatId` string, nullable
  - `aliasChatId` string, nullable
  - `attachments` ApiV2Attachment[]
    - union
      - ApiV2FileAttachment
        - `type` 'input_file', required
        - `file_url` string, uri, required: A publicly accessible HTTPS URL for the file.
        - `filename` string: Optional file name without a directory path.
      - ApiV2ImageAttachment
        - `type` 'input_image', required
        - `image_url` string, required: A publicly accessible HTTPS image URL or an inline image data URL.
        - `detail` 'auto' | 'low' | 'high'
  - `sandboxFiles` object[]: Files already uploaded into this integration's persistent agency mount. The agent can read these paths with sandbox tools; send images in attachments as well when the model should see them.
    - `name` string, required: Uploaded filename. Must match the final path segment and contain no control characters.
    - `path` string, required: Canonical /app/mnt/ path returned by create_agency_upload.
  - `user_context` union
    - object
    - string
  - `consumerId` string: Required when member allowances are enabled.
  - `usageRequestId` string: Unique ID for this request, included in chat status and usage records. Required when allowances are enabled. Match it when recovering an interrupted request.
  - `attachmentUrlRefreshes` object: Map each expired earlier attachment URL without its query string to a fresh HTTPS URL with the same host and path. Include all earlier conversation files that need refreshing.

## Response `200`

Server-sent events by default, or plain text when Text Only Mode is enabled for the integration.

## Other responses

- `400`: Invalid request or missing allowance attribution.
- `401`: Missing or invalid platform API key.
- `403`: The API key does not own this integration.
- `404`: Integration or member not found. Register the member before starting a completion.
- `409`: The previous run is still active. Wait or cancel that exact run before starting another.
- `429`: Consumer is inactive or has exhausted the current allowance.

## Changes

- **2026-11-03** `d9ab31b0307f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/agency-swarm/apis/agencii-platform-api/changes/get_completion_v2/post.md)

---

[API](https://skmtc.dev/agency-swarm/apis/agencii-platform-api.md) - [All operations](https://skmtc.dev/agency-swarm/apis/agencii-platform-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agency-swarm/apis/agencii-platform-api/revisions/d9ab31b0307f?raw)
