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

# Publish a team

> Publishes a version so it can be installed. For a new team, or one with no version yet,
send the package as `data_base64` (a zip with `team.yml`, at most 10 MB); otherwise the
latest version is published again with the new `visibility`, tags and description.
`version` sets the number, or `bump` picks the next one; versions only go up.
`cliq team publish` builds the package for you.

Requires a signed-in user token (`Authorization: Bearer cliq_tok_…`). Results are limited to what that user can see.



## OpenAPI

````yaml /openapi/hub-by-tag/hub-teams.yaml post /v1/teams/publish
openapi: 3.0.3
info:
  title: 'CliqHub API: Teams'
  version: 1.0.0
  description: >-
    The CliqHub team registry. A team is published under a scope
    (`@acme/code-review`) as

    numbered versions. Create a draft, change it (each change can mint the next
    version),

    publish it to make it installable, then install it on daemons. List teams
    with a

    `realm_id` to see a realm's roster and where each team is installed, or with
    a

    `daemon_id` to see what one daemon has. Build a team with AI drafts a team
    from a

    description.


    Changing a team (update, rename, publish, unpublish, delete) needs its
    author, or the

    publish permission in the organization that owns its scope.
servers:
  - url: https://{host}
    variables:
      host:
        default: cliqhub.io
        description: CliqHub host
security: []
tags:
  - name: Teams
    description: >-
      The CliqHub team registry. A team is published under a scope
      (`@acme/code-review`) as

      numbered versions. Create a draft, change it (each change can mint the
      next version),

      publish it to make it installable, then install it on daemons. List teams
      with a

      `realm_id` to see a realm's roster and where each team is installed, or
      with a

      `daemon_id` to see what one daemon has. Build a team with AI drafts a team
      from a

      description.


      Changing a team (update, rename, publish, unpublish, delete) needs its
      author, or the

      publish permission in the organization that owns its scope.
paths:
  /v1/teams/publish:
    post:
      tags:
        - Teams
      summary: Publish a team
      description: >-
        Publishes a version so it can be installed. For a new team, or one with
        no version yet,

        send the package as `data_base64` (a zip with `team.yml`, at most 10
        MB); otherwise the

        latest version is published again with the new `visibility`, tags and
        description.

        `version` sets the number, or `bump` picks the next one; versions only
        go up.

        `cliq team publish` builds the package for you.


        Requires a signed-in user token (`Authorization: Bearer cliq_tok_…`).
        Results are limited to what that user can see.
      operationId: POST_v1_teams_publish
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: >-
                    Team name — mutually exclusive with team_id as the lookup
                    key
                scope:
                  type: string
                  description: Scope (publisher) slug
                team_id:
                  type: string
                  format: uuid
                  description: Team UUID — mutually exclusive with name as the lookup key
                version:
                  type: string
                  description: Explicit version string; omit to auto-bump from latest
                bump:
                  type: string
                  enum:
                    - patch
                    - minor
                    - major
                  description: Bump magnitude when auto-versioning; omit for patch
                changelog:
                  type: string
                  description: Release notes for this version
                description:
                  type: string
                  description: Updated description to apply on publish
                license:
                  type: string
                  description: SPDX license identifier
                tags:
                  type: array
                  items:
                    type: string
                  description: Tag slugs to attach
                visibility:
                  type: string
                  enum:
                    - public
                    - private
                  description: >-
                    Visibility after publish; must be public or private (draft
                    is rejected)
                data_base64:
                  type: string
                  description: >-
                    Base64-encoded team package zip (required for first publish
                    without prior versions)
                agents:
                  type: object
                  additionalProperties: true
                  description: Agent binding overrides for this version
            examples:
              default:
                value:
                  scope: acme
                  name: code-review
                  visibility: public
                  bump: minor
                  changelog: Adds a fix phase
                  tags:
                    - review
                    - github
      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:
                    $ref: '#/components/schemas/TeamMutationData'
              example:
                ok: true
                data:
                  id: 3f6c2a8e-6b1d-4c1e-9a57-0d2f4b8e91c4
                  name: code-review
                  scope: acme
                  version: 1.6.0
                  status: published
                  listed: true
        '401':
          description: >-
            `unauthorized`: No `Authorization` header, or the token is
            malformed, expired or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                unauthorized:
                  summary: unauthorized
                  value:
                    ok: false
                    error:
                      code: unauthorized
                      message: Authentication required
        '403':
          description: >-
            `forbidden`: A daemon token was used; this route needs a user token.


            `forbidden`: You cannot publish to the scope, or you are not the
            team's author.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                forbidden:
                  summary: forbidden
                  value:
                    ok: false
                    error:
                      code: forbidden
                      message: You do not have access to do this
                forbidden (endpoint):
                  summary: forbidden (endpoint)
                  value:
                    ok: false
                    error: You are not the author of this team
                    code: forbidden
        '404':
          description: '`not_found`: `team_id` names no team.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                not_found:
                  summary: not_found
                  value:
                    ok: false
                    error: Team not found
                    code: not_found
        '409':
          description: '`conflict`: This version is already published.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                conflict:
                  summary: conflict
                  value:
                    ok: false
                    error: Version 1.5.0 already exists
                    code: conflict
        '422':
          description: >-
            `invalid_params`: `data_base64` is missing for a new team, the
            version is not semver or is lower than the latest, more than 20
            tags, or the package is over 10 MB.


            `invalid_package`: The package has no valid `team.yml`, or a review
            (HUG) phase lacks reviewer groups with a policy and channels.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                invalid_params:
                  summary: invalid_params
                  value:
                    ok: false
                    error: >-
                      Version 1.3.0 is older than the current latest (1.5.0).
                      Publish a version >= 1.5.0.
                    code: invalid_params
                invalid_package:
                  summary: invalid_package
                  value:
                    ok: false
                    error: Package must contain a valid team.yml
                    code: invalid_package
        '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:
        - BearerAuth: []
components:
  schemas:
    TeamMutationData:
      type: object
      properties:
        id:
          type: string
          description: Team UUID
        name:
          type: string
          description: Team name
        scope:
          type: string
          description: Scope (publisher) slug
        status:
          type: string
          enum:
            - draft
            - published
          description: Lifecycle status after the mutation
        version:
          type: string
          nullable: true
          description: Version string after the mutation; null when no version was seeded
        listed:
          type: boolean
          description: Listed flag (present after unpublish)
        draft_saved_at:
          type: string
          nullable: true
          description: >-
            teams/update: when the working copy was saved (save_as draft), or
            null after a version was minted
      required:
        - id
        - name
        - scope
        - status
        - version
    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:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: cliq_tok_* | cliq_dt_*
      description: >-
        User PAT (`cliq_tok_…`, including session-scoped) or realm token
        (`cliq_dt_…`).

````

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