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

# Create a team draft

> Creates a team as a draft in a scope you can publish to. With `manifest` (or
`forked_from`, to start from another team's version) it also gets version 0.1.0.

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/create
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/create:
    post:
      tags:
        - Teams
      summary: Create a team draft
      description: >-
        Creates a team as a draft in a scope you can publish to. With `manifest`
        (or

        `forked_from`, to start from another team's version) it also gets
        version 0.1.0.


        Requires a signed-in user token (`Authorization: Bearer cliq_tok_…`).
        Results are limited to what that user can see.
      operationId: POST_v1_teams_create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  description: >-
                    Team name — lowercase letters, numbers, and hyphens; must
                    start with a letter
                scope:
                  type: string
                  minLength: 1
                  description: >-
                    Scope (publisher) slug; caller must have write access to
                    this scope
                description:
                  type: string
                  description: Human-readable summary
                forked_from:
                  type: object
                  properties:
                    team_id:
                      type: string
                      format: uuid
                      description: Team to fork
                    version:
                      type: string
                      description: Version to fork from; omit for the latest
                  required:
                    - team_id
                  description: >-
                    Start the new team as a copy of this team version (its
                    manifest unless `manifest` is given); the new team records
                    where it came from
                manifest:
                  oneOf:
                    - type: string
                    - type: object
                      additionalProperties: true
                  description: >-
                    Team manifest as YAML string or parsed object; seeds version
                    0.1.0 when provided
                team_json:
                  type: string
                  description: SPA builder canvas JSON string (alternative to manifest)
              required:
                - name
                - scope
            examples:
              default:
                value:
                  scope: acme
                  name: release-notes
                  description: Writes release notes from merged PRs.
                  manifest: |
                    name: release-notes
                    version: 0.1.0
                    phases:
                      - name: write
                        agent: claude-code
              fork:
                summary: Fork another team
                value:
                  scope: acme
                  name: code-review-strict
                  forked_from:
                    team_id: 3f6c2a8e-6b1d-4c1e-9a57-0d2f4b8e91c4
      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: 8a7b6c5d-4e3f-4a1b-9c8d-7e6f5a4b3c2d
                  name: release-notes
                  scope: acme
                  status: draft
                  version: 0.1.0
        '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 that scope.
          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 don't have access to scope '@acme'
                    code: forbidden
        '404':
          description: >-
            `not_found`: The team in `forked_from` does not exist, you cannot
            see it, or the version does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                not_found:
                  summary: not_found
                  value:
                    ok: false
                    error: Team to fork not found
                    code: not_found
        '409':
          description: '`conflict`: A team with this name already exists in the scope.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                conflict:
                  summary: conflict
                  value:
                    ok: false
                    error: Team @acme/release-notes already exists
                    code: conflict
        '422':
          description: >-
            `invalid_params`: The name is not lowercase letters, digits and
            hyphens starting with a letter, or the manifest is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                invalid_params:
                  summary: invalid_params
                  value:
                    ok: false
                    error: >-
                      Team name must be lowercase letters, numbers, and hyphens,
                      starting with a letter
                    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:
        - 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.