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

# Create A Tag

Create a new Tag and attach it to a sample. Samples can have multiple tags, and samples can be queried by tag — see [Retrieve All Samples](/api-reference/sample-resource-instances).


## OpenAPI

````yaml POST /api/v1/tags
openapi: 3.1.0
info:
  description: >-
    The One Codex API (v1) -- programmatic access to One Codex's suite of
    microbial genomics data storage, analysis, and query tools.
  title: One Codex API (v1)
  version: v1
servers:
  - url: https://app.onecodex.com
security:
  - apiKeyAuth: []
paths:
  /api/v1/tags:
    post:
      summary: POST tags instances
      operationId: post_tags_instances
      requestBody:
        content:
          application/json:
            schema:
              properties:
                name:
                  description: The tag label or name. Name must be 30 characters or fewer.
                  maxLength: 30
                  title: Name
                  type: string
                sample:
                  description: The sample to tag.
                  properties:
                    __DOLLAR_REF__:
                      example: /api/v1/samples/a1b2c3d4e5f67890
                      format: uri
                      pattern: ^/api/v1/samples/[a-f0-9]{16}$
                      type: string
                  type: object
              required:
                - name
                - sample
              title: TagCreateSchema
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/tags'
          description: OK
components:
  schemas:
    tags:
      properties:
        $uri:
          example: /api/v1/tags/0d77065796f8d173
          pattern: ^/api/v1/tags/[a-f0-9]{16}$
          readOnly: true
          title: $Uri
          type: string
        name:
          description: The tag label or name. Name must be 30 characters or fewer.
          maxLength: 30
          title: Name
          type: string
      required:
        - $uri
        - name
      title: tags
      type: object
  securitySchemes:
    apiKeyAuth:
      in: header
      name: X-API-Key
      type: apiKey

````