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

# Dispatch a CRM agent tool action

> Execute a CRM action (e.g. hubspot_create_contact, calendly_find_slots) on behalf of a running AI agent, resolving the tenant's integration connection server-side so provider credentials never cross the runtime boundary. The action must be one of the registered CRM tools for the given provider. Every failure — missing connection, expired auth, provider or network error — comes back as a structured result with `ok: false` and a safe message the agent can read and react to, never as an HTTP error. Internal service-to-service endpoint, authenticated with the runtime internal token.



## OpenAPI

````yaml /openapi.yaml post /api/v1/agents/crm-tools/internal/dispatch
openapi: 3.1.0
info:
  title: Devotel CPaaS API
  description: Orbit by Devotel — Communications Platform as a Service API
  version: 1.0.0
  contact:
    name: Devotel
    url: https://devotel.io
    email: support@devotel.io
  license:
    name: Proprietary
servers:
  - url: https://api.orbit.devotel.io
    description: Production
security:
  - Bearer: []
  - ApiKey: []
tags:
  - name: Messages
    description: >-
      Send and manage messages across all channels (SMS, WhatsApp, RCS, Email,
      Viber, etc.)
  - name: Fax
    description: >-
      List and track fax (MMS/T.38) transmissions on Telnyx-backed fax numbers
      (sending flows through the Messaging API)
  - name: Agents
    description: AI agent creation, configuration, and execution
  - name: Voice
    description: Voice calls, IVR, conferencing, and SIP trunking
  - name: OnCall
    description: On-call rotations and escalation policy planning for incident alerting
  - name: Webhooks
    description: Webhook endpoint management and delivery logs
  - name: Numbers
    description: Phone number search, provisioning, and configuration
  - name: Brand Identity
    description: >-
      Unified cross-channel brand trust posture (10DLC, toll-free, WhatsApp,
      RCS, branded calling, number KYC)
  - name: Contacts
    description: Contact management, segmentation, and lifecycle tracking
  - name: Campaigns
    description: Marketing campaign orchestration and analytics
  - name: Flows
    description: Automation flow builder and execution engine
  - name: Templates
    description: Message template management and approval workflows
  - name: Settings
    description: Organization, channel, and user preference settings
  - name: Verify
    description: OTP generation and verification across channels
  - name: Push
    description: Push notification delivery via FCM and APNs
  - name: Integrations
    description: Third-party service connections and OAuth management
  - name: CDP
    description: >-
      Customer Data Platform — activation surface (CRM object sync, streaming
      destinations, ad-audience activation)
  - name: Files
    description: >-
      Server-to-server media upload, listing, retrieval, and deletion
      (signed-URL backed)
  - name: Commerce
    description: >-
      Omnichannel conversational-commerce — persistent cart + checkout state
      machine, channel-agnostic hosted pay-by-link, native WhatsApp checkout,
      and AP2-style agent payment mandates.
  - name: Sync
    description: >-
      Real-time shared-state primitive (Twilio Sync parity) — Documents, Maps,
      Lists, and ephemeral Streams, with change events relayed over the
      /api/v1/ws/sync WebSocket gateway
  - name: Risk
    description: >-
      Unified cross-channel Trust & Fraud risk scoring — fuses SMS-pumping,
      URL-reputation, Verify Fraud Guard, and Voice Biometrics signals into one
      composite verdict queryable before a send or a call.
  - name: Orby
    description: >-
      In-dashboard Orby operator assistant: streamed assistant turns,
      conversation threads, product knowledge-base search, and the tool-action
      approval gate. Available to signed-in operators only (dashboard session
      auth — API-key requests are rejected).
paths:
  /api/v1/agents/crm-tools/internal/dispatch:
    post:
      tags:
        - Agents
      summary: Dispatch a CRM agent tool action
      description: >-
        Execute a CRM action (e.g. hubspot_create_contact, calendly_find_slots)
        on behalf of a running AI agent, resolving the tenant's integration
        connection server-side so provider credentials never cross the runtime
        boundary. The action must be one of the registered CRM tools for the
        given provider. Every failure — missing connection, expired auth,
        provider or network error — comes back as a structured result with `ok:
        false` and a safe message the agent can read and react to, never as an
        HTTP error. Internal service-to-service endpoint, authenticated with the
        runtime internal token.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - provider
                - action
              properties:
                provider:
                  type: string
                  enum:
                    - hubspot
                    - salesforce
                    - zendesk
                    - calendly
                    - intercom
                  description: CRM provider the action belongs to.
                action:
                  type: string
                  description: >-
                    Registered CRM tool action to run for the provider (e.g.
                    hubspot_create_contact).
                args:
                  type: object
                  additionalProperties: true
                  description: >-
                    Action arguments the model produced. Defaults to an empty
                    object.
                agent_id:
                  type: string
                  description: Optional agent identifier, recorded for audit logging.
                agent_run_id:
                  type: string
                  description: Optional agent-run identifier, recorded for audit logging.
                conversation_id:
                  type: string
                  nullable: true
                  description: Optional conversation the tool call belongs to.
            example:
              provider: hubspot
              action: hubspot_create_contact
              args:
                email: jane@example.com
                firstname: Jane
              agent_id: agent_9f2c
              agent_run_id: run_51ab
      responses:
        '200':
          description: >-
            Structured dispatch result. `ok` is true when the action succeeded
            and `response` carries the provider's output; on failure `ok` is
            false with a machine-readable `error` code and a safe `message`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      ok:
                        type: boolean
                      provider:
                        type: string
                      action:
                        type: string
                      response:
                        nullable: true
                        description: Provider action output on success; null on failure.
                      duration_ms:
                        type: integer
                      error:
                        type: string
                        description: >-
                          Machine-readable error code when ok is false (e.g.
                          CRM_CONNECTION_MISSING, CRM_AUTH_EXPIRED,
                          CRM_DISPATCH_FAILED).
                      message:
                        type: string
                        description: Human-safe explanation when ok is false.
                    example:
                      ok: true
                      provider: hubspot
                      action: hubspot_create_contact
                      response:
                        id: '701'
                        created: true
                      duration_ms: 412
                  meta:
                    $ref: '#/components/schemas/ResponseMeta'
components:
  schemas:
    ResponseMeta:
      type: object
      required:
        - request_id
        - timestamp
      additionalProperties: false
      properties:
        request_id:
          type: string
          description: Unique request identifier (also returned as X-Request-Id header)
        timestamp:
          type: string
          format: date-time
        docs_url:
          type: string
          format: uri
          nullable: true
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Dashboard JWT token from Clerk
    ApiKey:
      type: apiKey
      name: X-API-Key
      in: header
      description: Server-to-server API key (dv_live_sk_*)

````