Sendlio API Reference

Welcome to the Sendlio API Reference! Here you'll find all the info you need to connect your own applications to Sendlio. The Sendlio API was built to be RESTful and stateless so you'll need to authenticate with each request.

In the navigation on the left, you'll see letters next to each link. These denote the type of request described in that section and should be interpreted as follows:

  • G GET Request
  • P POST Request

Endpoints

The base endpoint for all API calls referenced here is:
https://app.sendlio.com/api/v1
Example Request Endpoint
https://app.sendlio.com/api/v1/members

Authentication

To use the API, you'll need to pass your api_key and api_secret into the headers of each request. You can obtain your credentials by logging into your Sendlio account and clicking on your name, going to Settings in the menu then clicking on the API Keys tab.

api_key The API key associated with your Sendlio company account.
api_secret The API secret associated with your Sendlio company account.
Note: The api_key and api_secret must be sent in the request headers, not in the request body.
Authentication Example:
//set endpoint URL 
$url = "https://app.sendlio.com/api/v1/member;

//set Sendlio API key and secret
$api_key = "SNLOXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$api_secret = "SNLOSXXXXXXXXXXXXXXXXXXXXXXXXX";

//init client with key and secret in headers
$client = new \GuzzleHttp\Client([
    'headers' => [
        'api_key'      => $api_key,
        'api_secret'   => $api_secret,
    ]
]);

//call API
$client->get($url,$data);

Testing Your Connection

To test your connection to the Sendlio API, send a GET request to the /account endpoint. If successful, you will get back a JSON object with information about the account you are connecting as.

GET /company

Get company information

Get the company information for the associated API keys. This is a great endpoint to use to check your connection to the API.

Sample Response:
{
    "id": 1,
    "owner_id": 1,
    "name": "Sendlio Test Co.",
    "unique_id": "5dyumcc1r6v0",
    "website": "https://www.sendlio.com",
    "street": "123 Easy Street",
    "city": "Atlanta",
    "state": "GA",
    "zip": "30033",
    "country": "US",
    "created_at": "2021-04-05T17:44:28.000000Z",
    "updated_at": "2021-04-05T21:32:57.000000Z",
    "twilio_sid": "ACf347fbae42ae345664585797d978c49c7e5a"
}

Error Responses

If you encounter errors when making a request, the response will contain an error code and an explanation for the error. The following error codes may be encountered.

401 Invalid Authorization
402 Missing required parameters
404 Resource not found
500 Unable to complete request
Error Response Example:
{
	'error_code' : 400,
	'error' : "The member could not be found."
}

Members

In Sendlio, members generally represent recipients that have engaged with your business. This could be through opening an email, clicking a link or interacting with content on your website. Member information gets automatically updated when you pull new info from your Data Sources, but you can also edit member data directly using the API.

GET /member

Search members

Search your audience for members who meet certain criteria. All parameters are optional.

Parameters:
Name Description Example
unique_id Single member unique id 4u31onkuiryo
email Email address steve@apple.com
phone Phone number +18051234567
ip Member's IP Address 103.234.323.45
city Member's city Los Angeles
region Member's state or province California
country Member's country US
timezone Member's timezone America/Los_Angeles
page Page number for pagination 1
Sample Response:
{
    "current_page": 1,
    "data": [
        {
            "id": 7,
            "unique_id": "4u31onkuiryo",
            "first_name": Jimmy,
            "last_name": Dean,
            "email": "jimmy@hotmail.com",
            "phone": "+18051234567",
            "created_at": "2021-04-02T16:13:02.000000Z",
            "updated_at": "2021-04-02T19:10:08.000000Z",
            "locations": [
                {
                    "id": 7,
                    "member_id": 7,
                    "ip": "104.244.131.69",
                    "city": "Los Angeles",
                    "region": "California",
                    "country": "US",
                    "timezone": "America/Los_Angeles",
                    "lat": "44.1512",
                    "lon": "-72.6565",
                    "created_at": "2021-04-02T16:17:54.000000Z",
                    "updated_at": "2021-04-03T18:14:16.000000Z"
                }
            ],
            "properties": [
                {
                    "id": 8,
                    "member_id": 7,
                    "name": "email_verified_at",
                    "value": "2021-04-02 12:20:19",
                    "created_at": "2021-04-02T18:16:03.000000Z",
                    "updated_at": "2021-04-02T18:16:03.000000Z"
                }
            ]
        }
    ],
    "first_page_url": "https://app.sendlio.com/api/v1/members?page=1",
    "from": 1,
    "last_page": 1,
    "last_page_url": "https://app.sendlio.com/api/v1/members?page=1",
    "next_page_url": null,
    "path": "https://app.sendlio.com/api/v1/members",
    "per_page": 15,
    "prev_page_url": null,
    "to": 1,
    "total": 1
}

