Create API request endpoints
Define the reusable HTTP request that campaign workflow actions can run whenever they need external JSON data.
An API request endpoint stores the request configuration once so campaign workflows can reuse it. Each endpoint belongs to the selected workspace and can be enabled, disabled, edited, tested, or deleted from the API Requests integration page.
Before you start
Make sure the external API:
- accepts requests from Leadpush
- returns a JSON object or JSON array
- responds within the timeout you plan to use
- has the authentication values you need, such as bearer tokens or API keys
Avoid putting secrets in query strings or URL paths when the external API supports authentication headers.
Create an endpoint
Open API Requests
From the dashboard, choose a workspace, open Integrations, then open API Requests.
Create the endpoint
Select Create Endpoint and enter a descriptive name such as Customer Profile.
Configure the request
Choose the HTTP method, enter the URL template, set the timeout, and keep the endpoint enabled if it is ready for workflows.
Add optional templates
Use Request Body for a body template. Use Advanced request options for header and query parameter templates.
Save and test
Save the endpoint, then use Test endpoint to confirm Leadpush receives the expected JSON response.
Endpoint fields
| Field | Description |
|---|---|
| Name | A workspace-visible label for the endpoint. Use a purpose-based name, such as Customer Profile or Plan Lookup. |
| Enabled | Disabled endpoints cannot run from campaign workflows. |
| Method | The HTTP method Leadpush should use: GET, POST, PUT, PATCH, or DELETE. |
| URL Template | The external URL. Template variables can be inserted into the URL path. |
| Timeout | How long Leadpush waits before treating the request as failed. |
| Body Template | Optional request body. Use JSON when the receiver expects JSON. |
| Headers Template | Optional request headers, such as Authorization or X-API-Key. |
| Query Template | Optional query string parameters. Values can include template variables. |
Template variables
Use the template variable picker in the endpoint form to copy variables in the correct format.
| Variable | Example use |
|---|---|
workspace.uuid | Send the Leadpush workspace identifier to an internal API. |
workspace.name | Include the workspace name in a request body. |
contact._id | Look up a profile by Leadpush contact ID. |
contact.attributes.email | Look up a customer by email address. |
contact.subscribed | Pass the current subscription state. |
campaign.uuid | Identify the campaign that is running. |
campaign.name | Include the campaign name in a request body or query parameter. |
workflow.execution_uuid | Correlate the request to a workflow execution. |
workflow.current_step_uuid | Correlate the request to the current workflow step. |
workflow.<output_key>.<field> | Reuse JSON returned by an earlier Fetch API Data step. |
node.id | Include the current workflow node ID. |
node.type | Include the current workflow node type. |
Example endpoint
Use a URL template when the external API can look up a record directly:
https://api.example.com/customers/{{ contact.attributes.email }}/profile
Use headers for authentication:
| Header | Value |
|---|---|
Authorization | Bearer your-token |
Accept | application/json |
Use a body template when the API expects JSON:
{
"contact_id": "{{ contact._id }}",
"email": "{{ contact.attributes.email }}",
"campaign": "{{ campaign.uuid }}"
}