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.
Configure authentication
Choose Bearer token, Basic authentication, or API key in the Authentication section when the external API requires credentials. Leadpush encrypts the secret and does not show it again after saving.
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. |
| Authentication | Optional encrypted bearer token, Basic username and password, or API key. API keys can be sent in a header or query parameter. |
| Body Template | Optional request body. Use JSON when the receiver expects JSON. |
| Headers Template | Optional non-secret request headers, such as Accept or Content-Type. |
| 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.<attribute_key> | Use a selected contact attribute, such as contact.email or contact.external_id. |
contact.<json_field>.<nested_key> | Read a nested JSON field value, such as contact.preferences.6. |
contact.attributes.email | Legacy nested access to contact attributes; still supported. |
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.email }}/profile
Nested JSON values use the same dot notation:
https://api.example.com/preferences/{{ contact.preferences.6 }}
Choose Bearer token under Authentication and enter the token value. Leadpush adds the authorization header when it sends the request:
| Header | Value |
|---|---|
Authorization | Bearer •••••••• |
Accept | application/json |
For an API key, choose whether to send it as a header or query parameter, then enter the name required by the external API. Headers are preferred because query-string credentials may be captured in external logs.
For Basic authentication, enter the username and password supplied by the external API. Leadpush creates the standard Authorization: Basic … header at request time. The username remains visible when editing, but the encrypted password is never returned.
After a secret is saved, the endpoint API and form only report that a credential is configured. Leave the secret field blank while editing to keep the current value, enter a new value to replace it, or choose None to remove it.
Endpoints created before dedicated authentication may show a masked stored value in Advanced request options. Leaving that marker unchanged preserves the existing value. Move the credential into Authentication manually, then remove the old header or query template. Leadpush does not automatically move it because it cannot reliably determine the required authentication scheme.
Use a body template when the API expects JSON:
{
"contact_id": "{{ contact._id }}",
"email": "{{ contact.email }}",
"campaign": "{{ campaign.uuid }}"
}