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

> ## Agent Instructions
> Bridge exposes three integration surfaces: the REST Integrations API for pushing data into Bridge, webhooks for receiving events from Bridge, and the public Custom Connections endpoint that a tenant's landing page posts to.
> The Integrations API host is https://api-connect-us.bridge.new and every request to it must be authenticated with the x-api-key header. Bridge does not use bearer tokens or OAuth.
> The Custom Connections endpoint is different and the Integrations API rules do not apply to it: it has its own host, it takes no x-api-key and no authentication header of any kind, and it is called from a visitor's browser. It is identified by a workspace id and a capture key together with a reCAPTCHA token. Never tell a reader to authenticate it with an API key, and never tell them to keep its capture key out of frontend code - it is designed to live in the page.
> REST error catalog keys use BRIDGE_<DOMAIN>_<NNNN>, for example BRIDGE_CONVERSATION_0001. Some reviewed legacy handlers return a recognized code plus a symbolic suffix separated by |; preserve the complete received value and use the compatible catalog lookup on /error-codes. Custom Connections uses separate BRIDGE.CAMPAIGN_LEADS.<NAME> identifiers on its own error reference. Never invent an error code or confuse the two integration surfaces.
> This documentation covers the Integrations API, webhooks and Custom Connections only. It does not describe the Bridge web application or its internal APIs.
> Before generating an API request, read the relevant OpenAPI specification or the individual endpoint Markdown page. llms-full.txt collects guides and endpoint descriptions; it does not embed every request and response schema. The REST and Custom Connections contracts are separate.
> Preserve the published host, method, path, operationId, authentication, headers, parameter and field names, types, formats, required and nullable fields, enums, defaults, limits, and response codes. Do not invent identifiers, fields, retry rules, or delivery guarantees. When published sources conflict, identify the conflicting passages and ask Bridge support to confirm the current behavior before relying on it.
> Custom Connections is the current name of the landing-page feature previously documented as Lead Capture. The existing /lead-capture documentation URLs, captureKey field, campaign-leads endpoint, and BRIDGE.CAMPAIGN_LEADS error identifiers are unchanged. This is a naming change, not a change to authentication or the API contract.
> For a complete workflow, start with the task guides: /guides/first-conversation, /guides/send-attachments, /guides/send-template, /guides/agent-outbound, /guides/pagination, /guides/identifiers and /guides/responses. Read the endpoint contract as well as the recipe. Outbound requires an existing Contact, but does not require creating a separate Conversation first.
> forceSend=true permits reuse of an existing active conversation; it does not create a fresh one by ignoring it and it is not idempotency. Recovery of a released recoverable conversation can occur even with false. The LeadScout and Agents outbound routes have different line-selection and controller checks; use /guides/agent-outbound.
> For webhook HMAC, follow /webhooks/verifying-signatures exactly: the Python JSON serialization with sorted keys is signed; X-Bridge-Timestamp is not included in that signature. Do not claim a signed timestamp, raw-body signing, exactly-once delivery or a global event order. Use /webhooks/receive-events for durable acceptance and duplicates.
> A 201 message response, 202 handoff or 202 Custom Connections response is not a provider delivery receipt. Do not invent a polling endpoint from messageId, trackingId or requestId. REST validation parsing must tolerate the compatibility difference explained in /error-codes.
> The documentation is available in English (existing root URLs), Spanish (/es/) and Brazilian Portuguese (/pt-br/). Prefer the reader's language when a localized page exists, but preserve the API's exact field names, enums, routes, authentication and examples. Translations describe the same API; they do not introduce regional API hosts or behaviors.
> For coding-assistant setup, use /connect-your-agent, /es/connect-your-agent or /pt-br/connect-your-agent. The Bridge documentation MCP server reads published documentation and has a separate optional feedback tool. Connecting it does not connect the coding assistant to a customer workspace or authorize live business requests.
> For direct HTTP access without MCP, start at https://docs.bridge.new/llms.txt. It lists every published page in English, Spanish and Brazilian Portuguese. Choose /llms-en.json, /llms-es.json or /llms-pt-br.json for a language-specific index, and /llms-full-en.json, /llms-full-es.json or /llms-full-pt-br.json for collected content. /llms-full.txt contains the combined collection. Fetch the original OpenAPI specification for exact schemas.
> For HTTP page reads, follow the .md URLs from the index or request Accept: text/markdown at the canonical page URL. The MCP virtual filesystem uses .mdx page paths instead; .mdx is not the public HTTP export extension. With Search MCP, set language to en, es or pt-BR explicitly; its default is en.
> For integration capabilities and source-selection rules, read https://docs.bridge.new/skill.md. Documentation access does not authorize business API actions; use the actual user request, workspace, credentials and target identifiers for any live integration.

# Iniciar conversación saliente con un Contact como Agent específico

> Inicia una conversación saliente con un Contact conocido, atendida por el Agent indicado.

Funciona con Agents LeadScout y Service. Primero se resuelve el Contact y después el Agent, que debe existir en el workspace y estar disponible (consulta `GET /agents`). La plantilla se referencia mediante `template.id` o `template.name` (id tiene prioridad si se envían ambos), debe existir y estar APPROVED, y cualquier Bridge User de `handoffOverride` debe ser válido. Si `template.media.mediaId` es desconocido, la solicitud falla con 400 `BRIDGE_AI_LEADSCOUT_0016` solo después de crear o recuperar la conversación, por lo que un reintento tras ese error puede responder de otra manera. Las reglas del cuerpo (`consent.status=GRANTED` sin `capturedAt`, o `template.media` sin exactamente uno de `mediaId` o `url`) fallan con 400 `BRIDGE_CORE_0103`.

