Toplyne API
API Headers
Header | Description | Data type |
---|---|---|
Authorization | Generated Toplyne API token eg: Bearer 'ToplyneAPIToken' | str |
Content-Type | Request content-type is always set to application/json; charset=utf-8 | str |
Generating Toplyne API token
- From your Toplyne dashboard, navigate to Settings > API Settings and click on + Generate new token.
- Enter a name for your token, and select 'Does not expire' under Expiration. Then click Generate new token.
- 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.
Parameter | Description | Datatype | Example |
---|---|---|---|
accountId (Required) | Set to the unique identifier of accounts in your system. This has to be uniform across all the systems you integrate with toplyne | str | “9657841“ |
eventName (Required) | Set to the Event name of the event the corresponding accountId has preformed | str | "Login_successful" |
timestamp (Required) | Set to the timestamp when the event occured, Formatted as a UNIX epoch in seconds | int | 639303296 |
eventProperties (Optional) | Set additional properties for the event | obj | { "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.
Parameter | Description | Datatype | Example |
---|---|---|---|
accountId (Required) | Set to the unique identifier of accounts in your system. This has to be uniform across all the systems you integrate with toplyne | str | “9657841“ |
creationTime (Required) | Set to the timestamp when account was created, Formatted as a UNIX epoch in seconds | int | 639303296 |
accountName (Optional) | Set to the account name of the account | str | "toplyne" |
website (Optional) | Set to the website of the account | str | "www.toplyne.io" |
country (Optional) | Set to the country of the account | str | "India" |
accountProperties (Optional) | Set additional properties for the account | obj | { "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.
Parameter | Description | Datatype | Example |
---|---|---|---|
usertId (Required) | Set to the unique identifier of users in your system. This has to be uniform across all the systems you integrate with toplyne | str | “9657841“ |
eventName (Required) | Set to the Event name of the event the corresponding user has preformed | str | "Login_successful" |
timestamp (Required) | Set to the timestamp when the event occured, Formatted as a UNIX epoch in seconds | int | 639303296 |
eventProperties (Optional) | Set additional properties for the event | obj | { "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.
Parameter | Description | Datatype | Example |
---|---|---|---|
userId (Required) | Set to the unique identifier of users in your system. This has to be uniform across all the systems you integrate with toplyne | str | “9657841“ |
creationTime (Required) | Set to the timestamp when account was created, Formatted as a UNIX epoch in seconds | int | 639303296 |
firstName (Optional) | Set to the first name of the user | str | "mclovin" |
lastName (Optional) | Set to the first name of the user | str | "" |
email (Optional) | Set to the email of the user | str | "[email protected]" |
phone (Optional) | Set to the phone of the user | str | "8075464375" |
country (Optional) | Set to the country of the user | str | "USA" |
userProperties (Optional) | Set additional properties for the user | obj | { "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"
}
Updated over 1 year ago