Use API requests in campaigns
Run a reusable API request endpoint from a campaign workflow and store the JSON response for later steps.
Campaign workflows use API request endpoints through the Fetch API Data action. When the action runs, Leadpush calls the selected endpoint, validates the JSON response, and stores the response under the action output key.
Add a Fetch API Data action
Create an endpoint
Create and test the API request endpoint from Integrations > API Requests.
Open the campaign workflow
Open the campaign editor and add a Fetch API Data action where the workflow should call the external API.
Select the endpoint
Choose an existing API request endpoint. You can also create a new endpoint from the action editor.
Set an output key
Enter a lowercase snake_case key such as customer_profile, plan_lookup, or recommendations.
Add a simulation response
Add a mock JSON response so campaign simulations can run without calling the live external API.
Save the action
Save the workflow action and use the output key in later workflow steps.
Output keys
The output key controls where Leadpush stores the endpoint response in workflow context.
Valid output keys:
- start with a lowercase letter
- contain only lowercase letters, numbers, and underscores
- are 64 characters or less
- do not use reserved names
Reserved output keys are:
execution_uuid
current_step_uuid
nodes
node
campaign
contact
workspace
If the output key is customer_profile, later workflow steps can reference the response under workflow.customer_profile.
{{ workflow.customer_profile.plan }}
{{ workflow.customer_profile.account.id }}
{{ workflow.customer_profile.recommendations.0.name }}
Reuse earlier API responses
API request templates can also use the response from earlier successful Fetch API Data steps. This lets one request feed another request.
For example, if an earlier action stores this response under source:
{
"id": "acct_123",
"region": "us-east"
}
A later API request endpoint can use:
https://api.example.com/accounts/{{ workflow.source.id }}/entitlements
Simulations
Campaign simulations do not call the live API request endpoint. They use the action's Simulation Mock Response instead.
Use a mock response that matches the shape of the real API response:
{
"plan": "pro",
"renewal_date": "2026-09-30",
"features": ["priority_support", "advanced_reporting"]
}
If the mock response is missing or invalid, the simulation fails at the Fetch API Data action.
Runtime behavior
When a campaign workflow runs:
- disabled endpoints cannot run
- template variables render before the request is sent
- non-successful HTTP responses fail the action
- the response must be a JSON object or array
- responses over the workspace response-size limit fail the action
- successful responses are stored under the output key for later steps