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

# Mint a chat ticket

> Base URL `https://compute.x402layer.cc/pods/v1`. Auth is `X-API-Key` only. This is the PROGRAMMATIC surface and is NOT the same as the dashboard pod routes (`POST /pods`, `PATCH /pods/{id}/settings`, ...), which take a wallet signature or a browser session and are free to change. Every response carries `x-request-id`.

A short-lived (about 60 second) ticket for the pod's streaming WebSocket. The socket is not proxied through this API; you connect to it directly with the returned `websocket_url`. The ticket is the auth boundary, which is why it is minted here rather than letting you hand an API key to a browser.

**Scope matters.** The socket's frame set is not just chat - it also dispatches file read/write, skill install and backup create/restore. An ordinary API key therefore gets a `chat`-scoped ticket and the channel drops every other frame type. `full` scope needs a key minted with `pods:control:write`. Attachments and interruption are `full` only. The response states which scope was issued rather than letting you find out by rejected frame.

**A `chat` ticket still shares a conversation.** The pod runs ONE session, so an end user can ask the agent about earlier turns and be told. Replies are routed per turn id, so nobody passively reads someone else's stream, but the history is common ground. Issue tickets to your own server or a signed-in user, not to the anonymous public.

The ticket rides in the query string, which is fine for 60 seconds but IS captured in request logs. Treat the URL as the secret and do not persist it. Most integrations do not need this at all: the OpenAI-compatible endpoint covers request/response chat and is per-request isolated in a way this socket is not. Rate limit: the shared write bucket, 60 requests/minute per account.



## OpenAPI

````yaml POST /pods/v1/pods/{id}/chat-ticket
openapi: 3.1.0
info:
  title: x402 Singularity Layer API
  description: >-
    OpenAPI-backed reference for marketplace discovery, payment routes,
    webhooks, wallet-first auth, agent endpoints, and ERC-8004 flows.
  version: 1.0.0
servers:
  - url: https://api.x402layer.cc
security: []
tags:
  - name: Marketplace
    description: Public discovery and listing lookup
  - name: Public Endpoints
    description: Public endpoint metadata and hosted checkout context
  - name: Public Payment Links
    description: Hosted public payment-link lookup
  - name: Payments
    description: Hosted x402 payment challenge routes
  - name: Receipts
    description: Signed receipt lookup and verification helpers
  - name: Ratings
    description: Public listing ratings and authenticated rating actions
  - name: Webhooks
    description: Seller webhook management API
  - name: Agent Auth
    description: Wallet-first challenge and verification routes
  - name: Agent Endpoints
    description: Create, read, top up, and delete agent endpoints
  - name: ERC-8004
    description: Agent registry and registration lifecycle routes
  - name: Marketplace Agents
    description: Public ERC-8004 marketplace discovery routes
  - name: Compute Catalog
    description: Compute plans, regions, and OS catalog
  - name: Compute Instances
    description: Provision, inspect, extend, and destroy compute instances
  - name: Compute API Keys
    description: API keys for compute agent access
  - name: Fundraiser Campaigns
    description: List, view, create, and edit fundraiser campaigns
  - name: Fundraiser Contributions
    description: Record and list campaign contributions
  - name: Fundraiser Comments
    description: Campaign comment threads
  - name: Fundraiser Media
    description: Campaign image uploads and OG images
  - name: Enterprise
    description: >-
      Enterprise partner configuration, endpoint listing, revenue stats, and
      transaction ledger
  - name: Staking
    description: Agentic $SGL staking
  - name: SGL Grid
    description: >-
      Decentralized, confidential, OpenAI-compatible inference served by
      attested TEE nodes.
  - name: Compute Credits
    description: Prepaid USDC credit balance shared across Machines and Grid.
  - name: Agent Pods
    description: >-
      Deploy and manage hosted agents (Agent Pods), plus the pod's
      OpenAI-compatible adapter for external clients.
  - name: Agent Pods API
    description: >-
      The programmatic `/pods/v1` surface: create, drive and destroy Agent Pods
      with a single `X-API-Key`. Distinct from the Agent Pods dashboard routes,
      which expect a wallet signature or a browser session.