POST /member

Create or Update a Member

You'll need to supply at least email or phone to create a new member. When you create a member, you can also pass in an array of custom properties to attach to the member. To update an existing member, pass in the unique_id parameter.

Parameters:
Name Description Example
unique_id Member's unique id (required when updating member) 26z37f4lunbw
email Member's email address (required if phone not provided) arnold@ilovegyms.com
phone Member's phone number (required if email not provided) +18051234567
first_name Member's first name Arnold
last_name Member's last name Palmer
properties[] Array of custom properties in key/value pairs. ['favorite_color' => 'green', 'nickname' => 'Crazy Eyes' ]
Sample Response:
{
    "id": 10,
    "unique_id": "26z37f4lunbw",
    "first_name": "Arnold",
    "last_name": "Palmer",
    "email": "arnold@ilovegyms.com",
    "phone": "+18051234567",
    "created_at": "2021-04-03T19:48:44.000000Z",
    "updated_at": "2021-04-03T19:48:44.000000Z",
    "locations": [],
    "properties": [
        {
            "id": 15,
            "member_id": 10,
            "name": "favorite_color",
            "value": "green",
            "created_at": "2021-04-03T19:48:44.000000Z",
            "updated_at": "2021-04-03T19:48:44.000000Z"
        },
        {
            "id": 16,
            "member_id": 10,
            "name": "nickname",
            "value": "Crazy Eyes",
            "created_at": "2021-04-03T19:48:44.000000Z",
            "updated_at": "2021-04-03T19:48:44.000000Z"
        }
    ]
}

POST /member/delete

Delete a Member

Use a member's unique_id to remove their data from Sendlio.

Parameters:
Name Description Example
unique_id Member's unique ID 4u31onkuiryo
Sample Response:
{
    "status": "success"
}

Campaigns

In Sendlio, campaigns represent a single message template, composed of blocks, that's set to be sent on a certain schedule. A campaign can be one of three types: email, sms or voice.

GET /campaign

Search campaigns

Search your campaigns. All parameters are optional.

Parameters:
Name Description Example
id Campaign ID (for a single campaign) 19
medium Medium of message. Can be email, sms or voice email
name Campaign name Welcome Email
subject Email subject Greetings!
audience_id ID of associated audience query 11
type Type of campaign. Can be onetime, recurring, hourly or every_minute onetime
schedule_hour Hour the campaign is scheduled for 2
schedule_min Minute the campaign is scheduled for 14
schedule_meridian Whether the scheduled time is am or pm pm
send_date Date the campaign should run if onetime
status whether campaign is enabled or stopped enabled
sunday through saturday Boolean values indicating if campaign should send on each day 1
page Page number for pagination 1
Sample Response:
{
    "current_page": 1,
    "data": [
        {
            "id": 19,
            "name": "Scheduling SMS",
            "subject": "Greetings",
            "audience_id": 11,
            "type": "onetime",
            "schedule_hour": 2,
            "schedule_min": 14,
            "schedule_meridian": "pm",
            "send_date": "2021-04-02",
            "status": "enabled",
            "created_at": "2021-03-20T02:05:31.000000Z",
            "updated_at": "2021-04-03T18:14:32.000000Z",
            "sunday": 1,
            "monday": 1,
            "tuesday": 1,
            "wednesday": 1,
            "thursday": 1,
            "friday": 1,
            "saturday": 1,
            "deleted_at": null,
            "spam_score": "0.0/5.0",
            "spam_response": "",
            "medium": "sms",
            "voice": "Polly.Joanna-Neural",
            "sends": 30,
            "opens": 57,
            "clicks": 0,
            "bounces": 0,
            "spam": 0,
            "sending_account": 0,
            "subject_block_id": 136,
            "subject_data": "",
            "blocks": [
                {
                    "id": 58,
                    "campaign_id": 10,
                    "query_id": 6,
                    "code": "Hey {{ @$recipient->first_name }}!\n\nIt's time for your checkup!\n\nAre you available to see Dr. Who at 3pm on Friday?\n\nReply YES to confirm",
                    "ordering": 1,
                    "created_at": "2021-02-22T18:49:55.000000Z",
                    "updated_at": "2021-03-29T15:15:49.000000Z"
                }
            ]
        }
    ],
    "first_page_url": "https://app.sendlio.com/api/v1/campaigns?page=1",
    "from": 1,
    "last_page": 1,
    "last_page_url": "https://app.sendlio.com/api/v1/campaigns?page=1",
    "next_page_url": null,
    "path": "https://app.sendlio.com/api/v1/campaigns",
    "per_page": 15,
    "prev_page_url": null,
    "to": 1,
    "total": 1
}

