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

# Send a task to a realm

> JSON-RPC 2.0 endpoint for A2A clients, with the realm's A2A token:
`message/send` starts a task (a run of the skill's team; name the skill in
`message.metadata.skill_id` or a data part, with `inputs`) and returns it;
`message/stream` does the same and streams status updates as server-sent events until the
task ends; `tasks/get` returns a task by `id`. JSON-RPC errors (unknown method, missing
`id`) come back as `{ jsonrpc, id, error: { code, message } }` with HTTP 400.

Requires the realm's A2A bearer token (`Authorization: Bearer cliq_a2a_…`), minted with Generate a token (`type: "a2a"`).



## OpenAPI

````yaml /openapi/hub-by-tag/hub-a2a.yaml post /a2a/o/{org}/r/{slug}/send
openapi: 3.0.3
info:
  title: 'CliqHub API: A2A'
  version: 1.0.0
  description: >-
    Agent-to-agent (A2A) access to a realm. Outside agents read the realm's
    agent card to see

    its skills (one per team the realm runs), then send tasks with JSON-RPC to
    `send`, using the

    realm's A2A token. A2A must be turned on for the realm (Realms, Manage A2A
    for a realm).
servers:
  - url: https://{host}
    variables:
      host:
        default: cliqhub.io
        description: CliqHub host
security: []
tags:
  - name: A2A
    description: >-
      Agent-to-agent (A2A) access to a realm. Outside agents read the realm's
      agent card to see

      its skills (one per team the realm runs), then send tasks with JSON-RPC to
      `send`, using the

      realm's A2A token. A2A must be turned on for the realm (Realms, Manage A2A
      for a realm).