La conversación se abre en una de las líneas activas de WhatsApp del Agent, bajo su control, con la plantilla como primer mensaje. Se elige una línea en este orden:
- Una línea libre.
- En su defecto, una línea con una conversación liberada recuperable con este Contact. La recuperación devuelve `recovered=true` y reemplaza el contexto saliente anterior y `agentContext`. Esto ocurre incluso con `forceSend=false`.
- Si ninguna línea está libre o es recuperable: `forceSend=false` (predeterminado) falla con 409 `BRIDGE_AI_LEADSCOUT_0008`; `forceSend=true` reutiliza una línea ocupada por una conversación activa con este Contact, dando preferencia a una que controle este Agent. Si la conversación elegida está controlada por otro Agent o un Bridge User, la llamada falla con 409 `BRIDGE_AI_AGENT_OUTBOUND_0006` y no se escribe nada. Libérala primero y reintenta después. Nunca se usan líneas cuya conversación esté bloqueada o se haya liberado sin recuperación, por lo que, si ninguna línea está ocupada por una conversación activa, la llamada falla con 409 `BRIDGE_AI_LEADSCOUT_0008` incluso con `forceSend=true`.

`contact.providerChannelId` es una preferencia: la línea indicada se usa cuando está libre o es recuperable; de lo contrario, se aplica el mismo orden entre todas las líneas del Agent. Entre las líneas ocupadas, tiene prioridad una que controle este Agent; si no existe, se reutiliza la línea indicada (y puede fallar con 0006).

La reutilización de una conversación depende del tipo de Agent:
- LeadScout: si su sesión de LeadScout sigue abierta y no ha vencido, la llamada falla con 409 `BRIDGE_AI_LEADSCOUT_0017` (`extra` incluye `conversationId`, `sessionId` y `stage`). Si no se puede finalizar una sesión vencida, falla con 409 `BRIDGE_AI_LEADSCOUT_0018`.
- Service Agent: se continúa una sesión de servicio abierta que no haya vencido; una sesión vencida se cierra como abandonada y se abre una nueva.

Consulta [la guía completa de envío saliente](/es/guides/agent-outbound) para los requisitos, la tabla de decisión de forceSend, la recuperación, el trabajo parcial y las decisiones de reintento seguro.



## OpenAPI

````yaml /es/api-reference/openapi.yaml post /bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound
openapi: 3.1.0
info:
  title: Bridge API
  summary: Especificación de la API de Bridge para gestionar el sistema de chat.
  description: >-
    Especificación de la API REST de integraciones de Bridge para gestionar
    contactos, conversaciones, mensajes, archivos, atributos personalizados,
    canales de proveedores, plantillas, usuarios internos y Agents.


    Los webhooks se documentan por separado en
    https://docs.bridge.new/es/webhooks; este OpenAPI contiene únicamente
    endpoints REST.


    **Arquitectura multiempresa**: las operaciones sobre recursos se limitan a
    un workspace específico mediante workspaceId. La comprobación de estado no
    incluye un workspace en su ruta.
  termsOfService: https://www.sainapsis.com/legal/terms-of-service
  contact:
    name: Bridge Support
    url: https://app.bridge.new/
    email: support@sainapsis.com
  license:
    name: MIT License
    url: https://spdx.org/licenses/MIT.html
  version: 1.0.0
servers:
  - url: https://api-connect-us.bridge.new
    description: Servidor de producción
