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

# Create link

> Creates a new Short Link.



## OpenAPI

````yaml post /links
openapi: 3.0.0
info:
  title: Short Menu API
  description: ''
  version: 0.0.2
  contact: {}
servers:
  - url: https://api.shortmenu.com
    description: Default
security:
  - ApiKeyAuth: []
tags: []
paths:
  /links:
    post:
      description: Creates a new Short Link.
      operationId: createLink
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLinkDTO'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LinkDTO'
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '401':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDTO'
components:
  schemas:
    CreateLinkDTO:
      type: object
      properties:
        tags:
          type: array
          description: >-
            Zero or more tags to assign to the new short link. If a tag with the
            same name already exists, it will be reused automatically. Do not
            pass tag `id` values, unless they already exist in your account.
          items:
            $ref: '#/components/schemas/TagDTO'
        destinationUrl:
          type: string
          description: >-
            Destination URL of the new short link. Must be a valid URL starting
            with a scheme such as `https`.
        domain:
          type: string
          description: >-
            Name of the short link domain, e.g. `shm.to`. If your account is set
            up with custom domains, you can pass their names instead.
        slug:
          type: string
          description: >-
            Optional slug for the new short link. If empty, a random slug will
            be generated. Must be unique within the domain.
      required:
        - tags
        - destinationUrl
        - domain
    LinkDTO:
      type: object
      properties:
        id:
          type: string
          description: Identifier of the short link.
        createdAt:
          format: date-time
          type: string
          description: Reference date and time when the short link was created.
        destinationUrl:
          type: string
          description: Destination URL of the short link.
        title:
          type: string
          description: Title of the destination URL (website), if available.
        slug:
          type: string
          description: Slug of the short link, e.g. `ios`.
        domain:
          $ref: '#/components/schemas/DomainDTO'
        shortUrl:
          type: string
          description: Full short URL of the short link, e.g. `https://shm.to/ios`.
        clickCount:
          type: number
          description: Number of times the short link has been clicked.
        tags:
          type: array
          description: Zero or more tags assigned to the short link.
          items:
            $ref: '#/components/schemas/TagDTO'
      required:
        - id
        - createdAt
        - destinationUrl
        - slug
        - domain
        - shortUrl
        - tags
    ErrorResponseDTO:
      type: object
      properties:
        code:
          enum:
            - LINK_LIMIT_REACHED
          type: string
        errorDescription:
          type: string
      required:
        - errorDescription
    TagDTO:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
      required:
        - name
    DomainDTO:
      type: object
      properties:
        id:
          type: string
          description: Identifier of the domain.
        name:
          type: string
          description: Name of the domain, e.g. `shm.to`.
      required:
        - id
        - name
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your Short Menu API Key. Create one at
        [shm.to/create-api-key](https://shm.to/create-api-key).

````