| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Converts a workflow rule expression (in plain text) into the structured expressionJSON format required by the loyalty promotions API. This endpoint validates and translates rule expressions written in the loyalty engine's expression language.
What this API supports
- Parsing a rule expression string into a structured
expressionJSONtree - Accepting any event type recognised by the loyalty engine (for example,
TargetCompleted)
Example request
curl -L 'https://{host}/loyalty/api/v1/workflows/expJSON/{programId}/{eventType}' \
-H 'content-type: application/json' \
-H 'cookie: CT={ct-token}; OID={org-id}' \
-d '{
"exp": "currentTxn.value==1000"
}'
Prerequisites
- Cookie-based authentication — this endpoint requires a valid session cookie obtained from the Capillary UI. See Getting a session cookie below. Standard API key or Basic authentication is not supported.
Getting a session cookie
This is an internal API and requires a session cookie that you can obtain using the InTouch UI and the browser network tab. To get a session cookie do the following:
-
Login to the InTouch UI and navigate to the required organisation.
-
Open the browser developer tools (usually F12) and navigate to the network tab.
-
Select Reload Page to refresh the page and begin recording network activities.

-
Filter the logs by Fetch/XHR and select a successful network fetch.
-
Navigate to the Cookies tab and copy the values for
CT
-
Paste these as the value for
cookieunder the API header in the following formatCT={cookieValue};OID={OIDValue}.
API Quick Reference
POST /loyalty/api/v1/workflows/expJSON/{programId}/{eventType}
Request
└─ exp (string)
Response
├─ success (boolean)
├─ status (number)
└─ result
├─ expressionJSON (string)
├─ expression (string)
└─ isError (boolean)
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
programId | Integer | Yes | Unique identifier of the loyalty programme. |
eventType | String | Yes | Event type the rule applies to. Supported standard values: TransactionAdd, TransactionUpdate, CustomerRegistration, CustomerUpdate, NewBill, PointsContributionToGroup, PointsTransfer, ReturnBill, TargetCompleted, PointsRedemption, VoucherRedemption, PartnerProgramDeLinking, PartnerProgramLinking, PartnerProgramTierUpdate. Also accepts the name of any valid behavioural event configured for the organisation. |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
exp | String | Yes | The rule expression to convert, written in the loyalty expression language. For example, currentTxn.value==1000. |
Example response
{
"success": true,
"status": 200,
"result": {
"expressionJSON": "\n{\n \"arity\":\"binary_operation\",\n \"value\":\"==\",\n \"type\":\"boolean:primitive\",\n \"operands\":[\n {\n \"arity\":\"object_dereference\",\n \"operands\":[\n {\n \"arity\":\"name\",\n \"value\":\"currentTxn\"\n },\n {\n \"arity\":\"name\",\n \"value\":\"value\"\n }\n ]\n },\n {\n \"arity\":\"literal\",\n \"value\":\"1000\",\n \"type\":\"number:primitive\"\n }\n ]\n}",
"expression": "currentTxn.value==1000",
"isError": true
}
}{
"success": true,
"status": 200,
"result": {
"expressionJSON": "\n{\n \"arity\":\"binary_operation\",\n \"value\":\"==\",\n \"type\":\"boolean:primitive\",\n \"operands\":[\n {\n \"arity\":\"object_dereference\",\n \"type\":\"string:object:primitive\",\n \"operands\":[\n {\n \"arity\":\"name\",\n \"value\":\"currentEvent\",\n \"type\":\"customer.targetCompletedEvent:object:primitive\"\n },\n {\n \"arity\":\"name\",\n \"value\":\"targetName\",\n \"type\":\"string:object:primitive\"\n }\n ]\n },\n {\n \"arity\":\"literal\",\n \"value\":\"Gatekeeper T&C Accepted\",\n \"type\":\"string:object:primitive\"\n }\n ]\n}",
"expression": "currentEvent.targetName==\"Gatekeeper T&C Accepted\"",
"isError": false
}
}Response parameters
| Field | Type | Description |
|---|---|---|
success | Boolean | true if the request was received and processed. |
status | Integer | HTTP status code of the response. |
result | Object | Contains the output of the expression parse. |
.expressionJSON | String | JSON-encoded string of the parsed expression tree. Returned regardless of whether isError is true or false. |
.expression | String | The original expression string submitted in the request. |
.isError | Boolean | true if the parser detected an error in the expression (for example, an unrecognised variable or wrong context object for the event type). false if the expression parsed cleanly. |
Error and warning codes
| Code | Type | Description |
|---|---|---|
| 401 | Error | Missing or invalid session cookie. Obtain a fresh cookie from the UI. |
| 500 | Error | Internal server error. Retry the request after a short delay. |
401Missing or invalid session cookie.