POST /campaign

Create or update a campaign

You can create email, sms and voice campaigns and easily update them from this endpoint. Pass in an array of blocks to build your campaign programatically.

Parameters:
Name Description Example
id Campaign ID (required if updating) 19
medium Medium of message. Can be email, sms or voice email
name Campaign name Welcome Email
subject Email subject Greetings!
audience_id ID of associated audience query 11
type Type of campaign. Can be onetime, recurring, hourly or every_minute onetime
schedule_hour Hour the campaign is scheduled for 2
schedule_min Minute the campaign is scheduled for 14
schedule_meridian Whether the scheduled time is am or pm pm
send_date Date the campaign should run if onetime
status whether campaign is enabled or stopped enabled
sunday through saturday Boolean values indicating if campaign should send on each day 1
blocks[] Array of blocks see table below

Block Structure:
Name Description Example
query_id ID of content query 3
code Block content. HTML for emails, plaintext for sms and voice. Hello, this is a message.
ordering Integer representing order of blocks 0
Sample Response:
{
    "id": 19,
    "name": "Scheduling SMS",
    "subject": "Greetings",
    "audience_id": 11,
    "type": "onetime",
    "schedule_hour": 2,
    "schedule_min": 14,
    "schedule_meridian": "pm",
    "send_date": "2021-04-02",
    "status": "enabled",
    "created_at": "2021-03-20T02:05:31.000000Z",
    "updated_at": "2021-04-03T18:14:32.000000Z",
    "sunday": 1,
    "monday": 1,
    "tuesday": 1,
    "wednesday": 1,
    "thursday": 1,
    "friday": 1,
    "saturday": 1,
    "deleted_at": null,
    "spam_score": "0.0/5.0",
    "spam_response": "",
    "medium": "sms",
    "voice": "Polly.Joanna-Neural",
    "sends": 30,
    "opens": 57,
    "clicks": 0,
    "bounces": 0,
    "spam": 0,
    "sending_account": 0,
    "subject_block_id": 136,
    "subject_data": "",
    "blocks": [
        {
            "id": 58,
            "campaign_id": 10,
            "query_id": 6,
            "code": "Hey {{ @$recipient->first_name }}!\n\nIt's time for your checkup!\n\nAre you available to see Dr. Who at 3pm on Friday?\n\nReply YES to confirm",
            "ordering": 1,
            "created_at": "2021-02-22T18:49:55.000000Z",
            "updated_at": "2021-03-29T15:15:49.000000Z"
        }
    ]
}

POST /campaign/delete

Delete a Campaign

Use a campaign's id to remove it from Sendlio.

Parameters:
Name Description Example
id Campaign's id 35
Sample Response:
{
    "status": "success"
}

Queries

In Sendlio, queries represet audiences, content collections and delivery events. Queries are how Sendlio talks to your Data Sources. Queries are composed of either raw SQL or a series of clauses to be used via the visual query builder.

GET /query

Search queries

Find the queries you're looking for. All parameters are optional.

