API

All posts to the SimpleID API require an appId and other information for validation. The API takes JSON payloads with commands and data objects rather than having specific endpoints.

API URL - https://api.simpleid.xyz

POST - registerUserV2

This is the equivalent of the passUserInfo method on the SDK. It will take a user's wallet address and (optionally) the email address and add the user to your SimpleID account.

Body:

{
"command": "registerUserV2",
"data": {
"appId": "YOUR APP ID",
"address": "YOUR USER'S WALLET ADDR",
"email": "YOUR USER'S EMAIL ADDR" // Optional
}
}

Examples:

NodeJS
JavaScript
cURL
NodeJS
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'api.simpleid.xyz',
'path': '/',
'headers': {
'Content-Type': 'application/json'
}
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({"command":"registerUserV2","data":{"appId":"YOUR APP ID","address":"YOUR USER'S WALLET ADDR","email":"YOUR USER'S EMAIL ADDR"}});
req.write(postData);
req.end();
JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"command":"registerUserV2","data":{"appId":"YOUR APP ID","address":"YOUR USER'S WALLET ADDR","email":"YOUR USER'S EMAIL ADDR"}});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw
};
fetch("https://api.simpleid.xyz", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
cURL
curl --location --request POST 'https://api.simpleid.xyz' \
--header 'Content-Type: application/json' \
--data-raw '{
"command": "registerUserV2",
"data": {
"appId": "YOUR APP ID",
"address": "YOUR USER'\''S WALLET ADDR",
"email": "YOUR USER'\''S EMAIL ADDR"
}
}'

Response:

{
wallet: {
ethAddr: "YOUR USER's ETH ADDRESS,
uuid: "THE GENERATED UUID FROM SIMPLEID"
}
}

Post - handleNotificationData

This will return all of the in-app notifications available for a given user.

Body:

{
"command": "handleNotificationData",
"data": {
"appId": "YOUR APP ID",
"address": "YOUR USER'S WALLET ADDR"
}
}

Examples:

NodeJS
JavaScript
cURL
NodeJS
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'api.simpleid.xyz',
'path': '/',
'headers': {
'Content-Type': 'application/json'
}
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({"command":"handleNotificationData","data":{"appId":"YOUR APP ID","address":"YOUR USER'S WALLET ADDR"}});
req.write(postData);
req.end();
JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"command":"handleNotificationData","data":{"appId":"YOUR APP ID","address":"YOUR USER'S WALLET ADDR"}});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw
};
fetch("https://api.simpleid.xyz", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
cURL
curl --location --request POST 'https://api.simpleid.xyz' \
--header 'Content-Type: application/json' \
--data-raw '{
"command": "handleNotificationData",
"data": {
"appId": "YOUR APP ID",
"address": "YOUR USER'\''S WALLET ADDR"
}
}'

Response:

[
{
active: true, // boolean indicating if the notification is marked active or not
id: "NOTIFICATION ID",
name: "NOTIFICATION NAME",
content: "HTML CONTENT OF NOTIFICATION",
org_id: "YOUR ORGANIZATION's ID",
plain_text: "PLAIN TEXT VERSION OF NOTIFICATION",
segmentId: "ID OF SEGMENT USER IS A PART OF"
}
]

Post - sendEmails

Send emails to specific users without ever knowing their email address. Requires an array of uuids. A uuid is provided is provided by SimpleID on each call to the registerUserV2.

You can easily get most of the data you need for the sendEmails command by signing into your SimpleID account, going to the Email tab, and clicking the "Get Template Data" button next to the template you'd like to use when sending your emails through the API.

This will give you the API object you need below, minus the UUIDS. You'll need to add those in.

Body:

Note: you can use a template_id provided by the SimpleID application interface or you can pass in your own HTML string.

{
"command": "sendEmails",
"data": {
"appId": "YOUR APP ID",
"template_id": "THE EMAIL TEMPLATE ID YOU WANT TO USE",
"html": "string of html content",
"subject": "YOUR EMAIL SUBJECT LINE",
"from": "THE EMAIL ADDRESS YOU WANT TO SEND FROM",
"org_id": "YOUR ORGANIZATION ID",
"campaign_id": "A UUID TO REPRESENT THIS EMAIL CAMPAIGN",
"uuidList": []
}
}

Examples:

NodeJS
JavaScript
cURL
NodeJS
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'api.simpleid.xyz',
'path': '/',
'headers': {
'Content-Type': 'application/json'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({"command":"sendEmails","data":{"appId":"YOUR APP ID","template_id":"THE EMAIL TEMPLATE ID YOU WANT TO USE","subject":"YOUR EMAIL SUBJECT LINE","from":"THE EMAIL ADDRESS YOU WANT TO SEND FROM","org_id":"YOUR ORGANIZATION ID","campaign_id":"A UUID TO REPRESENT THIS EMAIL CAMPAIGN","uuidList":[]}});
req.write(postData);
req.end();
JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"command":"sendEmails","data":{"appId":"YOUR APP ID","template_id":"THE EMAIL TEMPLATE ID YOU WANT TO USE","subject":"YOUR EMAIL SUBJECT LINE","from":"THE EMAIL ADDRESS YOU WANT TO SEND FROM","org_id":"YOUR ORGANIZATION ID","campaign_id":"A UUID TO REPRESENT THIS EMAIL CAMPAIGN","uuidList":[]}});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.simpleid.xyz", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
cURL
curl --location --request POST 'https://api.simpleid.xyz' \
--header 'Content-Type: application/json' \
--data-raw '{
"command": "sendEmails",
"data": {
"appId": "YOUR APP ID",
"template_id": "THE EMAIL TEMPLATE ID YOU WANT TO USE",
"subject": "YOUR EMAIL SUBJECT LINE",
"from": "THE EMAIL ADDRESS YOU WANT TO SEND FROM",
"org_id": "YOUR ORGANIZATION ID",
"campaign_id": "A UUID TO REPRESENT THIS EMAIL CAMPAIGN",
"uuidList": []
}
}'

Response:

{
success: true,
emailCount: 5, // Number of emails sent
}

Here's an interactive repl.it example:

https://repl.it/@prabhaav/LankyGreenTaskscheduling