REST API
Detailed technical documentation on the Lemnisk REST API to send your website or app data to your destinations via Lemnisk.
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.
Steps to configure REST API as 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.
Authentication
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 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.
Test the Integration
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.
Making a Request
Supported event types
The REST API source only supports identify
and track
event types.
Supported HTTP methods
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.
Endpoint
Australia (AU) Endpoint
https://au-crux.lemnisk.co/data
REST Specification:
Non-AU Endpoint
https://crux.lemnisk.co/v2/data
REST Specification:
Headers and Authentication
You need to pass x-api-key
and x-api-passkey
in the headers.
Maximum request size
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
.
Request payload
A sample payload for ingesting 1 record is given below.
The parameter definition for accepted fields is provided below:
Parameter | Type | Description |
properties | Object | Additional properties of event in the form of |
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”. |
Response
Content-Type
The response body content type for each request (whether success or failure) will be application/json
.
Status Code
Code | Reason |
| Data Processed successfully |
| api-key/api-passkey passed in the request headers is missing or incorrect |
| Incorrect request payload structure |
| Some error in processing |
Parameter Definition
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 |
| Object | Additional properties of event in the form of |
| String | User ID or anonymous ID for this event |
Sample Request and Response
POST request
Request:
Response:
DELETE Request
Request:
Response:
FAQs
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
anduserid
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.
Contact Us
If you have an unanswered question or to know more about the Lemnisk REST API you can contact us.
Last updated