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

# Crear enlace corto

> Crea un enlace corto que redirige a una URL.



## OpenAPI

````yaml /es/short-links-api/api-reference/openapi-short-links.json post /v1/short-links
openapi: 3.0.3
info:
  title: 'API de notificación: enlaces cortos'
  description: >-
    API para **crear**, **enumerar**, **actualizar** y **eliminar** enlaces
    cortos del espacio de trabajo (dominio predeterminado **clicar.co** o según
    configuración), además de **análisis** (series temporales y pausas) y
    **lista de clics individuales**.


    **Autenticación:** Clave API en `Authorization: Bearer sk_live_xxxxx` o
    `x-api-key: sk_live_xxxxx`. El **espacio de trabajo** es siempre el de la
    clave (cada clave API pertenece a un espacio de trabajo); **no** envíe
    `x-workspace-id` en API v1: las solicitudes con este encabezado completado
    reciben **400** (`WORKSPACE_HEADER_NOT_ALLOWED`).


    **Ámbitos:** `short_links:read` (OBTENER) y `short_links:manage` (POST,
    PATCH, BORRAR).
  version: 1.0.0
servers:
  - url: https://api.notifique.dev
    description: Producción
security:
  - ntfShortLinksBearerAuth: []
  - ntfShortLinksApiKeyHeader: []
tags:
  - name: Enlaces cortos
    description: CRUD, listado, análisis y eventos de clic en `/v1/short-links`.
paths:
  /v1/short-links:
    post:
      tags:
        - Short links
      summary: Crear enlace corto
      description: Crea un enlace corto que redirige a una URL.
      operationId: ntfShortLinks_postV1ShortLinks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NtfShortLinks_CreateRequest'
            examples:
              minimal:
                summary: Solo URL de destino
                value:
                  targetUrl: https://minha-loja.com/checkout
              withCustomSlug:
                summary: Slug personalizado
                value:
                  targetUrl: https://blog.exemplo.com/post/anuncio-2026
                  customCode: post-2026
      responses:
        '200':
          description: Enlace creado o recuperado exitosamente.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfShortLinks_CreateResponse'
              examples:
                created:
                  value:
                    success: true
                    data:
                      id: clshort01exampleid0003
                      code: post-2026
                      domain: clicar.co
                      targetUrl: https://blog.exemplo.com/post/anuncio-2026
                      shortUrl: https://clicar.co/post-2026
                      source: API
                      createdAt: '2026-04-20T16:00:00.000Z'
        '400':
          description: >-
            Cuerpo no válido (validación), slug no válido/reservado, slug en
            uso, URL rechazada por la política de destino o error de creación
            genérico.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/NtfShortLinks_ErrorResponse'
                  - $ref: '#/components/schemas/NtfShortLinks_ValidationErrorResponse'
              examples:
                validationElysia:
                  summary: >-
                    Validación del esquema (por ejemplo, targetUrl demasiado
                    corta)
                  value:
                    success: false
                    error: Invalid data
                    message: Does not meet validation rules (e.g. length or format).
                    fields:
                      - path: targetUrl
                        message: String must contain at least 4 character(s)
                    code: UNKNOWN_ERROR
                invalidSlug:
                  summary: Slug personalizado no válido
                  value:
                    success: false
                    error: Bad Request
                    message: >-
                      Invalid slug: use 4–32 characters (letters, numbers, _ or
                      -).
                    code: BAD_REQUEST
                reservedSlug:
                  summary: Slug reservado
                  value:
                    success: false
                    error: Bad Request
                    message: This slug is reserved. Choose another one.
                    code: BAD_REQUEST
                slugOrDup:
                  summary: Slug en uso o URL ya registrada en el espacio de trabajo
                  value:
                    success: false
                    error: Bad Request
                    message: >-
                      Slug already in use or URL already registered for this
                      workspace.
                    code: BAD_REQUEST
                targetBlockedHost:
                  summary: 'URL rechazada: host bloqueado'
                  value:
                    success: false
                    error: Bad Request
                    message: 'Target URL rejected: BLOCKED_HOST'
                    code: SHORT_LINK_TARGET_BLOCKED_HOST
                targetInvalidUrl:
                  summary: 'URL rechazada: no válida'
                  value:
                    success: false
                    error: Bad Request
                    message: 'Target URL rejected: INVALID_URL'
                    code: SHORT_LINK_TARGET_INVALID_URL
                targetRedirect:
                  summary: >-
                    URL rechazada: redireccionamiento no permitido en la
                    validación
                  value:
                    success: false
                    error: Bad Request
                    message: 'Target URL rejected: REDIRECT'
                    code: SHORT_LINK_TARGET_REDIRECT
                targetNotOkHttp:
                  summary: 'URL rechazada: HTTP no está bien'
                  value:
                    success: false
                    error: Bad Request
                    message: 'Target URL rejected: NOT_OK_HTTP'
                    code: SHORT_LINK_TARGET_NOT_OK_HTTP
                targetImageContent:
                  summary: 'URL rechazada: contenido de la imagen'
                  value:
                    success: false
                    error: Bad Request
                    message: 'Target URL rejected: IMAGE_CONTENT'
                    code: SHORT_LINK_TARGET_IMAGE_CONTENT
                targetTimeout:
                  summary: 'URL rechazada: tiempo de espera agotado'
                  value:
                    success: false
                    error: Bad Request
                    message: 'Target URL rejected: TIMEOUT'
                    code: SHORT_LINK_TARGET_TIMEOUT
                targetNetwork:
                  summary: 'URL rechazada: error de red'
                  value:
                    success: false
                    error: Bad Request
                    message: 'Target URL rejected: NETWORK'
                    code: SHORT_LINK_TARGET_NETWORK
        '401':
          description: Clave API faltante o no válida.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfShortLinks_ErrorResponse'
              examples:
                unauthorized:
                  value:
                    success: false
                    error: Unauthorized
                    message: Invalid or missing API Key
                    code: UNAUTHORIZED
        '402':
          description: Espacio de trabajo cerrado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfShortLinks_ErrorResponse'
              examples:
                paymentRequired:
                  value:
                    success: false
                    error: Payment Required
                    message: Plan expired or suspended
                    code: WORKSPACE_BLOCKED
        '403':
          description: >-
            Alcance `short_links:manage` falta **o** función deshabilitada en el
            espacio de trabajo.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfShortLinks_ErrorResponse'
              examples:
                missingScope:
                  value:
                    success: false
                    error: Forbidden
                    message: 'Missing scope: short_links:manage'
                    code: FORBIDDEN
                featureDisabled:
                  value:
                    success: false
                    error: Forbidden
                    message: >-
                      Short links are disabled for this workspace. Enable them
                      in Settings.
                    code: SHORT_LINKS_DISABLED
