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

# Crear alerta

> Crea una alerta geolocalizada. Requiere autenticación Bearer (token de login) y contexto de negocio.
El cuerpo incluye `account` con `typeId` y opcionalmente `tag`/`value` para resolver el accountId.




## OpenAPI

````yaml openapi/external-v1.yaml post /alert
openapi: 3.1.0
info:
  title: Goil Public API (External)
  description: >
    API pública para integraciones externas. Permite autenticación, gestión de
    cuentas

    y envío de notificaciones y alertas.


    **Autenticación**: La mayoría de endpoints requieren el header `x-client-id`
    (businessId).

    Tras llamar a `POST /authentication/login` obtendrás un `accessToken` para
    usar en

    endpoints que requieran Bearer token (p. ej. alertas).
  version: 1.0.0
  contact:
    name: Goil API Support
servers:
  - url: https://community.goil.app/api/v1/external
    description: Production
security: []
tags:
  - name: Authentication
    description: Login para integraciones externas
  - name: Account
    description: Crear, consultar, listar, actualizar y eliminar cuentas
  - name: Notification
    description: Envío de notificaciones push/SMS
  - name: Alert
    description: Creación y actualización de alertas geolocalizadas
paths:
  /alert:
    post:
      tags:
        - Alert
      summary: Crear alerta
      description: >
        Crea una alerta geolocalizada. Requiere autenticación Bearer (token de
        login) y contexto de negocio.

        El cuerpo incluye `account` con `typeId` y opcionalmente `tag`/`value`
        para resolver el accountId.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AlertCreateRequest'
      responses:
        '200':
          description: OK
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Invalid arguments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
        - ApiKeyClient: []
components:
  schemas:
    AlertCreateRequest:
      type: object
      required:
        - alertType
        - location
        - region
        - account
      properties:
        alertType:
          type: string
        location:
          $ref: '#/components/schemas/Location'
        additional:
          type: object
          properties:
            street:
              type: string
        region:
          type: string
        account:
          type: object
          required:
            - typeId
          properties:
            typeId:
              type: string
            tag:
              type: string
            value:
              type: string
    ErrorResponse:
      type: object
      properties:
        timestamp:
          type: integer
          format: int64
        error:
          type: string
        data:
          type: object
          nullable: true
    Location:
      type: object
      required:
        - latitude
        - longitude
      properties:
        latitude:
          type: number
        longitude:
          type: number
        accuracy:
          type: number
          default: 0
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Token obtenido de POST /authentication/login (para alertas)
    ApiKeyClient:
      type: apiKey
      in: header
      name: x-client-id
      description: Business ID del cliente (obligatorio en casi todos los endpoints)

````