Parameters:
Name Description Example
id Query ID (for a single query) 2
connection_id The Data Source id 19
name Query name Engaged Customers
type Can be audience, content or event audience
db_table The database table to query users
use_raw Whether query should use raw SQL. Can be 0 or 1 0
raw_query SQL Query select * from users;
order_column Column name or random id
order_direction asc or desc asc
limit Number of results to return 5
campaign_id Campaign query applies to. Can be campaign's id or 0 for all campaigns. 0
event_type If type is set to event, event_type determines which events should trigger this query to run. Valid values are send, open, click, spam, bounce, sms_reply, sms_send, sms_open, sms_bounce, voice_send bounce
page Page number for pagination 1
Sample Response:
{
    "current_page": 1,
    "data": [
        {
            "id": 3,
            "connection_id": 1,
            "name": "Recent Articles",
            "type": "content",
            "db_table": "articles",
            "use_raw": 0,
            "raw_query": null,
            "order_column": "random",
            "order_direction": "asc",
            "limit": 5,
            "created_at": "2021-02-12T17:46:56.000000Z",
            "updated_at": "2021-03-20T01:43:14.000000Z",
            "event_type": "bounce",
            "campaign_id": 0,
            "deleted_at": null,
            "results_count": 5,
            "clauses": [
                {
                    "id": 4,
                    "query_id": 3,
                    "type": "and",
                    "column": "date",
                    "operator": ">",
                    "value": "30 days ago",
                    "is_time": 1,
                    "created_at": "2021-02-12T17:47:05.000000Z",
                    "updated_at": "2021-03-19T12:04:20.000000Z"
                }
            ]
        }
    ],
    "first_page_url": "https://app.sendlio.com/api/v1/query?page=1",
    "from": 1,
    "last_page": 1,
    "last_page_url": "https://app.sendlio.com/api/v1/query?page=1",
    "next_page_url": null,
    "path": "https://app.sendlio.com/api/v1/query",
    "per_page": 15,
    "prev_page_url": null,
    "to": 1,
    "total": 1
}

POST /query

Create or Update a Query

Create a new query or update an existsing one.

Parameters:
Name Description Example
id Query id (required when updating query) 14
connection_id The Data Source id 19
name Query name Engaged Customers
type Can be audience, content or event audience
db_table The database table to query users
use_raw Whether query should use raw SQL. Can be 0 or 1 0
raw_query SQL Query select * from users;
order_column Column name or random id
order_direction asc or desc asc
limit Number of results to return 5
campaign_id Campaign query applies to. Can be campaign's id or 0 for all campaigns. 0
event_type If type is set to event, event_type determines which events should trigger this query to run. Valid values are send, open, click, spam, bounce, sms_reply, sms_send, sms_open, sms_bounce, voice_send bounce
clauses[] Array of clauses see table below

Clause Parameters:
Name Description Example
type and or or and
column Database column to query. date
operator Can be =, <>, <, >, contains, not_contains, empty, not_empty, contains
value The value of the column 30 days ago
is_time Whether to interpret value as time. Can be 0 or 1. 1
Sample Response:
{
    "id": 16,
    "connection_id": 1,
    "name": "People named Bill",
    "type": "audience",
    "db_table": "users",
    "use_raw": 0,
    "raw_query": null,
    "order_column": null,
    "order_direction": "asc",
    "limit": 0,
    "created_at": "2021-04-03T23:11:51.000000Z",
    "updated_at": "2021-04-03T23:11:51.000000Z",
    "event_type": "bounce",
    "campaign_id": 0,
    "deleted_at": null,
    "results_count": 0,
    "clauses": [
        {
            "id": 30,
            "query_id": 16,
            "type": "and",
            "column": "first_name",
            "operator": "contains",
            "value": "Bill",
            "is_time": 0,
            "created_at": "2021-04-03T23:11:51.000000Z",
            "updated_at": "2021-04-03T23:11:51.000000Z"
        }
    ]
}

POST /query/delete

Delete a Query

Use a query's id to remove it from Sendlio.

Parameters:
Name Description Example
id Query ID 19
Sample Response:
{
    "status": "success"
}