> ## 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.

# Connect a Jira workspace

> Connects a Jira workspace to a realm. The first time, the reply has the `webhook_secret` the Jira app signs its calls with (shown once); connecting again keeps the existing secret.

No authentication: anyone can call this.



## OpenAPI

````yaml /openapi/hub-by-tag/hub-jira.yaml post /v1/integrations/jira/register_workspace
openapi: 3.0.3
info:
  title: 'CliqHub API: Jira'
  version: 1.0.0
  description: >-
    The Jira (Forge) app's connection to CliqHub: it binds a Jira workspace to a
    realm so Jira

    can start runs and receive results. Called by the Jira app with a session or
    its `api_token`

    (a CliqHub user token). These endpoints answer 404 when the integration is
    turned off.
servers:
  - url: https://{host}
    variables:
      host:
        default: cliqhub.io
        description: CliqHub host
security: []
tags:
  - name: Jira
    description: >-
      The Jira (Forge) app's connection to CliqHub: it binds a Jira workspace to
      a realm so Jira

      can start runs and receive results. Called by the Jira app with a session
      or its `api_token`

      (a CliqHub user token). These endpoints answer 404 when the integration is
      turned off.
paths:
  /v1/integrations/jira/register_workspace:
    post:
      tags:
        - Jira
      summary: Connect a Jira workspace
      description: >-
        Connects a Jira workspace to a realm. The first time, the reply has the
        `webhook_secret` the Jira app signs its calls with (shown once);
        connecting again keeps the existing secret.


        No authentication: anyone can call this.
      operationId: POST_v1_integrations_jira_register_workspace
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                api_token:
                  type: string
                  minLength: 1
                  description: Forge headless PAT; ignored when session Bearer is present
                realm_id:
                  type: string
                  minLength: 1
                  description: Realm to bind the workspace to
                webhook_url:
                  type: string
                  format: uri
                  description: Jira webhook delivery URL
                workspace_id:
                  type: string
                  minLength: 1
                  maxLength: 128
                  description: Atlassian workspace/cloud ID
                workspace_url:
                  type: string
                  format: uri
                  description: >-
                    Base URL of the Jira workspace (e.g.
                    https://acme.atlassian.net)
              required:
                - realm_id
                - webhook_url
                - workspace_id
                - workspace_url
            examples:
              default:
                value:
                  realm_id: 5b0c3a7e-2f4d-4b8e-9a51-7c1d2e3f4a5b
                  workspace_id: 1a2b3c4d-acme-cloud
                  workspace_url: https://acme.atlassian.net
                  webhook_url: https://acme.atlassian.net/x/webhook
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                properties:
                  ok:
                    type: boolean
                    enum:
                      - true
                    description: Always `true` on success.
                  data:
                    type: object
                    properties:
                      subscription_id:
                        type: string
                      webhook_secret:
                        type: string
                        description: First registration only.
                      realm_id:
                        type: string
                      workspace_id:
                        type: string
                      cliq_user:
                        type: object
                        properties:
                          id:
                            type: string
                          username:
                            type: string
                          email:
                            type: string
              example:
                ok: true
                data:
                  subscription_id: 7b8c9d0e-1f2a-4b3c-8d4e-5f6a7b8c9d0e
                  webhook_secret: whsec_9f2c…
                  realm_id: 5b0c3a7e-2f4d-4b8e-9a51-7c1d2e3f4a5b
                  workspace_id: 1a2b3c4d-acme-cloud
                  cliq_user:
                    id: 1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
                    username: sshah
                    email: dev@acme.example
        '401':
          description: '`unauthorized`: No session and no valid `api_token`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                unauthorized:
                  summary: unauthorized
                  value:
                    ok: false
                    error: invalid api_token
                    code: unauthorized
        '404':
          description: >-
            `not_found`: The realm does not exist, or the integration is turned
            off.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                not_found:
                  summary: not_found
                  value:
                    ok: false
                    error: realm '5b0c3a7e-2f4d-4b8e-9a51-7c1d2e3f4a5b' 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: 'realm_id: 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: []
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.

````

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