AXL Knowledge Base

Run an Automation via the API

~10 min read Section: Automations

Use the API to start an AXL automation from another application, such as your website, CRM, payment service or a script. The request tells AXL which automation to run and for which contact. AXL finds or creates the contact, saves the contact details you send, and runs the automation's steps for that contact: for example, it sends a welcome email and grants access to a course.

The endpoint runs a standalone automation created under Settings → Automations. Automations that belong to a course, product, pipeline, chatbot or webinar cannot be started this way. Use POST whenever your integration supports it; GET is available for tools that can only open a URL.

Create an Automation

Go to Settings → Automations and click Create Automation. Enter a title and a description, then click Create.

New Automation panel with the title Northstar Academy — Enrollment via API, a description and the Create button.

The automation opens on the Automation tab. It already contains the Automation Started trigger: this is the step the API request fires. Do not add a second copy of it.

New automation on the Automation tab with the Automation Started trigger, the Inactive toggle and the How to Run via API link.

Click the info icon next to How to Run via API. The window shows the request format and this automation's ID in scenarioId. Copy the ID: every request needs it.

How to Run via API help showing this automation's ID in scenarioId.

Set Up the Automation Steps

Add the actions that should happen for the contact, configure each one, and connect them to Automation Started by drawing a line from the trigger to the first action. In the example below, AXL sends a welcome email and grants access to the Leadership Certificate course.

When the steps are ready, turn on Active. A request for an inactive automation is rejected with the scenarioDisabled error. For the list of actions and their settings, see "Types of Actions in Automations and Their Settings".

Automation Started connected to Send Email (contact's email, Northstar template) and Grant Product Access (Leadership Certificate, no end date).

Create an API Key

Go to Settings → API Keys and click Create API Key.

API Keys list with the Northstar Enrollment Integration key, its edit and delete buttons and Create API Key.
  1. In New API Key, enter a title that names the integration, for example Northstar Enrollment Integration, and click Create.
  2. Open the key by its title. Turn on the Run Automations permission and click Save. Without this permission every request returns accessDenied.
  3. Copy the key with the copy icon beside it and store it in your integration's secret settings.

Important: the key works like a password for your account. Keep it on your server or in the integration's secret storage. Do not put it in website code that runs in the visitor's browser, in shared documents or in screenshots.

Request Reference

ItemValue
URLhttps://app.axl.tech/api/v1/scenario/run
MethodPOST (recommended) or GET
Authorization headerAuthorization: Bearer YOUR_API_KEY: the word Bearer, one space, then the key
Body format (POST)JSON, with the header Content-Type: application/json

Body parameters

ParameterTypeRequiredDescription
scenarioIdstringYesThe automation ID from How to Run via API.
contactIdstringOne of the twoThe ID of an existing contact. If the contact does not exist, the request fails with studentNotFound.
contactData.emailstringOne of the twoThe contact's email. If there is no contactId, AXL looks for a contact with this email and creates a new one if none exists.
contactDataobjectNoContact details to save on the contact: see the next table. Fields you leave out stay unchanged.
dataobjectNoValues for this run only, such as an order number or amount. They are not saved on the contact. Conditions in the automation can read them (see Pass values to the run).

Contact fields in contactData

FieldFormat and behavior
emailA valid email address; an invalid one returns invalidParameter.
firstName, lastName, middleNameText.
phoneText; use the international format, for example +12025550184.
country, cityText.
timezoneIdTime zone ID, for example America/New_York. An unknown ID returns unknownTimezone.
birthdayDate in YYYY-MM-DD format, for example 1990-04-15.
gendermale, female or other.
commentReplaces the contact's comment.
commentAppendAdds text to the contact's existing comment.
tagsArray of tag names, for example ["webinar-lead"]. Tags are added; the contact's existing tags stay.
groupsArray of group names. The contact is added to these groups.
utmSource, utmMedium, utmCampaign, utmTerm, utmContentUTM tags of the visit that led to the request.
Custom field keyAny other key is treated as a custom contact field, for example "enrollment_source": "Fall webinar". The field must already exist in AXL; an unknown key returns leadAttributeNotFound with the key in target.

To find a custom field's key, open any contact card in CRM → Contacts, click Manage Custom Attributes and open the field. To create a field, click Create Field and fill in Title, Type and Key. The key may contain Latin letters, numbers and the symbols -, _ and ., without spaces.

New Field form beside Custom Attributes: Title Enrollment source, Type Text, Key enrollment_source and the Create button.

Pass values to the run

Use data for values that matter to this run but should not be stored on the contact, such as an order number or a payment amount. Nested objects are allowed. A Condition step can check them with the dynamic data filter, using a dotted path to the value: "data": {"order": {"amount": 149}} is read as order.amount. Send data in a POST request.

Response

The endpoint returns its application result as a JSON body, including application errors with HTTP status 200. Check both the HTTP status and success; an authentication, request or server failure can occur before this application response.

{
  "success": true,
  "errors": [],
  "body": "_3PKP8LF6kGA_mPUvH9LtA"
}

body is the ID of the contact the automation runs for: the existing contact or the one just created. Save it if your system needs to address the same contact later. A successful response means the run has been queued; the automation's steps then run in the background, usually within seconds.

An error response has success: false and the reason in errors[].type (shortened example):

{
  "success": false,
  "errors": [
    { "type": "scenarioDisabled", "target": null }
  ]
}

Errors

typeCause and fix
accessDeniedThe API key does not have the Run Automations permission. Turn it on in Settings → API Keys.
isRequiredA required parameter is missing: target is ScenarioId, or ContactId when neither contactId nor contactData.email was sent.
invalidParameterThe email is not a valid address (target: Email) or a custom field entry is malformed (target: Attributes).
unknownTimezonetimezoneId is not a known time zone ID.
scenarioNotFoundNo standalone automation with this scenarioId exists in the account. Copy the ID again from How to Run via API.
scenarioDisabledThe automation is inactive. Turn on Active.
studentNotFoundNo contact with this contactId exists in the account.
leadAttributeNotFoundA custom field key in contactData does not exist; the unknown keys are listed in target.

Run an Automation with POST

Each example runs the automation for Olivia Bennett, saves her name, phone, a tag and a custom field, and passes an order amount to the run. Replace YOUR_API_KEY and YOUR_AUTOMATION_ID with your values. The email and phone are fictional; use your own test contact.

Important: every successful request starts the automation for real. Its steps may send emails or messages and grant access, so test with your own contact first.

curl

curl -X POST "https://app.axl.tech/api/v1/scenario/run" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scenarioId": "YOUR_AUTOMATION_ID",
    "contactData": {
      "email": "olivia.bennett@example.com",
      "firstName": "Olivia",
      "lastName": "Bennett",
      "phone": "+12025550184",
      "tags": ["webinar-lead"],
      "enrollment_source": "Fall webinar"
    },
    "data": {
      "order": { "amount": 149 }
    }
  }'

