REST API
Detailed technical documentation on the Lemnisk REST API to send your website or app data to your destinations via Lemnisk.
Last updated
Detailed technical documentation on the Lemnisk REST API to send your website or app data to your destinations via Lemnisk.
Last updated
This document acts as a reference for the REST API documentation. Please ensure that you have an agreed-upon Event Tracking Plan from your Lemnisk Customer Success Point of Contact in conjunction with this document for the correct and complete implementation.
The Lemnisk REST tracking API works as a source for collecting data; you can use it to track your customer events across any web or mobile platform (Android and iOS). Whenever you make a call to an API, the request hits our servers where we route the data to one of the destinations configured for this source.
Go to -> Data Pipeline -> Sources
Step 1: Click on +Create New Source
Step 2: Select the source type as REST API and click Proceed
Step 3: Set up the source
Source name: Add a unique name to the source and click the "Create" button.
Every API call must be authenticated with the respective x-api-key
and x-api-passkey
header. You can find these keys in the pop-up as shown in the note below.
Note:
Copy the following API keys from the pop-up while creating the source.
Note: The x-api-key
and x-api-passkey
values will not be shown once you close the popup so ensure to copy the keys in a safe place.
If any of the values for these headers is malformed or not present, the request will fail with 401 Unauthorized
error.
To test the integration, configure the REST API credentials and click on "TEST". Send a request to the endpoint mentioned in the documentation if we receive the request successfully, a success message will be shown indicating successful source configuration.
Payload: The correct format for the payload to send events will be displayed here. You can copy the payload and use it while sending API requests.
The REST API source only supports identify
and track
event types.
The REST API supports POST
and DELETE
methods. POST
is used to create or update a profile at Lemnisk. DELETE
is used to delete an object from the user profile or delete the profile entirely.
Australia (AU) Endpoint
https://au-crux.lemnisk.co/data
REST Specification:
Non-AU Endpoint
https://crux.lemnisk.co/v2/data
REST Specification:
You need to pass x-api-key
and x-api-passkey
in the headers.
The REST API allows a maximum of 500KB
size per call. If these limits are exceeded, the API will respond with a 400 Bad Request
.
A sample payload for ingesting 1 record is given below.
The parameter definition for accepted fields is provided below:
properties
Object
Additional properties of event in the form of param:value
userid
String
User ID or anonymous ID for this event.
eventname
String
Name of the event.
type
String
Accepts either of the two values: “identify” or “track”.
To send PII data, please add email
and mobile
to the properties
block. Ensure that the email is in lowercase and the mobile number follows the E.164 format.
The response body content type for each request (whether success or failure) will be application/json
.
Code
Reason
200 Success
Data Processed successfully
401 Unauthorized
api-key/api-passkey passed in the request headers is missing or incorrect
400 Bad Request
Incorrect request payload structure
500 Internal server error
Some error in processing
The response structure consists of a JSON array with two keys - id
and message
. The response will provide the status of each record in the request payload. Accordingly, if a call consists of 4 records, then the response will consist of an array of 4 JSON objects.
Parameter
Type
Description
message
Object
Additional properties of event in the form of param:value
id
String
User ID or anonymous ID for this event
POST request
Request:
Response:
DELETE Request
Request:
Response:
This section will find answers to most of your questions and solutions to some of the most common problems you may encounter while using the Lemnisk REST API.
Q1. Which event types are supported with the Lemnisk REST API?
The Lemnisk REST API supports identify
and track
events.
Q2. I am receiving 400 Bad Request
repeatedly. What should I do?
400 Bad Request
error means that there is something wrong with the request payload. Follow the below steps to make sure your payload is correct:
Make sure you follow the schema correctly. Sample schema is provided here.
Make sure to send the correct value for srcid
and userid
since they are mandatory fields.
Validate your JSON before making an API call. In Postman, you can easily spot the errors with a red line and a red spot in the scroll bar. Take a look at the picture below for reference.
4. If the error persists, please contact us.
Q3. How do I get the x-api-key
and the x-api-pass-key
?
You can view the x-api-key and x-api-passkey while creating the REST API source.
If you have an unanswered question or to know more about the Lemnisk REST API you can contact us.