---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}/assistantSessions/{assistantSessionsId}:streamChatAiAssistant"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}/assistantSessions/{assistantSessionsId}:streamChatAiAssistant"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}/assistantSessions/{assistantSessionsId}:streamChatAiAssistant

`POST /v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}/assistantSessions/{assistantSessionsId}:streamChatAiAssistant`

## Request

- Base URL: `https://ces.googleapis.com`
- URL: `https://ces.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}/assistantSessions/{assistantSessionsId}:streamChatAiAssistant`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/ces`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/ces`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`

Runs Arc, the AI assistant, for the specified assistant session in a streaming fashion.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required
- `appsId` string, required
- `assistantSessionsId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string

## Request body

- StreamChatAiAssistantRequest: Request message for SessionService.StreamChatAiAssistant.
  - `attachOnly` boolean: Optional. Optional flag to attach to an existing in-flight turn without submitting a new message.
  - `attachedGcsUris` string[]: Optional. Cloud Storage URIs for files uploaded by the user during this turn. Example: "gs://cxas-transient-uploads/uuid/prd.pdf"
  - `clientCapabilities` string[]: Optional. Response features this client can render. The server only emits events that need a capability (e.g. `confirmation_request`) when the capability is declared, so older clients never receive events they would silently drop.
  - `confirmationResponse` AssistantConfirmationResponse: The user's answer to an AssistantConfirmationRequest, sent on the next SessionService.StreamChatAiAssistant call to resume the paused agent.
    - `answerText` string: The chosen option's submit_text, or free-form user text. The paused action is cancelled and the text is handed to the agent to act on.
    - `confirmationId` string: The AssistantConfirmationRequest.confirmation_id being answered.
    - `confirmed` boolean: Binary answer: true approves the paused action, false declines it.
  - `contextToken` string: Optional. Opaque onboarding context token returned by SessionService.GenerateOnboardingSuggestions. When set and still fresh, the server reuses the onboarding snapshot computed for the zero state instead of recomputing it for the first conversation turn.
  - `message` string: Optional. The message to send to the assistant agent. May be empty when `confirmation_response` is set (answering a pending confirmation without adding a new message); at least one of the two must be provided.
  - `operationCompletedEvent` OperationCompletedEvent: Event sent by the client or background worker to resume an assistant session after an asynchronous Long-Running Operation (LRO) completes.
    - `deduplicationToken` string: Optional deduplication token (e.g. UUID) to prevent duplicate turn execution from concurrent browser tabs.
    - `error` Status: The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
      - `code` integer: The status code, which should be an enum value of google.rpc.Code.
      - `details` object[]: A list of messages that carry the error details. There is a common set of message types for APIs to use.
      - `message` string: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
    - `metadata` object: Optional structured result metadata (e.g. pass_rate, total_examples, export_uri).
    - `operationName` string: The operation resource name (e.g. `operations/{op}`).
    - `operationType` string: The operation type or tool name (e.g. "run_evaluation", "copy_app", "export_app").
    - `status` string: Status of the operation run (e.g. "SUCCEEDED", "FAILED", "CANCELLED").
    - `targetResourceName` string: The primary resource targeted or produced by the operation (e.g. evaluation run ID, app ID, dataset ID).
  - `resumeFromSequenceNumber` string, int64: Optional. Optional cursor to resume and replay events from an in-flight or completed turn.

## Response `200`

Successful response

