Guides

Toplyne API

API Headers

HeaderDescriptionData type
AuthorizationGenerated Toplyne API token

eg: Bearer 'ToplyneAPIToken'
str
Content-TypeRequest content-type is always set to application/json; charset=utf-8str

Generating Toplyne API token

  1. From your Toplyne dashboard, navigate to Settings > API Settings and click on + Generate new token.
  2. Enter a name for your token, and select 'Does not expire' under Expiration. Then click Generate new token.
  3. Copy the access token that has just been generated. This will be the authorization key that goes on your header.

API structure

Account Event API

AccountEventAPI will enable you to insert events at an account level into the Toplyne System. You can read more about accounts here and events here.

The max number of events you can insert per call is 500.

Endpoint : https://api.toplyne.io/v1/upload/accounts/events

Events are uploaded as a JSON payload with the object keyed at “events“. The JSON should adhere to a predefined structure. For each event - accountId, timestamp, and eventName are must-have properties. Additional properties can be sent via the eventProperties nested JSON.

ParameterDescriptionDatatypeExample
accountId
(Required)
Set to the unique identifier of accounts in your system. This has to be uniform across all the systems you integrate with toplynestr“9657841“
eventName
(Required)
Set to the Event name of the event the corresponding accountId has preformedstr"Login_successful"
timestamp
(Required)
Set to the timestamp when the event occured, Formatted as a UNIX epoch in secondsint639303296
eventProperties
(Optional)
Set additional properties for the eventobj{
"prop1": "value1",
"prop2":”value2"
}

Sample Request JSON

{
"events": [
    {
      "accountId": "9657841",
      "eventName": "Login_Succeeded",
      "timeStamp": 1639303296,
      "eventProperties": {
        	“prop1“: ”value1”,
            “prop2“: ”value2”
		}
	]
}

Sample Response JSON

{
    "MsgCode": "100",
    "Msg": "Events uploaded",
    "status": "success"
}

Sample Response JSON (Wrong API Token)

{
    "MsgCode": 400,
    "Msg": "Authentication Failure",
    "status": "failure"
}

Account Profile API

AccountsAPI lets you insert account details into the system.

The max number of accounts you can insert per call is 100.

Endpoint : https://api.toplyne.io/v1/upload/accounts/profiles

Accounts are uploaded as a JSON payload with the object keyed at “accounts“. The JSON should adhere to a predefined structure. For each profile, a accountId, creationTime are must have properties. There are a few optional params as mentioned below. Additional properties can be send via the accountProperties nested json.

ParameterDescriptionDatatypeExample
accountId
(Required)
Set to the unique identifier of accounts in your system. This has to be uniform across all the systems you integrate with toplynestr“9657841“
creationTime
(Required)
Set to the timestamp when account was created, Formatted as a UNIX epoch in secondsint639303296
accountName
(Optional)
Set to the account name of the accountstr"toplyne"
website
(Optional)
Set to the website of the accountstr"www.toplyne.io"
country
(Optional)
Set to the country of the accountstr"India"
accountProperties
(Optional)
Set additional properties for the accountobj{
"prop1": "value1",
"prop2":”value2"
}

Sample Request JSON

{
"profiles": [
    {
      "accountId": "9657841",
      "creationTime": 1639303296,            
      "accountName": "toplyne",
      "website": "www.toplyne.io",
      "country": "India",
      "accountProperties": {
        	“prop1“: ”value1”,
            “prop2“: ”value2”
		}
	]
}

Sample Response JSON

{
    "MsgCode": "100",
    "Msg": "Accounts uploaded",
    "status": "success"
}

Sample Response JSON (Wrong API Token)

{
    "MsgCode": 400,
    "Msg": "Authentication Failure",
    "status": "failure"
}

User Event API

UserEventAPI will enable you to insert events at an individual user level into the Toplyne System. You can read more about accounts here and events here.

Endpoint : https://api.toplyne.io/v1/upload/users/events

Events are uploaded as a JSON payload with the object keyed at “events“. The JSON should adhere to a predefined structure. For each event, a userId, timestamp and event name is must have properties. Additional properties can be send via the eventProperties nested json.

ParameterDescriptionDatatypeExample
usertId
(Required)
Set to the unique identifier of users in your system. This has to be uniform across all the systems you integrate with toplynestr“9657841“
eventName
(Required)
Set to the Event name of the event the corresponding user has preformedstr"Login_successful"
timestamp
(Required)
Set to the timestamp when the event occured, Formatted as a UNIX epoch in secondsint639303296
eventProperties
(Optional)
Set additional properties for the eventobj{
"prop1": "value1",
"prop2":”value2"
}

Sample Request JSON

{
"events": [
    {
      "userId": "9657841",
      "eventName": "Login_Succeeded",
      "timeStamp": 1639303296,
      "eventProperties": {
        	“prop1“: ”value1”,
            “prop2“: ”value2”
		}
	]
}

Sample Response JSON

{
    "MsgCode": "100",
    "Msg": "Events uploaded",
    "status": "success"
}

Sample Response JSON (Wrong API Token)

{
    "MsgCode": 400,
    "Msg": "Authentication Failure",
    "status": "failure"
}

User Profile API

UserProfileAPI lets you upsert profiles into the system.

The max number of profiles you can insert per call is 100.

Endpoint : https://api.toplyne.io/v1/upload/users/profiles

Profiles are uploaded as a JSON payload with the object keyed at “profiles“. The JSON should adhere to a predefined structure. For each profile, a userId, creationTime is must have properties. There are a few optional params as mentioned below. Additional properties can be send via the userProperties nested json.

ParameterDescriptionDatatypeExample
userId
(Required)
Set to the unique identifier of users in your system. This has to be uniform across all the systems you integrate with toplynestr“9657841“
creationTime
(Required)
Set to the timestamp when account was created, Formatted as a UNIX epoch in secondsint639303296
firstName
(Optional)
Set to the first name of the userstr"mclovin"
lastName
(Optional)
Set to the first name of the userstr""
email
(Optional)
Set to the email of the userstr"[email protected]"
phone
(Optional)
Set to the phone of the userstr"8075464375"
country
(Optional)
Set to the country of the userstr"USA"
userProperties
(Optional)
Set additional properties for the userobj{
"prop1":"value1",
"prop2": "value2"
}

Sample Request JSON

{
"profiles": [
    {
      "userId": "9657841",
      "creationTime": 639303296,
      "firstName": "McLovin",
      "lastName": "",
      "email": "[email protected]",
      "phone": "8075464375",
      "country": "USA",
      "userProperties": {
        	“prop1“: ”value1”,
            “prop2“: ”value2”
		}
	]
}

Sample Response JSON

{
    "MsgCode": "100",
    "Msg": "Users uploaded",
    "status": "success"
}

Sample Response JSON (Wrong API Token)

{
    "MsgCode": 400,
    "Msg": "Authentication Failure",
    "status": "failure"
}