components:
  schemas:
    NtfShortLinks_CreateRequest:
      type: object
      required:
        - targetUrl
      properties:
        targetUrl:
          type: string
          minLength: 4
          maxLength: 4096
          description: URL de destino (normalmente `http` o `https`).
        customCode:
          type: string
          nullable: true
          minLength: 1
          maxLength: 64
          description: >-
            Babosa opcional; reglas de formato, lista reservada y unicidad en el
            dominio.
    NtfShortLinks_CreateResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          required:
            - id
            - code
            - domain
            - targetUrl
            - shortUrl
            - source
            - createdAt
          properties:
            id:
              type: string
              description: algo de tu enlace.
            code:
              type: string
              description: Ruta de enlace curto (slug).
            domain:
              type: string
              example: clicar.co
            targetUrl:
              type: string
              format: uri
            shortUrl:
              type: string
              format: uri
              description: URL pública completa.
            source:
              type: string
              enum:
                - AUTO
                - MANUAL
                - API
              description: Para POST manual, generalmente `API`.
            createdAt:
              type: string
              format: date-time
    NtfShortLinks_ErrorResponse:
      type: object
      description: Error genérico de API v1 (enlaces cortos).
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          description: >-
            Etiqueta de error de estilo HTTP (por ejemplo, no autorizado,
            solicitud incorrecta, no encontrada).
        message:
          type: string
          nullable: true
          description: >-
            Mensaje legible por humanos para usuarios finales (localizado a
            través de Accept-Language/x-locale cuando corresponda).
        code:
          type: string
          nullable: true
          description: >-
            Código API v1 estable (enumeración). Siempre presente en los
            errores. Úselo con el estado HTTP para decidir reintentar o
            corregir. Ver [Respuestas de
            error](/es/guides/conceitos/resposta-de-erros).
      required:
        - success
        - error
        - message
        - code
    NtfShortLinks_ValidationErrorResponse:
      type: object
      description: >-
        Respuesta de validación global (Elysia) para cuerpo/consulta no válidos;
        HTTP **400**.
      required:
        - success
        - error
        - message
        - code
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          example: Invalid data
          description: >-
            Etiqueta de error de estilo HTTP (por ejemplo, no autorizado,
            solicitud incorrecta, no encontrada).
        message:
          type: string
          description: >-
            Mensaje legible por humanos para usuarios finales (localizado a
            través de Accept-Language/x-locale cuando corresponda).
        fields:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              message:
                type: string
          description: Erros por campo (formato pode variar conforme versão do validador).
        details:
          type: object
          description: Presente solo en el entorno de desarrollo, cuando corresponda.
        code:
          type: string
          description: >-
            Código API v1 estable (enumeración). Siempre presente en los
            errores. Úselo con el estado HTTP para decidir reintentar o
            corregir. Ver [Respuestas de
            error](/es/guides/conceitos/resposta-de-erros).
  securitySchemes:
    ntfShortLinksBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Clave API sin autorización de encabezado. Ejemplo: `Authorization:
        Bearer sk_live_xxxxx`
    ntfShortLinksApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: 'Clave API sin encabezado x-api-key. Ejemplo: `x-api-key: sk_live_xxxxx`'

````