security: []
paths:
  /bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound:
    post:
      tags:
        - Agents API
      summary: Iniciar conversación saliente con un Contact como Agent específico
      description: >-
        Inicia una conversación saliente con un Contact conocido, atendida por
        el Agent indicado.


        Funciona con Agents LeadScout y Service. Primero se resuelve el Contact
        y después el Agent, que debe existir en el workspace y estar disponible
        (consulta `GET /agents`). La plantilla se referencia mediante
        `template.id` o `template.name` (id tiene prioridad si se envían ambos),
        debe existir y estar APPROVED, y cualquier Bridge User de
        `handoffOverride` debe ser válido. Si `template.media.mediaId` es
        desconocido, la solicitud falla con 400 `BRIDGE_AI_LEADSCOUT_0016` solo
        después de crear o recuperar la conversación, por lo que un reintento
        tras ese error puede responder de otra manera. Las reglas del cuerpo
        (`consent.status=GRANTED` sin `capturedAt`, o `template.media` sin
        exactamente uno de `mediaId` o `url`) fallan con 400 `BRIDGE_CORE_0103`.


        La conversación se abre en una de las líneas activas de WhatsApp del
        Agent, bajo su control, con la plantilla como primer mensaje. Se elige
        una línea en este orden:

        - Una línea libre.

        - En su defecto, una línea con una conversación liberada recuperable con
        este Contact. La recuperación devuelve `recovered=true` y reemplaza el
        contexto saliente anterior y `agentContext`. Esto ocurre incluso con
        `forceSend=false`.

        - Si ninguna línea está libre o es recuperable: `forceSend=false`
        (predeterminado) falla con 409 `BRIDGE_AI_LEADSCOUT_0008`;
        `forceSend=true` reutiliza una línea ocupada por una conversación activa
        con este Contact, dando preferencia a una que controle este Agent. Si la
        conversación elegida está controlada por otro Agent o un Bridge User, la
        llamada falla con 409 `BRIDGE_AI_AGENT_OUTBOUND_0006` y no se escribe
        nada. Libérala primero y reintenta después. Nunca se usan líneas cuya
        conversación esté bloqueada o se haya liberado sin recuperación, por lo
        que, si ninguna línea está ocupada por una conversación activa, la
        llamada falla con 409 `BRIDGE_AI_LEADSCOUT_0008` incluso con
        `forceSend=true`.


        `contact.providerChannelId` es una preferencia: la línea indicada se usa
        cuando está libre o es recuperable; de lo contrario, se aplica el mismo
        orden entre todas las líneas del Agent. Entre las líneas ocupadas, tiene
        prioridad una que controle este Agent; si no existe, se reutiliza la
        línea indicada (y puede fallar con 0006).


        La reutilización de una conversación depende del tipo de Agent:

        - LeadScout: si su sesión de LeadScout sigue abierta y no ha vencido, la
        llamada falla con 409 `BRIDGE_AI_LEADSCOUT_0017` (`extra` incluye
        `conversationId`, `sessionId` y `stage`). Si no se puede finalizar una
        sesión vencida, falla con 409 `BRIDGE_AI_LEADSCOUT_0018`.

        - Service Agent: se continúa una sesión de servicio abierta que no haya
        vencido; una sesión vencida se cierra como abandonada y se abre una
        nueva.


        Consulta [la guía completa de envío saliente](/es/guides/agent-outbound)
        para los requisitos, la tabla de decisión de forceSend, la recuperación,
        el trabajo parcial y las decisiones de reintento seguro.
      operationId: >-
        start_agent_outbound_bridge_api_v1_workspaces__workspaceId__agents__agentId__outbound_post
      parameters:
        - name: workspaceId
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: Identificador único del workspace (UUID v4).
            examples:
              - b6cf1c4a-2b1e-4e63-8f3e-0f9d1a2a1234
            title: Workspaceid
          description: Identificador único del workspace (UUID v4).
        - name: agentId
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: Identificador único del Agent (UUID v4), según `GET /agents`.
            examples:
              - 4e362e2b-67b2-4a7e-a9df-e9ecf9141be8
            title: Agentid
          description: Identificador único del Agent (UUID v4), según `GET /agents`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentOutboundRequest'
              description: >-
                Cuerpo de la solicitud para iniciar una conversación saliente
                atendida por un Agent específico.
      responses:
        '201':
          description: Respuesta satisfactoria
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentOutboundResponse'
        '400':
          description: Solicitud incorrecta
          content:
            application/json:
              examples:
                BAD_REQUEST:
                  value:
                    title: Bad Request
                    status: 400
                    code: BRIDGE_CORE_0103
                OUTBOUND_VALIDATION_ERROR:
                  value:
                    title: Outbound Validation Error
                    status: 400
                    code: BRIDGE_AI_LEADSCOUT_0016
                TEMPLATE_ORDERED_PARAMS_MISMATCH:
                  value:
                    title: Template Params Mismatch
                    status: 400
                    code: BRIDGE_AI_LEADSCOUT_0006
              schema:
                $ref: '#/components/schemas/Problem'
        '403':
          description: Acceso prohibido
          content:
            application/json:
              examples:
                FORBIDDEN:
                  value:
                    title: Forbidden
                    status: 403
                    code: BRIDGE_CORE_0301
              schema:
                $ref: '#/components/schemas/Problem'
        '404':
          description: No encontrado
          content:
            application/json:
              examples:
                AGENT_NOT_FOUND:
                  value:
                    title: Agent Not Found
                    status: 404
                    code: BRIDGE_AI_AGENT_OUTBOUND_0001
                NO_CHANNELS_FOR_AGENT:
                  value:
                    title: No Channels For Agent
                    status: 404
                    code: BRIDGE_AI_AGENT_OUTBOUND_0004
                EXTERNAL_USER_NOT_FOUND:
                  value:
                    title: External User Not Found
                    status: 404
                    code: BRIDGE_AI_LEADSCOUT_0001
                INTERNAL_USER_NOT_FOUND:
                  value:
                    title: Internal User Not Found
                    status: 404
                    code: BRIDGE_AI_LEADSCOUT_0002
                TEMPLATE_NOT_FOUND:
                  value:
                    title: Template Not Found
                    status: 404
                    code: BRIDGE_AI_LEADSCOUT_0004
                NO_CHANNELS_FOR_BRAND:
                  value:
                    title: No Channels For Brand
                    status: 404
                    code: BRIDGE_AI_LEADSCOUT_0009
              schema:
                $ref: '#/components/schemas/Problem'
        '409':
          description: Conflicto
          content:
            application/json:
              examples:
                AGENT_NOT_AVAILABLE:
                  value:
                    title: Agent Not Available
                    status: 409
                    code: BRIDGE_AI_AGENT_OUTBOUND_0002
                ACTIVE_CONVERSATION_CONTROLLED_BY_OTHER_AGENT:
                  value:
                    title: Conversation Controlled By Other Agent
                    status: 409
                    code: BRIDGE_AI_AGENT_OUTBOUND_0006
                INTERNAL_USER_DELETED:
                  value:
                    title: Internal User Deleted
                    status: 409
                    code: BRIDGE_AI_LEADSCOUT_0003
                TEMPLATE_NOT_APPROVED:
                  value:
                    title: Template Not Approved
                    status: 409
                    code: BRIDGE_AI_LEADSCOUT_0005
                ACTIVE_CONVERSATION_ALREADY_EXISTS:
                  value:
                    title: Active Conversation Exists
                    status: 409
                    code: BRIDGE_AI_LEADSCOUT_0007
                ALL_PROVIDER_CHANNELS_OCCUPIED:
                  value:
                    title: All Channels Occupied
                    status: 409
                    code: BRIDGE_AI_LEADSCOUT_0008
                LATEST_SESSION_NOT_FINAL:
                  value:
                    title: Latest Session Not Final
                    status: 409
                    code: BRIDGE_AI_LEADSCOUT_0017
                SESSION_FINALIZATION_FAILED:
                  value:
                    title: Session Finalization Failed
                    status: 409
                    code: BRIDGE_AI_LEADSCOUT_0018
              schema:
                $ref: '#/components/schemas/Problem'
        '422':
          description: Contenido no procesable
          content:
            application/json:
              examples:
                AGENT_TYPE_NOT_SUPPORTED:
                  value:
                    title: Agent Type Not Supported
                    status: 422
                    code: BRIDGE_AI_AGENT_OUTBOUND_0003
                AGENT_NOT_ASSIGNED_TO_CHANNEL:
                  value:
                    title: Agent Not Assigned To Channel
                    status: 422
                    code: BRIDGE_AI_AGENT_OUTBOUND_0005
                MISSING_TEMPLATE_VARIABLES:
                  value:
                    title: Missing Template Variables
                    status: 422
                    code: BRIDGE_AI_LEADSCOUT_0019
                CONFLICTING_TEMPLATE_PARAMETERS:
                  value:
                    title: Conflicting Template Parameters
                    status: 422
                    code: BRIDGE_AI_LEADSCOUT_0020
                UNKNOWN_TEMPLATE_PARAMETER_KEY:
                  value:
                    title: Unknown Template Parameter Key
                    status: 422
                    code: BRIDGE_AI_LEADSCOUT_0021
              schema:
                $ref: '#/components/schemas/Problem'
        '429':
          description: Demasiadas solicitudes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                WORKSPACE_BUDGET_EXHAUSTED:
                  value:
                    title: Too Many Requests
                    status: 429
                    code: BRIDGE_RATE_LIMIT_0001
      security:
        - x-api-key: []
