---
title: "Stream a Y2 Agent response"
description: "Streams the Y2 Agent used by the app copilot. Requests use the workspace tools, permissions, shared Agent Y2 credits, and API-key limits. This is not a general multi-model API. v1 callers cannot choose models, use onboarding mode, or attach files. Transcript history supplies user/assistant context but cannot override the fixed system instructions. v1 requires an API key and does not support x402. Both Agent Y2 routes share a throttle of 5 requests/minute and 100/day per key, plus 10 requests/minute and 250/day per user or workspace. A `402` indicates subscription, Agent Y2 credit, or upstream-provider credit exhaustion, not an x402 challenge."
canonical: https://y2.dev/docs/api/reference/agent-y2/streamAgentY2Chat/
---

Endpoint Reference[Agent Y2](https://y2.dev/docs/api/reference/agent-y2)

# Stream a Y2 Agent response

Streams the Y2 Agent used by the app copilot. Requests use the workspace tools, permissions, shared Agent Y2 credits, and API-key limits. This is not a general multi-model API. v1 callers cannot choose models, use onboarding mode, or attach files. Transcript history supplies user/assistant context but cannot override the fixed system instructions. v1 requires an API key and does not support x402. Both Agent Y2 routes share a throttle of 5 requests/minute and 100/day per key, plus 10 requests/minute and 250/day per user or workspace. A \`402\` indicates subscription, Agent Y2 credit, or upstream-provider credit exhaustion, not an x402 challenge.

`POST https://api.y2.dev/api/v1/agent-y2/chat/stream`

- Operation ID: `streamAgentY2Chat`
- Required scopes: `agent:y2`
- Contract: https://y2.dev/openapi.json

## Request body

`application/json`: `AgentY2StreamRequest` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `messages[]` | array of `AgentY2Message` | Yes |  |
| `messages[].role` | `user`, `assistant` | Yes |  |
| `messages[].content` | string or null | No |  |
| `messages[].parts[]` | array of `AgentY2TextPart` | No |  |
| `threadId` | string | No | Existing Y2 chat thread ID returned in `X-Thread-Id` |
| `metadata` | `AgentY2RequestMetadata` | No |  |
| `metadata.source` | string | No |  |
| `metadata.externalUserId` | string | No |  |
| `metadata.externalThreadId` | string | No |  |

## Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | Vercel AI SDK UI message stream |  |
| 400 | Invalid request parameters |  |
| 401 | Missing or invalid API key |  |
| 402 | Agent Y2 subscription, workspace Agent Y2 credit, or provider credit exhaustion |  |
| 403 | Insufficient permissions or access denied |  |
| 429 | Rate limit exceeded (per-key or per-account aggregate) |  |
| 500 | Internal server error |  |