paths:
  /a2a/o/{org}/r/{slug}/send:
    post:
      tags:
        - A2A
      summary: Send a task to a realm
      description: >-
        JSON-RPC 2.0 endpoint for A2A clients, with the realm's A2A token:

        `message/send` starts a task (a run of the skill's team; name the skill
        in

        `message.metadata.skill_id` or a data part, with `inputs`) and returns
        it;

        `message/stream` does the same and streams status updates as server-sent
        events until the

        task ends; `tasks/get` returns a task by `id`. JSON-RPC errors (unknown
        method, missing

        `id`) come back as `{ jsonrpc, id, error: { code, message } }` with HTTP
        400.


        Requires the realm's A2A bearer token (`Authorization: Bearer
        cliq_a2a_…`), minted with Generate a token (`type: "a2a"`).
      operationId: POST_a2a_o_org_r_slug_send
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
          description: The organization's slug.
        - name: slug
          in: path
          required: true
          schema:
            type: string
          description: The realm's slug.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  description: Always `2.0`.
                id:
                  oneOf:
                    - type: string
                    - type: number
                    - description: Unsupported Zod expression `z.null()`
                      type: object
                      additionalProperties: true
                  description: Your request id, echoed in the response.
                method:
                  type: string
                  minLength: 1
                  description: '`message/send`, `message/stream` or `tasks/get`.'
                params:
                  type: object
                  additionalProperties: true
                  description: >-
                    The method's parameters: `message` for send and stream, `id`
                    for `tasks/get`.
              required:
                - method
            examples:
              send:
                summary: Start a task
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: message/send
                  params:
                    message:
                      role: user
                      parts:
                        - kind: text
                          text: Review PR 42
                      metadata:
                        skill_id: acme/code-review
                        inputs:
                          pr_url: https://github.com/acme/api/pull/42
      responses:
        '200':
          description: >-
            A JSON-RPC response `{ jsonrpc, id, result }` whose `result` is the
            task (for `message/stream`, a `text/event-stream` of such messages).
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    enum:
                      - true
                    description: Always `true` on success.
                  jsonrpc:
                    type: string
                    enum:
                      - '2.0'
                  id:
                    description: The request's id.
                  result:
                    type: object
                    properties:
                      id:
                        type: string
                        description: Task id.
                      contextId:
                        type: string
                      status:
                        type: object
                        properties:
                          state:
                            type: string
                            enum:
                              - submitted
                              - working
                              - completed
                              - failed
                              - canceled
                          message:
                            type: string
                      metadata:
                        type: object
                        properties:
                          realm_id:
                            type: string
                          skill_id:
                            type: string
                          queue_item_id:
                            type: string
                          run_id:
                            type: string
                            nullable: true
                      artifacts:
                        type: array
                        items:
                          type: object
                          additionalProperties: true
                required:
                  - ok
              example:
                ok: true
                jsonrpc: '2.0'
                id: 1
                result:
                  id: 9c0d1e2f-3a4b-4c5d-8e6f-7a8b9c0d1e2f
                  status:
                    state: submitted
                  metadata:
                    realm_id: 5b0c3a7e-2f4d-4b8e-9a51-7c1d2e3f4a5b
                    skill_id: acme/code-review
                    queue_item_id: e1d2c3b4-a5f6-4789-8a0b-1c2d3e4f5a6b
                    run_id: null
        '400':
          description: >-
            `bad_request`: `message/send` or `message/stream` without a skill
            id, or the body is not JSON-RPC (no `method`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                bad_request:
                  summary: bad_request
                  value:
                    ok: false
                    error: skill_id required (message.metadata.skill_id or data part)
                    code: bad_request
        '401':
          description: >-
            `unauthorized`: The A2A bearer token is missing, wrong, or A2A is
            turned off for the realm.


            `unauthorized`: No `Authorization` bearer, or it is not the realm's
            A2A token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                unauthorized:
                  summary: unauthorized
                  value:
                    ok: false
                    error:
                      code: unauthorized
                      message: Authentication required
                unauthorized (endpoint):
                  summary: unauthorized (endpoint)
                  value:
                    ok: false
                    error: Bearer does not match realm
                    code: unauthorized
        '403':
          description: '`forbidden`: A2A is turned off for the realm.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                forbidden:
                  summary: forbidden
                  value:
                    ok: false
                    error: A2A is disabled for this realm
                    code: forbidden
        '404':
          description: '`not_found`: No realm has this slug in the organization.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                not_found:
                  summary: not_found
                  value:
                    ok: false
                    error: Realm 'production' not found
                    code: not_found
        '422':
          description: >-
            `invalid_params`: The body fails the request schema: a required
            field is missing or a value has the wrong type or format. The
            message lists every issue as `field: problem`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                invalid_params:
                  summary: invalid_params
                  value:
                    ok: false
                    error: 'method: Required'
                    code: invalid_params
        '500':
          description: >-
            `internal_error`: An unexpected server fault. Retry later; if it
            persists, report it with the time of the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                internal_error:
                  summary: internal_error
                  value:
                    ok: false
                    error: Internal server error
                    code: internal_error
      security:
        - A2aBearer: []
components:
  schemas:
    HubErr:
      type: object
      required:
        - ok
        - error
      description: >-
        Every failure. Route-policy denials (401/403/404, and 400 when neither
        realm_id nor org_id was sent) answer `error` as `{ code, message }`;
        errors raised by the endpoint answer `error` as the message with the
        code beside it in `code`. Every error has a code. See
        [Errors](/hub-api/errors).
      properties:
        ok:
          type: boolean
          description: Always false on error
        error:
          description: The message, or `{ code, message }` for an access denial.
          oneOf:
            - type: string
            - type: object
              required:
                - code
                - message
              properties:
                code:
                  type: string
                message:
                  type: string
        code:
          type: string
          description: Stable error code of an endpoint error.
        details:
          type: object
          additionalProperties: true
          description: Structured detail, when there is some.
  securitySchemes:
    A2aBearer:
      type: http
      scheme: bearer
      description: >-
        Realm A2A bearer (mint/rotate via /v1/auth/generate_token|rotate_token
        with type: a2a and realm_id).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.