JavaScript (Node.js 18+)

const response = await fetch('https://app.axl.tech/api/v1/scenario/run', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.AXL_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    scenarioId: 'YOUR_AUTOMATION_ID',
    contactData: {
      email: 'olivia.bennett@example.com',
      firstName: 'Olivia',
      lastName: 'Bennett',
      phone: '+12025550184',
      tags: ['webinar-lead'],
      enrollment_source: 'Fall webinar',
    },
    data: { order: { amount: 149 } },
  }),
});

if (!response.ok) {
  throw new Error(`AXL HTTP error: ${response.status}`);
}
const result = await response.json();
if (!result.success) {
  throw new Error(`AXL error: ${result.errors.map(e => e.type).join(', ')}`);
}
console.log('Contact ID:', result.body);

Python

import os
import requests

response = requests.post(
    "https://app.axl.tech/api/v1/scenario/run",
    headers={"Authorization": f"Bearer {os.environ['AXL_API_KEY']}"},
    json={
        "scenarioId": "YOUR_AUTOMATION_ID",
        "contactData": {
            "email": "olivia.bennett@example.com",
            "firstName": "Olivia",
            "lastName": "Bennett",
            "phone": "+12025550184",
            "tags": ["webinar-lead"],
            "enrollment_source": "Fall webinar",
        },
        "data": {"order": {"amount": 149}},
    },
    timeout=30,
)
response.raise_for_status()
result = response.json()
if not result["success"]:
    raise RuntimeError(f"AXL error: {result['errors']}")
print("Contact ID:", result["body"])

The JavaScript and Python examples read the key from the AXL_API_KEY environment variable, so the key never appears in the code. For an existing contact whose ID you know, send "contactId": "CONTACT_ID" instead of contactData.email; the other contact fields are optional.

Run an Automation with GET

Use GET only when your tool can open a URL but cannot send a POST request with a body. All parameters go into the query string: contact fields get the contactData. prefix, including custom field keys.

Query parameterDescription
scenarioIdThe automation ID. Required.
contactIdAn existing contact ID, or use contactData.email instead.
contactData.email, contactData.firstName, contactData.phone, …Contact fields from the table above, one parameter per field.
contactData.<key>A custom field, for example contactData.enrollment_source=Fall%20webinar.
admin_access_tokenThe API key without Bearer. Use it only if the tool cannot send the Authorization header.

With the Authorization header:

curl -G "https://app.axl.tech/api/v1/scenario/run" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "scenarioId=YOUR_AUTOMATION_ID" \
  --data-urlencode "contactData.email=olivia.bennett@example.com" \
  --data-urlencode "contactData.firstName=Olivia" \
  --data-urlencode "contactData.phone=+12025550184"

When the tool can only open a URL:

https://app.axl.tech/api/v1/scenario/run?admin_access_token=YOUR_API_KEY&scenarioId=YOUR_AUTOMATION_ID&contactData.email=olivia.bennett%40example.com&contactData.firstName=Olivia&contactData.phone=%2B12025550184

Encode the values in the URL: %40 stands for @, %2B for + and %20 for a space. Without encoding, the + in a phone number turns into a space.

Important: a URL with admin_access_token contains your key and starts the automation every time it is opened. Servers, proxies and browsers can record URLs in their logs, so never publish such a URL on a website or in a shared document. Prefer the Authorization header whenever the tool supports it.

Check the Result in AXL

  1. Check success in the response. On success, body contains the contact ID.
  2. Open CRM → Contacts and find the contact by the email you sent.
  3. Open the contact's Automations tab and find the run of your automation.
  4. Open History to see which steps ran, and check their results separately: the email in the contact's email history, the course in Access & Products.