components:
  schemas:
    AgentOutboundRequest:
      properties:
        contact:
          $ref: '#/components/schemas/AgentOutboundContactRef'
          title: Contact
          description: >-
            Contact al que se dirige esta conversación saliente. Ya debe existir
            en el workspace.
        template:
          $ref: '#/components/schemas/LeadscoutOutboundTemplateRef'
          title: Template
          description: Plantilla inicial que se enviará.
        additionalMessages:
          items:
            $ref: '#/components/schemas/AgentOutboundFollowUp'
          type: array
          maxItems: 5
          title: Additional Messages
          description: >-
            Hasta cinco seguimientos de texto guardados en la conversación
            después de la plantilla inicial, en el orden indicado, y enviados
            como la plantilla. Los adjuntos (`mediaIds`) aún no se envían.
        agentContext:
          anyOf:
            - $ref: '#/components/schemas/AgentOutboundContext'
            - type: 'null'
          title: Agent Context
          description: >-
            Notas y medios opcionales guardados en la conversación como contexto
            para el Agent.
        consent:
          anyOf:
            - $ref: '#/components/schemas/OutboundConsentRequest'
            - type: 'null'
          title: Consent
          description: >-
            Evidencia opcional de consentimiento, declarada por la empresa, que
            se registra en la conversación.
        handoffOverride:
          anyOf:
            - $ref: '#/components/schemas/AgentOutboundHandoffOverride'
            - type: 'null'
          title: Handoff Override
          description: >-
            Opcional. Preasigna un Bridge User específico como asesor para la
            transferencia. El Bridge User se valida antes de cualquier
            escritura: se rechaza la solicitud si el usuario no existe,
            pertenece a otro workspace o se eliminó.
        brandId:
          anyOf:
            - type: string
            - type: 'null'
          title: Brand Identifier
          description: >-
            ID opcional de marca. Si se indica, solo son elegibles las líneas
            del Agent vinculadas a esa marca; si no hay ninguna, la solicitud
            falla con 404. Omítelo para considerar todas las líneas del Agent.
          examples:
            - null
            - 7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f
        campaignId:
          anyOf:
            - type: string
            - type: 'null'
          title: Campaign Identifier
          description: >-
            Referencia opcional de campaña guardada en la conversación para
            auditoría e informes.
          examples:
            - null
            - spring_promo_2026
        forceSend:
          type: boolean
          title: Force Send
          description: >-
            Controla qué ocurre cuando ninguna línea del Agent está libre o es
            recuperable. Siempre tiene prioridad una línea libre, seguida de una
            línea con una conversación liberada recuperable con este Contact,
            sea cual sea el valor de esta opción. Cuando ninguna existe: con
            false (predeterminado), la solicitud falla con 409
            `BRIDGE_AI_LEADSCOUT_0008`; con true, se reutiliza una línea ocupada
            por una conversación activa con este Contact, dando preferencia a
            una que controle este Agent. Si la conversación elegida está
            controlada por otro Agent o por un Bridge User, la solicitud falla
            con 409 `BRIDGE_AI_AGENT_OUTBOUND_0006` y no se escribe nada;
            libérala primero y reintenta después. Nunca se usan líneas cuya
            conversación esté bloqueada o se haya liberado sin recuperación; por
            tanto, si ninguna línea está ocupada por una conversación activa, la
            solicitud falla con 409 `BRIDGE_AI_LEADSCOUT_0008` incluso con true.
          default: false
          examples:
            - false
            - true
      type: object
      required:
        - contact
        - template
      title: AgentOutboundRequest
      description: >-
        Cuerpo de la solicitud para iniciar una conversación saliente atendida
        por un Agent específico.
    AgentOutboundResponse:
      properties:
        conversation:
          $ref: '#/components/schemas/ConversationResponse'
          title: Conversation
          description: >-
            Conversación que ahora controla el Agent: nueva, reutilizada
            (`alreadyInitiated`) o recuperada (`recovered`).
        contact:
          $ref: '#/components/schemas/ContactResponse'
          title: Contact
          description: Contacto con el que se inició la conversación.
        templateSent:
          anyOf:
            - $ref: '#/components/schemas/AgentTemplateSent'
            - type: 'null'
          title: Template Sent
          description: Resumen de la plantilla guardada para abrir la conversación.
        additionalMessagesPersisted:
          type: integer
          title: Additional Messages Persisted
          description: Número de mensajes de seguimiento guardados en la conversación.
          default: 0
          examples:
            - 0
            - 3
        alreadyInitiated:
          type: boolean
          title: Already Initiated
          description: >-
            True cuando esta solicitud satisfactoria reutilizó una conversación
            activa existente mediante forceSend=true. False para creación o
            recuperación; consulta recovered para distinguir esas rutas. Es
            informativo: una reutilización satisfactoria también guarda la nueva
            plantilla y los seguimientos, por lo que repetir la solicitud puede
            agregar mensajes.
          default: false
          examples:
            - false
            - true
        recovered:
          type: boolean
          title: Recovered
          description: >-
            True cuando se recuperó una conversación liberada que el Contact
            tenía en la línea, en lugar de crear otra. La recuperación reemplaza
            el contexto saliente anterior y `agentContext`. Las líneas
            recuperables se usan incluso con `forceSend=false`.
          default: false
          examples:
            - false
            - true
      type: object
      required:
        - conversation
        - contact
      title: AgentOutboundResponse
      description: Cuerpo de respuesta de un inicio saliente de Agent satisfactorio.
    Problem:
      properties:
        title:
          type: string
          title: Title
          description: Resumen breve del tipo de problema.
        status:
          type: integer
          title: Status
          description: >-
            Código de estado HTTP generado por el servidor de origen para esta
            instancia del problema.
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
          description: Explicación específica de esta instancia del problema.
        instance:
          anyOf:
            - type: string
            - type: 'null'
          title: Instance
          description: Referencia URI que identifica esta instancia del problema.
        traceId:
          anyOf:
            - type: string
            - type: 'null'
          title: Traceid
          description: ID de seguimiento para depuración.
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Código para identificar el error; consulta la página de códigos de
            error para más detalles.
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Errors
          description: Lista de detalles de errores.
        extra:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Extra
          description: Información adicional sobre el problema.
      type: object
      required:
        - title
        - status
      title: Problem
      description: Objeto que representa el cuerpo de una respuesta Problem.
    AgentOutboundContactRef:
      properties:
        identifier:
          type: string
          title: Identifier
          description: >-
            Identificador del Contact según identifierType: ID de Contact para
            ID, correo electrónico para EMAIL o teléfono en formato E.164 para
            PHONE. El Contact ya debe existir en el workspace.
          examples:
            - '+573001234567'
        identifierType:
          $ref: '#/components/schemas/ParticipantIdentifierType'
          title: Identifier Type
          description: Tipo de identificador.
          examples:
            - PHONE
            - EMAIL
            - ID
        messageProviderType:
          $ref: '#/components/schemas/MessageProviderType'
          title: Message Provider Type
          description: Proveedor utilizado para entregar la plantilla.
          examples:
            - WHATSAPP
        providerChannelId:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider Channel Identifier
          description: >-
            Opcional. Línea preferida del Agent (el `providerChannelId` de una
            de sus `lines` en `GET /agents`). Si se omite, se puede usar
            cualquiera de sus líneas. Si se proporciona, debe ser una línea
            activa del Agent; de lo contrario, la solicitud falla con 422. Es
            una preferencia, no una garantía: si esa línea no está libre ni es
            recuperable, se aplica el mismo orden a todas las líneas del Agent
            (con `forceSend=true`, primero una ocupada que controle este Agent y
            luego la indicada). La respuesta no identifica la línea utilizada.
          examples:
            - c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c
            - null
      type: object
      required:
        - identifier
        - identifierType
        - messageProviderType
      title: AgentOutboundContactRef
      description: Identifica el Contact al que se dirigirá la conversación saliente.
    LeadscoutOutboundTemplateRef:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Template Identifier
          description: >-
            ID de la plantilla registrada (de GET /templates). Si se envían id y
            name, se usa id.
          examples:
            - 7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f
            - null
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Template Name
          description: >-
            Nombre de la plantilla registrada y aprobada por Meta que se
            enviará. Obligatorio si no se envía id; se ignora si se envía id.
          examples:
            - leadscout_outbound_fb_v1
            - null
        orderedParams:
          items:
            type: string
          type: array
          title: Ordered Parameters
          description: >-
            Valores proporcionados por el cliente para los slots de parámetros
            de la plantilla con origen CALLER, en orden de posición.
          examples:
            - - Maria
              - ACME
        parameters:
          additionalProperties:
            type: string
          type: object
          title: Parameters
          description: >-
            Valores proporcionados por el cliente e indexados por la clave de
            variable de la plantilla (consulta GET /templates/{id} para obtener
            las claves), tanto para el cuerpo como para los botones. Prefiere
            esta opción a orderedParams si la plantilla tiene un botón dinámico.
            Se rechaza con 422 una clave desconocida o que se superponga con un
            slot ya cubierto por orderedParams.
          examples:
            - recipient_first_name: Maria
              tracking_code: TRK123
        media:
          anyOf:
            - $ref: '#/components/schemas/OutboundTemplateMedia'
            - type: 'null'
          title: Header Media
          description: >-
            Medio opcional de encabezado (imagen o video) que se adjuntará al
            mensaje de plantilla. Acepta un mediaId precargado o una url
            pública.
      type: object
      title: LeadscoutOutboundTemplateRef
      description: Referencia la plantilla aprobada por Meta que abrirá la conversación.
    AgentOutboundFollowUp:
      properties:
        messageBody:
          type: string
          title: Message Body
          description: Cuerpo de texto plano del mensaje de seguimiento.
          examples:
            - Just confirming we're still on for tomorrow at 10am.
        mediaIds:
          items:
            type: string
          type: array
          title: Media Identifiers
          description: >-
            Se acepta, pero aún no se utiliza: los seguimientos se guardan solo
            como texto y no se envían adjuntos.
          examples:
            - []
            - - 7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f
      type: object
      required:
        - messageBody
      title: AgentOutboundFollowUp
      description: >-
        Seguimiento de texto guardado en la conversación inmediatamente después
        de la plantilla inicial.
    AgentOutboundContext:
      properties:
        notes:
          anyOf:
            - type: string
              maxLength: 2000
            - type: 'null'
          title: Notes
          description: Notas de texto libre para el Agent, limitadas a 2000 caracteres.
          examples:
            - The Contact asked about pricing tiers last week.
            - null
        mediaIds:
          items:
            type: string
          type: array
          title: Media Identifiers
          description: >-
            Identificadores opcionales de archivos precargados guardados en la
            conversación como contexto para el Agent.
          examples:
            - []
            - - 7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f
      type: object
      title: AgentOutboundContext
      description: >-
        Notas y medios guardados en la conversación como contexto para el Agent
        y los Bridge Users.
    OutboundConsentRequest:
      properties:
        status:
          $ref: '#/components/schemas/ConsentStatus'
          title: Status
          description: >-
            Estado de consentimiento declarado por la empresa. Usa GRANTED (con
            capturedAt) para consentimiento explícito o NOT_PROVIDED si la
            empresa no tiene evidencia que declarar.
          examples:
            - GRANTED
            - NOT_PROVIDED
        capturedAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Captured At
          description: >-
            Fecha y hora ISO8601 (con milisegundos) en que la empresa obtuvo el
            consentimiento. Obligatorio con status=GRANTED; se acepta null u
            omitido con status=NOT_PROVIDED.
          examples:
            - '2026-04-20T10:00:00.000Z'
            - null
      type: object
      required:
        - status
      title: OutboundConsentRequest
      description: >-
        Evidencia de consentimiento declarada por la empresa y registrada sin
        modificaciones en la conversación.
    AgentOutboundHandoffOverride:
      properties:
        preAssignedUser:
          $ref: '#/components/schemas/AgentOutboundPreAssignedUser'
          title: Pre-assigned User
          description: >-
            Bridge User que se asignará como asesor cuando el Agent transfiera
            la conversación. Se valida durante la solicitud: esta se rechaza si
            el usuario no existe, pertenece a otro workspace o se eliminó.
          examples:
            - identifier: advisor@acme.com
              identifierType: EMAIL
      additionalProperties: false
      type: object
      required:
        - preAssignedUser
      title: AgentOutboundHandoffOverride
      description: >-
        Preasigna el Bridge User que recibe la transferencia de la conversación
        saliente.
    ConversationResponse:
      properties:
        id:
          type: string
          title: Identifier
          description: Identificador único de la conversación (UUID v4).
          examples:
            - b6cf1c4a-2b1e-4e63-8f3e-0f9d1a2a1234
        workspaceId:
          type: string
          title: Workspace Identifier
          description: Identificador único del workspace (UUID v4).
          examples:
            - b6cf1c4a-2b1e-4e63-8f3e-0f9d1a2a1234
        participants:
          $ref: '#/components/schemas/ConversationParticipantsResponse'
          title: Participants
          description: Participantes de la conversación.
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Nombre o título opcional de la conversación.
          examples:
            - Bridge Support Team
        status:
          anyOf:
            - $ref: '#/components/schemas/ConversationStatus'
            - type: 'null'
          title: Status
          description: >-
            Estado actual de la conversación: 'ACTIVE' para conversaciones
            visibles y 'GHOST' para conversaciones invisibles hasta la primera
            interacción.
          examples:
            - ACTIVE
        createdAt:
          type: string
          format: date-time
          title: Created At
          description: Fecha y hora de creación de la conversación.
          examples:
            - '2003-04-10T09:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          title: Updated At
          description: Fecha y hora de la última actualización de la conversación.
          examples:
            - '2003-04-10T09:00:00.000Z'
      type: object
      required:
        - id
        - workspaceId
        - participants
        - createdAt
        - updatedAt
      title: ConversationResponse
      description: Cuerpo de respuesta para los detalles de una conversación.
    ContactResponse:
      properties:
        id:
          type: string
          title: Identifier
          description: Identificador único del contacto (UUID v4).
          examples:
            - b6cf1c4a-2b1e-4e63-8f3e-0f9d1a2a1234
        workspaceId:
          type: string
          title: Workspace Identifier
          description: Identificador único del workspace al que pertenece este contacto
          examples:
            - 92b2d4f3-81e1-4b61-a7ec-6f4ff3b58be5
        type:
          $ref: '#/components/schemas/ExternalUserType'
          title: Contact Type
          description: >-
            NORMAL cuando están presentes todos los campos obligatorios de
            identidad y atributos personalizados; PARTIAL en caso contrario.
          examples:
            - NORMAL
            - PARTIAL
        firstName:
          anyOf:
            - type: string
            - type: 'null'
          title: First Name
          description: Nombre del contacto.
          examples:
            - John
            - null
        lastName:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Name
          description: Apellido del contacto.
          examples:
            - Doe
            - null
        email:
          anyOf:
            - type: string
              format: email
            - type: 'null'
          title: Email
          description: Correo electrónico del contacto.
          examples:
            - john.doe@example.com
            - null
        cellphone:
          anyOf:
            - type: string
              format: phone
            - type: 'null'
          title: Cellphone
          description: Número de celular del contacto.
          examples:
            - '+14084029292'
            - null
        customAttributes:
          items:
            $ref: '#/components/schemas/CustomAttributeResponse'
          type: array
          title: Custom Attributes
          description: Lista de atributos personalizados de clave y valor.
        languageCode:
          anyOf:
            - $ref: '#/components/schemas/LanguageCode'
            - type: 'null'
          title: Language Code
          description: Código de idioma del usuario externo.
          examples:
            - EN
            - null
        ownerId:
          anyOf:
            - type: string
            - type: 'null'
          title: Owner Identifier
          description: >-
            ID del Bridge User propietario del contacto. Resuélvelo con `GET
            /users/{userId}`.
          examples:
            - 37673840-6259-40f9-bbe5-a7db40f8e3cf
            - null
        createdAt:
          type: string
          title: Created At
          description: Fecha y hora de creación del contacto.
          examples:
            - '2003-04-10T08:00:00.000Z'
        updatedAt:
          type: string
          title: Updated At
          description: Fecha y hora de la última actualización del contacto.
          examples:
            - '2003-04-10T08:00:00.000Z'
      type: object
      required:
        - id
        - workspaceId
        - type
        - createdAt
        - updatedAt
      title: ContactResponse
      description: Cuerpo de respuesta para operaciones con contactos.
    AgentTemplateSent:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Template Identifier
          description: ID de la plantilla enviada.
          examples:
            - 7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f
        name:
          type: string
          title: Template Name
          description: Nombre de la plantilla despachada.
          examples:
            - leadscout_outbound_fb_v1
        messageId:
          anyOf:
            - type: string
            - type: 'null'
          title: Message Identifier
          description: >-
            ID de mensaje de Bridge de la plantilla. Siempre está presente; no
            es un `wamid` de WhatsApp.
          examples:
            - 7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f
      type: object
      required:
        - name
      title: AgentTemplateSent
      description: Resumen de la plantilla guardada para abrir la conversación.
    ParticipantIdentifierType:
      type: string
      enum:
        - ID
        - EMAIL
        - PHONE
      title: ParticipantIdentifierType
    MessageProviderType:
      type: string
      enum:
        - WHATSAPP
        - SMS
        - TELEGRAM
        - INSTAGRAM
        - TWITTER
        - LINE
        - FACEBOOK
        - IMESSAGE
        - WHATSAPP_TEST
        - HEYGIA
      title: MessageProviderType
    OutboundTemplateMedia:
      properties:
        type:
          $ref: '#/components/schemas/HeaderFileType'
          title: Media Type
          description: >-
            Tipo de medio del encabezado. Debe coincidir con el configurado para
            la plantilla en Meta.
          examples:
            - IMAGE
            - VIDEO
        mediaId:
          anyOf:
            - type: string
            - type: 'null'
          title: Media Identifier
          description: >-
            UUID devuelto por POST
            /bridge/api/v1/workspaces/{workspaceId}/files. Mutuamente excluyente
            con url.
          examples:
            - null
            - 7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Source URL
          description: >-
            URL pública de origen que obtiene de forma asíncrona el servicio de
            descarga de archivos por URL. Mutuamente excluyente con mediaId.
          examples:
            - null
            - https://cdn.example.com/promo.jpg
      type: object
      required:
        - type
      title: OutboundTemplateMedia
      description: >-
        Medio opcional de encabezado adjunto al mensaje de plantilla inicial.


        Proporciona exactamente uno: ``mediaId`` (UUID devuelto por ``POST
        /bridge/api/v1/workspaces/{workspaceId}/files``) o ``url`` (URL pública
        de origen obtenida de forma asíncrona por el servicio de descarga por
        URL).
    ConsentStatus:
      type: string
      enum:
        - GRANTED
        - NOT_PROVIDED
      title: ConsentStatus
    AgentOutboundPreAssignedUser:
      properties:
        identifier:
          type: string
          title: Identifier
          description: >-
            Valor que identifica al Bridge User, interpretado según
            identifierType.
          examples:
            - advisor@acme.com
            - usr_01HZ2K3J4M5N6P7Q8R9S0T1UV2
        identifierType:
          $ref: '#/components/schemas/InternalParticipantIdentifierType'
          title: Identifier Type
          description: >-
            Cómo resolver el identificador. ID busca por ID de Bridge User;
            EMAIL busca por correo electrónico.
          examples:
            - EMAIL
            - ID
      additionalProperties: false
      type: object
      required:
        - identifier
        - identifierType
      title: AgentOutboundPreAssignedUser
      description: Identifica al Bridge User que debe recibir la transferencia.
    ConversationParticipantsResponse:
      properties:
        externals:
          items:
            $ref: '#/components/schemas/ExternalParticipant'
          type: array
          title: Externals
          description: Lista de participantes externos.
        internals:
          items:
            $ref: '#/components/schemas/InternalParticipant'
          type: array
          title: Internals
          description: Lista de participantes internos.
      type: object
      required:
        - externals
        - internals
      title: ConversationParticipantsResponse
      description: Cuerpo de respuesta para los participantes de una conversación.
    ConversationStatus:
      type: string
      enum:
        - ACTIVE
        - GHOST
        - RELEASED
        - NOT_ASSIGNED_TO_HUMAN
        - BLOCKED
      title: ConversationStatus
    ExternalUserType:
      type: string
      enum:
        - PARTIAL
        - NORMAL
      title: ExternalUserType
    CustomAttributeResponse:
      properties:
        key:
          type: string
          title: Key
          description: Clave o nombre del atributo
        values:
          items:
            type: string
          type: array
          title: Values
          description: Valor del atributo
      type: object
      required:
        - key
      title: CustomAttributeResponse
      description: >-
        Cuerpo de respuesta para atributos personalizados en operaciones con
        contactos.
    LanguageCode:
      type: string
      enum:
        - ES
        - EN
        - AF
        - SQ
        - AR
        - AZ
        - BN
        - BG
        - CA
        - ZH_CN
        - HR
        - CS
        - DA
        - NL
        - ET
        - FIL
        - FI
        - FR
        - KA
        - DE
        - EL
        - GU
        - HA
        - HE
        - HI
        - HU
        - ID
        - GA
        - IT
        - JA
        - KN
        - KK
        - RW_RW
        - KO
        - KY_KG
        - LO
        - LV
        - LT
        - MK
        - MS
        - ML
        - MR
        - NB
        - FA
        - PL
        - PT_BR
        - PA
        - RO
        - RU
        - SR
        - SK
        - SL
        - SW
        - SV
        - TA
        - TE
        - TH
        - TR
        - UK
        - UR
        - UZ
        - VI
        - ZU
      title: LanguageCode
    HeaderFileType:
      type: string
      enum:
        - IMAGE
        - VIDEO
        - GIF
      title: HeaderFileType
    InternalParticipantIdentifierType:
      type: string
      enum:
        - ID
        - EMAIL
      title: InternalParticipantIdentifierType
    ExternalParticipant:
      properties:
        identifier:
          type: string
          title: Identifier
          description: Valor del identificador del participante.
          examples:
            - ef7ee722-5f95-415a-9a98-81eeae178b11
        identifierType:
          type: string
          enum:
            - ID
            - EMAIL
            - PHONE
          title: Identifier Type
          description: Tipo de identificador de participantes externos (ID, EMAIL o PHONE).
          examples:
            - EMAIL
            - PHONE
            - ID
        role:
          $ref: '#/components/schemas/UserType'
          title: Role
          description: Rol del participante en la conversación.
          examples:
            - EXTERNAL
            - INTERNAL
        joinedAt:
          type: string
          format: date-time
          title: Joined At
          description: Fecha y hora en que el participante se unió a la conversación.
          examples:
            - '2004-04-10T09:00:00.000Z'
        lastSeenAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Seen At
          description: Fecha y hora de la última actividad observada del participante.
          examples:
            - null
            - '2004-04-10T09:00:00.000Z'
      type: object
      required:
        - identifier
        - identifierType
        - role
        - joinedAt
      title: Participant
      description: Objeto que representa al participante externo de la conversación.
    InternalParticipant:
      properties:
        identifier:
          type: string
          title: Identifier
          description: Valor del identificador del participante.
          examples:
            - ef7ee722-5f95-415a-9a98-81eeae178b11
        identifierType:
          $ref: '#/components/schemas/InternalParticipantIdentifierType'
          title: Identifier Type
          description: Tipo de identificador de participantes internos (ID o EMAIL).
          examples:
            - EMAIL
            - ID
        role:
          $ref: '#/components/schemas/UserType'
          title: Role
          description: Rol del participante en la conversación.
          examples:
            - EXTERNAL
            - INTERNAL
        joinedAt:
          type: string
          format: date-time
          title: Joined At
          description: Fecha y hora en que el participante se unió a la conversación.
          examples:
            - '2004-04-10T09:00:00.000Z'
        lastSeenAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Seen At
          description: Fecha y hora de la última actividad observada del participante.
          examples:
            - null
            - '2004-04-10T09:00:00.000Z'
      type: object
      required:
        - identifier
        - identifierType
        - role
        - joinedAt
      title: Participant
      description: Objeto que representa al participante interno de la conversación.
    UserType:
      type: string
      enum:
        - INTERNAL
        - EXTERNAL
        - BOT
      title: UserType
  securitySchemes:
    x-api-key:
      type: apiKey
      description: Copy the API key as provided by the Bridge Console.
      in: header
      name: x-api-key

````

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