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

# Create a label

> Creates an organization label; owners and admins only. With an `Idempotency-Key`, a retry returns the label the first request created. A test key can't create labels.

Needs the `library:organize` scope.



## OpenAPI

````yaml /openapi.json post /labels
openapi: 3.1.0
info:
  title: ZeroGen API
  version: v1
  description: >-
    Generate images and video with every model in ZeroGen from your own servers.
    Generated from the API's contracts by `npm run openapi` in apps/web; do not
    edit by hand.
servers:
  - url: https://api.zerogen.com/v1
security:
  - bearerAuth: []
tags:
  - name: Account
    description: The calling key and the organization's balance.
  - name: Models
    description: The models an organization can run and their schemas.
  - name: Runs
    description: Quote, create, read, list and cancel runs.
  - name: Uploads
    description: Upload files into the Library to use as inputs.
  - name: Projects
    description: The organization's projects.
  - name: Assets
    description: >-
      Search and read Library assets and their lineage; rename and favorite
      them.
  - name: Folders
    description: >-
      A project's folders: create, rename and move them, and add, move and
      remove their assets.
  - name: Labels
    description: 'Organization labels: manage them, and add them to assets or remove them.'
  - name: Naming presets
    description: A project's shared naming presets, for naming a run's outputs.
  - name: Skills
    description: The skills available to the key's owner.
paths:
  /labels:
    post:
      tags:
        - Labels
      summary: Create a label
      description: >-
        Creates an organization label; owners and admins only. With an
        `Idempotency-Key`, a retry returns the label the first request created.
        A test key can't create labels.


        Needs the `library:organize` scope.
      operationId: createLabel
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLabelRequest'
            example:
              name: Needs review
              color: '#ef4444'
      responses:
        '201':
          description: The new label.
          headers:
            Request-Id:
              $ref: '#/components/headers/Request-Id'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            Idempotent-Replayed:
              $ref: '#/components/headers/Idempotent-Replayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Label'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        Makes retries safe: a retry with the same key and body returns the first
        response for 24 hours instead of repeating the work. Reusing a key with
        a different body returns 409.
      schema:
        type: string
        minLength: 1
        maxLength: 255
        pattern: ^[\x21-\x7e]+$
  schemas:
    CreateLabelRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 40
        description:
          type: string
          maxLength: 280
        color:
          type: string
          enum:
            - '#ef4444'
            - '#f97316'
            - '#f59e0b'
            - '#eab308'
            - '#84cc16'
            - '#22c55e'
            - '#14b8a6'
            - '#06b6d4'
            - '#3b82f6'
            - '#6366f1'
            - '#8b5cf6'
            - '#ec4899'
          description: >-
            One of the preset colors: Red #ef4444, Orange #f97316, Amber
            #f59e0b, Yellow #eab308, Lime #84cc16, Green #22c55e, Teal #14b8a6,
            Cyan #06b6d4, Blue #3b82f6, Indigo #6366f1, Violet #8b5cf6, Pink
            #ec4899.
      required:
        - name
      additionalProperties: false
    Label:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type:
            - string
            - 'null'
        color:
          type: string
        assetCount:
          type: integer
          minimum: 0
          maximum: 9007199254740991
        archived:
          type: boolean
      required:
        - id
        - name
        - description
        - color
        - archived
      additionalProperties: false
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/Error'
      required:
        - error
      additionalProperties: false
    Error:
      type: object
      properties:
        code:
          type: string
          pattern: ^[a-z][a-z0-9_]{0,79}$
        message:
          type: string
        param:
          type: string
        retryable:
          type: boolean
        details:
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
      required:
        - code
        - message
        - retryable
      additionalProperties: false
  headers:
    Request-Id:
      description: Identifies the request; quote it when contacting support.
      schema:
        type: string
    RateLimit-Limit:
      description: Requests the key may make in the current window.
      schema:
        type: integer
    RateLimit-Remaining:
      description: Requests left in the current window.
      schema:
        type: integer
    RateLimit-Reset:
      description: Seconds until the current window resets.
      schema:
        type: integer
    Idempotent-Replayed:
      description: >-
        true when this response replays an earlier request with the same
        Idempotency-Key.
      schema:
        type: string
        enum:
          - 'true'
    WWW-Authenticate:
      description: Bearer realm="ZeroGen API".
      schema:
        type: string
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  responses:
    BadRequest:
      description: >-
        The request is malformed or invalid: invalid_request, validation_failed,
        model_unavailable or input_import_failed.
      headers:
        Request-Id:
          $ref: '#/components/headers/Request-Id'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: 'invalid_api_key: the key is missing, revoked or expired.'
      headers:
        Request-Id:
          $ref: '#/components/headers/Request-Id'
        WWW-Authenticate:
          $ref: '#/components/headers/WWW-Authenticate'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: >-
        permission_denied: the key lacks the scope this endpoint needs, the
        request came from a browser, or the API isn't enabled for the
        organization.
      headers:
        Request-Id:
          $ref: '#/components/headers/Request-Id'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Conflict:
      description: >-
        idempotency_conflict: the Idempotency-Key was used for a different
        request. idempotency_in_progress: the first request with this key hasn't
        finished. invalid_state: the request can't go ahead as things stand,
        such as a run that needs a person's approval in ZeroGen.
      headers:
        Request-Id:
          $ref: '#/components/headers/Request-Id'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    PayloadTooLarge:
      description: The request body is larger than 128 KB.
      headers:
        Request-Id:
          $ref: '#/components/headers/Request-Id'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UnsupportedMediaType:
      description: Send the body as application/json.
      headers:
        Request-Id:
          $ref: '#/components/headers/Request-Id'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    TooManyRequests:
      description: >-
        rate_limited: the key or its owner is over the rate limit, or the
        organization is at its running cap. Retry after Retry-After seconds.
      headers:
        Request-Id:
          $ref: '#/components/headers/Request-Id'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: 'internal: something went wrong. Retry.'
      headers:
        Request-Id:
          $ref: '#/components/headers/Request-Id'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ServiceUnavailable:
      description: >-
        unavailable or pricing_unavailable: API keys, billing or pricing can't
        be reached right now. Retry.
      headers:
        Request-Id:
          $ref: '#/components/headers/Request-Id'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'A ZeroGen API key: zg_ for a live key, zg_test_ for a test key.'

````

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