POST
/
v2
/
activities
curl --request POST \
  --url https://api.loyaltylion.com/v2/activities \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>",
  "customer_id": "<string>",
  "customer_email": "<string>",
  "merchant_id": "<string>",
  "properties": {
    "url": "<string>"
  },
  "ip_address": "<string>",
  "user_agent": "<string>",
  "date": "2025-01-01T12:00:00Z",
  "referral_id": "<string>",
  "tracking_id": "<string>",
  "guest": true
}'
This response has no body data.

Use this endpoint to track an activity to LoyaltyLion. When tracking an activity, if an applicable rule exists, it will be triggered based on the name of the activity.

For the Clickthrough/Visit rule, you also need to specify the destination URL in the properties.

You shouldn’t use this API to track and reward purchases. Instead you should use the Orders API which allows you to send important information specific to orders, such as the order total and payment status.

Query Parameters

site_id
number

Create the activity in the specified site. This is only required for programs that have multiple sites. Programs with only a single site can omit this parameter, and the activity will be created in the program's only site

Body

application/json
Body
name
string
required

A built-in or custom activity rule name. If you’re tracking a custom rule, this should be the rule identifier; if you’re tracking a built-in activity, the name must be prefixed with a $, for example, $signup

customer_id
string
required

A unique ID for the customer involved in the activity. This should be your internal ID (from your ecommerce platform) for this customer

customer_email
string
required

The email address for the customer

merchant_id
string | null

A unique ID used to link this activity to an internal resource in your system. If provided, you can update the state of this activity later using the activity update endpoint

properties
object

A set of properties for this rule. Some rules require certain properties to be set

ip_address
string | null

The IP address of the customer involved in this activity. Used in combination with user_agent to track referrals

user_agent
string | null

The full user agent string of the customer involved in this activity. Used in combination with ip_address to track referrals

date
string | null

The date this activity occurred, as an ISO 8601 timestamp. Defaults to now if not provided

referral_id
string | null

A LoyaltyLion referral ID

tracking_id
string | null

A LoyaltyLion email tracking ID

guest
boolean | null
default:
true

A boolean value indicating if the customer is a guest. The default is true