Quick Question: How to access callId in active cal...
# support
a
Quick Question: How to access callId in active call? I need to pass the conversation's callId to my api. I can see it in the paylod (attributes.callId), but how do I reference it in my system prompt? Should I use: {{callId}} {{call.id}} {{attributes.callId}} Something else? Is there documentation on available system/conversation variables? Thanks!
v
Based on the documentation I have found, dynamic variables in Vapi are referenced in prompts using double curly braces, like
{{variableName}}
. However, I do not see
callId
,
call.id
, or
attributes.callId
listed as default variables available for use in system prompts. The documentation provides a list of default variables (such as
{{now}}
,
{{customer.number}}
, etc.) and explains how to use custom variables by passing them via the API, but does not mention a built-in call ID variable for prompts. Could you clarify if you are looking to reference the call ID that is generated by Vapi itself, or a custom call identifier you are passing in your API payload? This will help determine if you need to define a custom variable or if there is a built-in option. For more details on available variables, you can review the [Vapi dynamic variables documentation](https://docs.vapi.ai/assistants/dynamic-variables). Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)
a
im looking to reference the call ID that is generated by Vapi itself how to pass with callid in to API
im looking to reference the call ID that is generated by Vapi itself how to pass with callid in to API
c
Hi there, For System Prompt Template Variables: The
callId
is not currently available as a default template variable in the system prompt using
{{callId}}
or
{{call.id}}
syntax. The available default variables are
{{now}}
,
{{date}}
,
{{time}}
,
{{customer.number}}
,
{{transport.conversationType}}
, etc. Recommended Approach - Use Tools/Server URL: The most reliable way to access the
callId
is through custom tools or server URL webhooks. When Vapi calls your API endpoint (via a tool or server message), the payload automatically includes the full call object with the `id`:
Copy code
{
  "message": {
    "call": {
      "id": "call-uuid",
      "orgId": "org-uuid",
      "type": "webCall",
      ...
    }
  }
}
Options for your use case: 1. API Request Tool with LiquidJS - If using the
apiRequest
tool type, you can use LiquidJS syntax in URLs, headers, and body. You may be able to access call context variables this way. 2. Custom Tool/Server Endpoint - Set up your tool's server URL to receive the full payload, extract
message.call.id
, and use it in your business logic. 3. Server URL Webhooks - Configure a server URL on your assistant/phone number to receive call events containing the call ID. Documentation references: • Dynamic variables: [https://docs.vapi.ai/assistants/dynamic-variables](https://docs.vapi.ai/assistants/dynamic-variables) • Custom tools: [https://docs.vapi.ai/tools/custom-tools](https://docs.vapi.ai/tools/custom-tools) • API Request tool: [https://docs.vapi.ai/tools/default-tools](https://docs.vapi.ai/tools/default-tools) Let me know if you need help implementing any of these approaches! Regards Vapi Support