# On API Call

**On API Call** starts the graph from *your* system - CRM, form, button (**Runs when: When an API call is made**). It does **not** need an agent attach. Phone triggers do.

  <ShotPlaceholder
    src="/assets/workflows/on-api-call.png"
    name="wf-api"
    alt="On API Call trigger on the canvas"
    capture="On API Call canvas."
  />

## Why this trigger

A list on a schedule is [Campaigns](https://docs.voicelogica.ai/outbound-calls/campaigns/). A single AI outbound call is [initiate-call](https://docs.voicelogica.ai/outbound-calls/api/). This is "run this automation now" with a JSON body - send email, update a sheet, fan out nodes. Put **Make Outbound Call** on the graph only if the next step is actually a call.

## First setup

1. **+ Add Trigger - On API Call**

   **Payload Schema** is the JSON schema of the body POSTed to the run-workflow endpoint (with your API key). Validated live. Default empty object with no required fields accepts any object. Sample schemas and a cURL helper appear in the panel; create an [API key](https://docs.voicelogica.ai/getting-started/api-keys/) if you need one.

     <ShotPlaceholder
       src="/assets/workflows/on-api-call-form.png"
       name="on-api-call-form"
       alt="On API Call Payload Schema settings"
       capture="On API Call trigger settings."
     />

2. From **Work Flow Triggered**, add nodes that read those keys.

3. **Save & go live**. Copy the workflow id from the URL or the list.

4. POST with an API key that can run workflows:

   ```
   POST https://api.voicelogica.ai/api/v1/agentic/work-flows/run-workflow/YOUR_WORKFLOW_ID
   ```

   ```http
   x-api-key: YOUR_API_KEY
   Content-Type: application/json
   ```

   ```json
   {
     "order_id": "ORD123",
     "email": "ada@example.com"
   }
   ```

5. Confirm the nodes ran (email, sheet, or a builder dry-run first).

## Troubleshooting

**Should I use initiate-call?**

Need the *agent* to talk to a number - [initiate-call](https://docs.voicelogica.ai/outbound-calls/api/). Need the *graph* to run (email, sheet, branches) - this trigger.

**Save is blocked on the payload schema**

The schema must be valid JSON Schema for the dialect the panel validates. Start from the default object, or use a sample schema button, then Beautify.

## Next Steps

[Get a workflow running](https://docs.voicelogica.ai/workflows/) - Save, then this POST.  
[Workflow Nodes](https://docs.voicelogica.ai/workflow-nodes/) - what to put after the trigger.  
[API keys](https://docs.voicelogica.ai/getting-started/api-keys/) - key with workflow run scope.