- StreamChatAiAssistantResponse: Response message for SessionService.StreamChatAiAssistant.
  - `artifactChunk` ArtifactChunk: A streamed fragment of a document artifact (e.g. a markdown TDD) that the assistant is generating. Content deltas stream while the document is being written so clients can render a live preview; the FINALIZED chunk carries the Cloud Storage URI once the file has been persisted.
    - `artifactId` string: Identifier of the artifact, stable across all chunks of one artifact within the stream.
    - `contentDelta` string: Incremental artifact content. Set on DELTA chunks.
    - `displayName` string: The file name shown to the user, e.g. "hotel_booking_tdd.md". Set on STARTED (and repeated on FINALIZED).
    - `gcsUri` string: The Cloud Storage object the artifact was persisted to. Set on FINALIZED chunks.
    - `mimeType` string: The IANA media type of the artifact content, e.g. "text/markdown".
    - `state` 'STATE_UNSPECIFIED' | 'STARTED' | 'DELTA' | 'FINALIZED' | 'FAILED' | 'CLOSED': Lifecycle position of this chunk.
    - `targetApp` string: Output only. The app this artifact was produced for, when it was produced for one. Format: `projects/{project}/locations/{location}/apps/{app}`
  - `confirmationRequest` AssistantConfirmationRequest: A blocking question or confirmation the assistant needs answered before an agent action can proceed. The requesting agent is paused and resumes only when the answer arrives on a later StreamChatAiAssistantRequest.confirmation_response.
    - `agentName` string: Display label of the agent that raised the confirmation (e.g. `"Contract Architect"`), for the card header.
    - `confirmationId` string: Identifier correlating this request with its response. Opaque to clients; must be echoed verbatim on the answering request.
    - `context` string: Context describing what is being confirmed (e.g. the action the agent wants to take, or the question it needs answered). Rendered as plain text, not Markdown.
    - `expireTime` string, google-datetime: Time after which this confirmation can no longer be answered. An expired card renders as inactive, and the server declines the confirmation on the next turn so the paused agent does not wait indefinitely.
    - `negativeLabel` string: Label for the declining action of a binary confirmation (e.g. "Not yet"). Unset when `questions` is populated.
    - `positiveLabel` string: Label for the approving action of a binary confirmation (e.g. "Publish"). Unset when `questions` is populated.
    - `questions` OptionQuestionsChunkQuestion[]: Multi-choice form of the confirmation. When populated, the card renders a selectable option list and the chosen option's submit_text (or free-form user text) is returned as AssistantConfirmationResponse.answer_text.
      - `options` OptionQuestionsChunkOption[]: The selectable options, in presentation order.
        - `details` string: Optional trade-off details shown as secondary text.
        - `submitText` string: Optional message text to send when the option is chosen; defaults to `title` when empty.
        - `title` string: Short plain-text option title (no markdown, no numbering).
      - `question` string: The question header text.
    - `targets` AssistantConfirmationRequestTarget[]: Everything the confirmed action will change, so the console can render "Update 2 apps" and one badge per app. Empty for legacy single-target cards.
      - `action` string: The action, e.g. `CREATE`, `UPDATE`, `DELETE`, `COPY`, `LINK`.
      - `displayName` string: Display name of the resource or app, for the card.
      - `resource` string: The resource that will change, as a full resource name.
      - `targetApp` string: The app the resource belongs to, or empty for a location-scoped action such as creating an app. Format: `projects/{project}/locations/{location}/apps/{app}`
    - `tool` string: Name of the tool call the agent paused on (e.g. "update_app"), for the card header. Unset for pure questions.
  - `eventId` string: Unique identifier for the event.
  - `eventTime` string, google-datetime: Timestamp when the event occurred.
  - `handoff` TurnHandoffEvent: Emitted before this task stops serving the stream mid-turn (e.g. a server restart). The turn's state is persisted; a reconnect carrying resume_from_sequence_number continues it on another task.
    - `reason` 'REASON_UNSPECIFIED' | 'SERVER_RESTART': Why the stream is handing off.
    - `turnId` string: Identifies the turn to resume.
  - `optionQuestionsChunk` OptionQuestionsChunk: Structured clarification options the assistant asks the user to choose among, transduced server-side out of the model's turn (the option block is stripped from the streamed and persisted text). The console renders a keyboard-navigable option list docked above the composer.
    - `questions` OptionQuestionsChunkQuestion[]: The questions asked this turn. More than one entry drives the console's "1 of N" pager.
      - `options` OptionQuestionsChunkOption[]: The selectable options, in presentation order.
        - `details` string: Optional trade-off details shown as secondary text.
        - `submitText` string: Optional message text to send when the option is chosen; defaults to `title` when empty.
        - `title` string: Short plain-text option title (no markdown, no numbering).
      - `question` string: The question header text.
  - `resumeSnapshot` TurnResumeSnapshot: A compacted replay of an in-flight turn: everything needed to render the turn's visible output so far, plus the position live events continue from.
    - `events` StreamChatAiAssistantResponse[]: Compacted events reconstructing the turn's visible output, in render order, using the same event shapes as live streaming.
    - `orphanDeadlineTime` string, google-datetime: When the turn will be wound down if no client remains attached.
    - `resolvedSequenceNumber` string, int64: The position this snapshot represents. Live events follow with sequence_number strictly greater than this. When lower than the resume_from_sequence_number the client requested, flushed progress lags what the client already rendered: the client must discard its rendered content of this turn beyond this position before applying the snapshot.
    - `turnId` string: Identifies the turn being attached to.
  - `sequenceNumber` string, int64: Optional. Monotonically increasing sequence number for this session turn.
  - `sessionCheckpoint` SessionCheckpoint: Session checkpoint containing inferred user intent for session title and UI.
    - `userIntent` string: Inferred user goal or topic for the session (e.g. "Building E-Commerce Support Agent").
  - `status` Status: The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
    - `code` integer: The status code, which should be an enum value of google.rpc.Code.
    - `details` object[]: A list of messages that carry the error details. There is a common set of message types for APIs to use.
    - `message` string: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
  - `textChunk` string: Text Token (for streaming Gemini responses word-by-word).
  - `thoughtChunk` string: Thought text chunk (agent's reasoning before generating response).
  - `toolCall` ToolCall: Request for the client or the agent to execute the specified tool.
    - `agentName` string: Output only. Human-readable name of the agent that issued this call, e.g. "Contract Architect". Empty when the root agent issued it.
    - `args` object: Optional. The input parameters and values for the tool in JSON object format.
    - `displayName` string: Output only. Display name of the tool.
    - `id` string: Optional. The unique identifier of the tool call. If populated, the client should return the execution result with the matching ID in ToolResponse.
    - `parentToolCallId` string: Output only. The id of the tool call that caused this one, when it was issued by a sub-agent working on behalf of a parent call. Empty for top-level calls. Lets a client group a sub-agent's work under the call that started it instead of rendering every step as a sibling.
    - `targetApp` string: Output only. The app this call targets, derived by the assistant from the call's resource arguments: an app resource name, `PROJECT` for location-scoped tools, or empty for session-local tools. Set only in project-scoped assistant sessions.
    - `tool` string: Optional. The name of the tool to execute. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
    - `toolsetTool` ToolsetTool: A tool that is created from a toolset.
      - `toolId` string: Optional. The tool ID to filter the tools to retrieve the schema for.
      - `toolset` string: Required. The resource name of the Toolset from which this tool is derived. Format: `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
  - `toolResponse` ToolResponse: The execution result of a specific tool from the client or the agent.
    - `agentName` string: Output only. Human-readable name of the agent that issued this call, e.g. "Contract Architect". Empty when the root agent issued it.
    - `displayName` string: Output only. Display name of the tool.
    - `id` string: Optional. The matching ID of the tool call the response is for.
    - `parentToolCallId` string: Output only. The id of the tool call that caused this one, when it was issued by a sub-agent working on behalf of a parent call. Empty for top-level calls. Lets a client group a sub-agent's work under the call that started it instead of rendering every step as a sibling.
    - `response` object: Required. The tool execution result in JSON object format. Use "output" key to specify tool response and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as tool execution result.
    - `targetApp` string: Output only. The app the executed tool targeted; mirrors ToolCall.target_app.
    - `tool` string: Optional. The name of the tool to execute. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
    - `toolsetTool` ToolsetTool: A tool that is created from a toolset.
      - `toolId` string: Optional. The tool ID to filter the tools to retrieve the schema for.
      - `toolset` string: Required. The resource name of the Toolset from which this tool is derived. Format: `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
  - `turnCompleted` TurnCompletedEvent: Terminal event of a turn (see StreamChatAiAssistantResponse.turn_completed).
    - `finalSequenceNumber` string, int64: Sequence number of the last event the turn produced. A client whose cursor is lower missed content and should reload the session to see it.
    - `reason` 'REASON_UNSPECIFIED' | 'COMPLETED' | 'ABANDONED' | 'RESUME_UNAVAILABLE': Why the turn ended.
    - `touchedApps` string[]: Apps this turn targeted or changed, so the console can refresh exactly those apps' stores. Project-scoped sessions only. Format: `projects/{project}/locations/{location}/apps/{app}`
    - `turnId` string: Identifier of the turn that ended; matches TurnResumeSnapshot.turn_id and ActiveTurnInfo.turn_id.
  - `turnInProgress` boolean: Optional. Indicates whether the turn is still actively running in the background.
  - `turnMetadata` TurnMetadata: Turn-level metadata and intent categorization.
    - `contractDraftComplete` boolean: Set on the terminal event of a contract draft whose every placeholder is resolved (contract_progress is 100%), whether or not the draft was published. Clients complete and dismiss the contract progress display on it; publication is reported separately by contract_finalized.
    - `contractFinalized` boolean: Set on the final artifact event of a turn whose contract draft was published (a revision was activated). Terminal for the clarification flow of this draft: contract_progress is authoritative and complete.
    - `contractRelated` boolean: Indicates whether this assistant turn was contract-related (e.g. contract drafting, alignment, extraction, or revision).
    - `contractStreamingPhase` 'CONTRACT_STREAMING_PHASE_UNSPECIFIED' | 'DRAFTING' | 'REVISING': Set only on in-flight progress estimates emitted while a contract artifact fence is streaming, and on the revision-turn-start event. Unset on authoritative payloads.
  - `uiEvent` UiEvent: Represents a UI event payload.
    - `jsonPayload` string: The JSON payload representing the A2UI surface.
    - `mimeType` string: The media type (MIME type) indicating the format of the UI event payload (e.g., "application/json+a2ui").

## Changes

- **2026-11-17** `455f2f484021`: 4 info
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2c`
- **2026-11-11** `d1599b011b2e`: 4 info
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/ces/changes/v1/projects/:projectsId/locations/:locationsId/apps/:appsId/assistantSessions/:assistantSessionsId:streamChatAiAssistant/post.md)

---

[API](https://skmtc.dev/google/apis/ces.md) - [All operations](https://skmtc.dev/google/apis/ces/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/ces/revisions/455f2f484021?raw)
