> ## Documentation Index
> Fetch the complete documentation index at: https://www.plungeai.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream an inline workflow

> Run an inline workflow and stream every engine event as SSE until `workflow_completed` or `workflow_error`.


## OpenAPI

```yaml openapi.json post /v1/workflows/execute-stream
openapi: 3.1.0
info:
  title: Ocean One API
  version: 2.5.0
servers:
  - url: https://api.plungeai.com
paths:
  /v1/workflows/execute-stream:
    post:
      operationId: post-v1-workflows-execute-stream
      tags:
        - Workflows
      summary: Execute an inline workflow (YAML or JSON) with SSE event streaming
      security:
        - ozkBearer: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                workflow:
                  description: CNL workflow object, or a YAML string
                input:
                  type: string
                inputs:
                  type: object
                user_context:
                  $ref: "#/components/schemas/UserContext"
              required:
                - workflow
          text/yaml:
            schema:
              type: string
      responses:
        "200":
          description: 'SSE stream: request_received, workflow_loaded, workflow_started, task_dispatched, streaming_started (streaming agents), token (one frame per provider delta: {"task_id","delta"}), heartbeat, task_completed, then workflow_completed (the outcome, carries execution_summary; workflow_error on failure) and workflow_result, always the last frame. Single connection: the gateway drains the provider stream itself; terminal events always arrive on this SSE.'
          content:
            text/event-stream:
              schema:
                type: string
        "400":
          description: missing_workflow / invalid_json / invalid_body (unreadable body) / invalid_workflow / invalid_yaml — refusals before the first frame are this JSON envelope, never an SSE frame
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: unauthorized — missing, invalid or revoked ozk_ key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: agent_not_active — a named agent card is not status:active (refused pre-dispatch)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: "unknown_agent — a named agent id does not exist in the registry (refused pre-dispatch); not_found — no route for this method on this path: every other method answers it"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "413":
          description: payload_too_large — body over 1 MiB (MAX_REQUEST_SIZE)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "429":
          description: rate_limited — Retry-After header
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "502":
          description: engine_error — the engine refused the stream before its first frame
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  schemas:
    Error:
      type: object
      description: Standard error envelope. Every error response also carries an `X-Error-Code` response header equal to error.code, so a client branches on the header regardless of the negotiated body format (json | yaml | markdown | text). When the request created an execution, the `X-Execution-Id` response header is also set. Errors follow the negotiated format like success bodies.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            connect:
              type: object
              description: "On a 424 connection_required / credential_required: where the missing connection is made."
              properties:
                provider:
                  type: string
                method:
                  type: string
                  enum:
                    - oauth
                    - api_key
                    - wallet
                link:
                  type: string
                  example: POST /v1/connections/stripe/link
          required:
            - code
            - message
          additionalProperties: true
      required:
        - error
    UserContext:
      type: object
      description: The caller's time zone, locale and location. Optional on every execute body; when absent the gateway derives it from the request's network location (time zone, approximate place). The agent uses it for local time and as the default schedule time zone.
      properties:
        time_zone:
          type: string
          description: IANA zone
          example: America/Los_Angeles
        locale:
          type: string
          description: BCP-47 tag
          example: en-US
        place:
          type: string
          example: San Francisco, California, US
        latitude:
          type: number
          example: 37.7749
        longitude:
          type: number
          example: -122.4194
        accuracy_m:
          type: number
          description: metres; only with a device GPS fix
          example: 35
        source:
          type: string
          enum:
            - device
            - network
          example: device
      required:
        - source
  securitySchemes:
    ozkBearer:
      type: http
      scheme: bearer
      description: "ozk_ platform API key (Authorization: Bearer ozk_…)"
```