paths:
  /pods/v1/pods/{id}/chat-ticket:
    servers:
      - url: https://compute.x402layer.cc
    post:
      tags:
        - Agent Pods API
      summary: Mint a chat ticket for the streaming socket
      description: >-
        Base URL `https://compute.x402layer.cc/pods/v1`. Auth is `X-API-Key`
        only. This is the PROGRAMMATIC surface and is NOT the same as the
        dashboard pod routes (`POST /pods`, `PATCH /pods/{id}/settings`, ...),
        which take a wallet signature or a browser session and are free to
        change. Every response carries `x-request-id`.


        A short-lived (about 60 second) ticket for the pod's streaming
        WebSocket. The socket is not proxied through this API; you connect to it
        directly with the returned `websocket_url`. The ticket is the auth
        boundary, which is why it is minted here rather than letting you hand an
        API key to a browser.


        **Scope matters.** The socket's frame set is not just chat - it also
        dispatches file read/write, skill install and backup create/restore. An
        ordinary API key therefore gets a `chat`-scoped ticket and the channel
        drops every other frame type. `full` scope needs a key minted with
        `pods:control:write`. Attachments and interruption are `full` only. The
        response states which scope was issued rather than letting you find out
        by rejected frame.


        **A `chat` ticket still shares a conversation.** The pod runs ONE
        session, so an end user can ask the agent about earlier turns and be
        told. Replies are routed per turn id, so nobody passively reads someone
        else's stream, but the history is common ground. Issue tickets to your
        own server or a signed-in user, not to the anonymous public.


        The ticket rides in the query string, which is fine for 60 seconds but
        IS captured in request logs. Treat the URL as the secret and do not
        persist it. Most integrations do not need this at all: the
        OpenAI-compatible endpoint covers request/response chat and is
        per-request isolated in a way this socket is not. Rate limit: the shared
        write bucket, 60 requests/minute per account.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Pod id, as returned by create/list.
      responses:
        '200':
          description: Ticket issued.
          headers:
            x-request-id:
              description: >-
                Correlation id for this request. A caller-supplied
                `x-request-id` (8-64 chars of `A-Za-z0-9._-`) is echoed back;
                otherwise one is generated. Quote it in support requests.
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                properties:
                  chat:
                    type: object
                    properties:
                      ticket:
                        type: string
                        nullable: true
                      expires_in_seconds:
                        type: integer
                        example: 60
                      scope:
                        type: string
                        enum:
                          - chat
                          - full
                        description: >-
                          `chat` sends chat and ping only. `full` is the whole
                          workspace frame set and requires `pods:control:write`.
                      shared_session:
                        type: string
                        nullable: true
                        description: >-
                          Present on a `chat` ticket, warning that the pod runs
                          one shared conversation.
                      websocket_url:
                        type: string
                        description: >-
                          Connect here. Contains the ticket - treat the whole
                          URL as a secret.
        '401':
          description: '`unauthorized` - missing or invalid `X-API-Key`.'
          headers:
            x-request-id:
              description: >-
                Correlation id for this request. A caller-supplied
                `x-request-id` (8-64 chars of `A-Za-z0-9._-`) is echoed back;
                otherwise one is generated. Quote it in support requests.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PodV1Error'
        '403':
          description: '`forbidden`.'
          headers:
            x-request-id:
              description: >-
                Correlation id for this request. A caller-supplied
                `x-request-id` (8-64 chars of `A-Za-z0-9._-`) is echoed back;
                otherwise one is generated. Quote it in support requests.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PodV1Error'
        '404':
          description: '`not_found` - pod not found, or chat is not available for it.'
          headers:
            x-request-id:
              description: >-
                Correlation id for this request. A caller-supplied
                `x-request-id` (8-64 chars of `A-Za-z0-9._-`) is echoed back;
                otherwise one is generated. Quote it in support requests.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PodV1Error'
        '429':
          description: >-
            `rate_limited` - too many requests. `details.retry_after_seconds`
            gives the bucket window.
          headers:
            x-request-id:
              description: >-
                Correlation id for this request. A caller-supplied
                `x-request-id` (8-64 chars of `A-Za-z0-9._-`) is echoed back;
                otherwise one is generated. Quote it in support requests.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PodV1Error'
      security:
        - podsApiKey: []
components:
  schemas:
    PodV1Error:
      type: object
      description: >-
        Every `/pods/v1/*` failure has this shape. Branch on `error.code`, never
        on `error.message` - the message is prose and may be reworded.
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - invalid_request
                - unauthorized
                - forbidden
                - not_found
                - conflict
                - limit_exceeded
                - capability_disabled
                - rate_limited
                - not_implemented
                - internal
              description: Stable machine-readable code.
            message:
              type: string
              description: Human-readable explanation.
            details:
              type: object
              description: >-
                Optional structured context, e.g. `{ "code":
                "idempotency_mismatch" }`, `{ "required_scope":
                "pods:wallet:write" }`, `{ "capability": "wallet" }`, `{
                "retry_after_seconds": 60 }`.
  securitySchemes:
    podsApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        A compute API key (`x402c_...`). Mint one in the dashboard under
        Settings -> API Keys. This is the ONLY auth `/pods/v1/*` accepts -
        wallet signatures are bound to method+path+body and do not survive the
        internal hop, so signature callers must use the dashboard routes
        instead. Two extra scopes gate the dangerous powers: `pods:wallet:write`
        (pod wallet money, backup passphrase) and `pods:control:write`
        (connectors, full-power control socket).

````