Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

UA

image-20240611-123449.png

US

image-20240611-123805.png

RU

image-20240611-131051.png

API (Application Programming Interface) is a tool that allows your applications, websites, and CRM to "communicate" and exchange data with the Leeloo.ai platform. With the API, you can retrieve information about your clients, send client data (offers) to a table, integrate online payment or delivery systems, without requiring complex or costly development.

Introduction to API Usage

Headers request

When making requests to Leeloo.AI , you need to use Headers. Add “Request Header” in “Key,” enter
X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

ksnip_20241007-153954.png

Where to Find the API Token?

The API token can be found in the Leeloo.ai API section on the platform. It is necessary for authenticating requests to the API, confirming that requests come from an authorized user.

ksnip_20241007-154452.png

Types of Requests

The platform provides various types of requests that can be used for integration with external systems:

  • GET: to retrieve data. Requests information from the API

  • POST: to submit data (e.g., registering a new user).

  • PUT: to update existing data.

ksnip_20241007-154525.png

Using Variables and Custom Fields

Variables can be created in Content → Variables.
Custom fields can be created in Content → Fields.

You can insert variables and custom fields into the request body if dynamic data transfer is required. For example, to send user or order status information, include variables in the request fields for transmitting individual information.

ksnip_20241007-154904.png

List of System IDs (Variables) Available on the Platform:

  • category_id - the ID of the message template category. This category_id is found in the URL when opening the template category in Sales Funnels, Message Templates.
    Example - https://app.leeloo.ai/campaigns-templates/category_id/templates

  • account_id - the ID from the client card in the Chats section.
    Example - https://app.leeloo.ai/chats/unread/account_id/5e60191da0fd4a000d3998bc/

  • template_id - the message template ID on the platform, available from the message template created in the template category.
    Example - https://app.leeloo.ai/campaigns-templates/category_id/templates/creator/template_id

  • person_id - the communication channel ID found in the client link in Chats.
    Example - https://app.leeloo.ai/chats/all/account_id/person_id

  • leadgentool_id - the ID of the Lead Generation Tool (LGT) from your created LGT in the sales funnel. Right-click on it, then “Copy LGT ID

  • paymentCreditsId - the payment system ID. You can find it in the platform settings under Payments by clicking “Details” on the connected payment.
    Example - https://app.leeloo.ai/settings/integrations/payments/credits/payment-credit/manual/paymentCreditsId

  • offerId - the Offer ID taken from the Offers you created in the Sales Funnel section.
    Example - https://app.leeloo.ai/campaigns-offers/offerId/offers/1

  • managerId - the manager (user) ID added to the platform through the Users section. Click on the created user and copy the ID from the link.
    Example - https://app.leeloo.ai/settings/company/users/user/managerId

  • order_id - the order ID, which is generated when your offer changes to an order status. This ID can be obtained by performing the “Get Order List” request, which includes information about the order, including the order ID.
    Example - "{"data":[{"id":"order_id","person_id":"person_i","title":"Курс9","price":20,"currency":"USD","status":"REJECTED","createdAt":"2024-10-03T08:00:02.853Z","updatedAt":"2024-10-03T15:25:49.028Z"},

  • user_id - the user ID (Subscriber) within the audience. It can be obtained by performing the “Get Platform User List” request, which includes information about the user ID.
    Example - "{"data":{"id":"user_id","name":"Andrew","createdAt":"2024-02-21T12:32:55.085Z","updatedAt":"2024-10-07T06:42:52.631Z"},"status":1}"

  • tunnel_id - the sales funnel ID. Obtainable by navigating to your sales funnel and copying from the address bar.
    Example - https://app.leeloo.ai/tunnels/tunnel_id/tree

  • tunnel_block_id - the ID of a block in the sales funnel. Obtainable by navigating to your sales funnel, clicking on the block, and copying it from the address bar.
    Example - https://app.leeloo.ai/tunnels/tunnel_id/tree/tunnel_block_id

  • connection_id - the communication channel ID. Obtainable by performing a request for user information or specific user information. Example from the “Get Specific Person Information” request:
    Example -
    {
    "account_id": "account_id",
    "connection_id": "connection_id",
    "connection_status": "OK",
    "from": "TELEGRAM"
    }

  • tag_id - the Tag ID assigned to users (subscribers). Obtainable by navigating to Platform Settings, CRM Settings, Tags, and clicking “Copy ID” next to the created tag.

  • In all requests, the date must be specified in UTC-0 time zone.

  • All requests that involve a Body should be sent in JSON format

Message Templates

Retrieve the List of Message Template Categories

GET https://api.leeloo.ai/api/v2/categories/templates

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

"data": {
        "categories": [
            {
                "id": "5e3bf3fdb70492000f72cd6c",
                "name": "Category 1"
            },
            {
                "id": "5e18a2a3ed0b7a000d6c948f",
                "name": "Category 2"
            }
        ]
    },
    "status": 1
}

Retrieve the List of Message Templates Within a Category

GET https://api.leeloo.ai/api/v2/categories/templates/{category_id}

Path Params
category_id (example: 5b3f543bb2737000133d25b0) - Message Template Category ID
This category_id can be found in the URL when opening the template category in the Sales Funnels, Message Templates section.
Example: https://app.leeloo.ai/campaigns-templates/categoty_id/templates

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

{
    "data": {
        "templates": [
            {
                "id": "5e42be758d4fff000cafe6ef",
                "message_name": "test template 2"
            },
            {
                "id": "5e42be688d4fff000cafe5cc",
                "message_name": "test template 1"
            }
        ]
    },
    "status": 1
}

Sending a Message Template

POST https://api.leeloo.ai/api/v2/messages/send-template

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body(json)
account_id (example: 513f543gb2737020133d25b0) - The communication channel ID can be found in the client card link under the Chats section.
Example: https://app.leeloo.ai/chats/unread/account_id/5e60191da0fd4a000d3998bc/
template_id (example: 6b3f543bb2737003133d25b4) - The message template ID is available on the platform within the created message template.

{
  "account_id": "66fac2b853d5123567d207b7",
  "template_id": "65fc3f2656789099e157e817",
  "variables": {
    "key1": "value1",
    "key2": "value2"
  }
}

Response

{
    "status": 1,
    "data": {}
}Запрос

Messages

Retrieve a List of Messages from a Chat by Communication Channel

GET https://api.leeloo.ai/api/v2/communication-channels/{person_id}/chat-messages?limit=2&offset=0

Path Params
person_id (example: 5b3f543bb2737000133d25b0) - The communication channel ID can be found in the client link under the Chats section.
Example: https://app.leeloo.ai/chats/all/66fac2b853d5470e1ed207b6/person_id

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Query Params
limit - Limit on the Number of Results: It is not recommended to retrieve large amounts of data at once, as this may slow down data export.
offset - Offset (Default 0): Specify how many results to skip.

Response

{
    "data": [
          {
          "id": "5e3bf8d6c6ed91000c8534ae",
          "text": "Test API v.1 message template",
          "type": "YOUR_MESSAGE",
          "read": true,
          "createdAt": "2020-02-06T11:30:30.035Z",
          "updatedAt": "2020-02-06T11:30:30.035Z"
          },
          {
          "id": "5e3beba47fa862000e3b4d05",
          "text": "API message",
          "type": "YOUR_MESSAGE",
          "read": true,
          "createdAt": "2020-02-06T10:34:12.230Z",
          "updatedAt": "2020-02-06T10:34:12.230Z"
          }
    ],
    "meta": {
          "limit": 3,
          "offset": 0,
          "filteredCount": 3,
          "totalCount": 52
    },
    "status": 1
}

IMPORTANT! An example response to the request is shown with the limit parameter set to two. If the limit parameter value is changed, the number of messages in the response will also change accordingly.

Sending Messages

POST https://api.leeloo.ai/api/v2/messages/send-message

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body(json)
account_id (example: 5b3f543bb2737000133d25b0) - The ID of the communication channel.
text - The text of the message you want to send.

{
    "account_id": "5b3f543bb2737000133d25b0",
    "text": "текст сообщения"
}

Response

{
    "status": 1,
    "data": {}
}

Communication Channels

Retrieve the List of Communication Channels (with external UTM tags)

GET https://api.leeloo.ai/api/v2/communication-channels?limit=20&offset=0&filter[last_message][from]=2020-02-10&filter[last_message][to]=2020-04-14

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Query Params
limit - Limit on the Number of Results. It is not recommended to retrieve large amounts of data at once, as this may slow down data export.
offset - Specify how many results to skip.
filter[last_message][from] - Filter by Last Message From a Specified Date

filter[last_message][to] - Filter by Last Message Up to a Specified Date

Response

{
    "data": [
        {
            "id": "5ef074e9e31801000d73ba11",
            "person_id": "5ef074e9e31801000d73ba10",
            "name": "TIIIIK",
            "from": "TELEGRAM",
            "botStatus": "BOT",
            "lastMessageTime": "2020-08-31T07:55:53.865Z",
            "createdAt": "2020-06-22T09:07:53.351Z",
            "utmMarks": {
                "utm_source": "test_UTM_mark"
            }
        },
        {
            "id": "5ea177b8ac8f55000d2c68f1",
            "person_id": "5ea177b8ac8f55000d2c68f0",
            "name": "Adolf Shtangencirkul",
            "from": "VKONTAKTE",
            "botStatus": "BOT",
            "lastMessageTime": "2020-08-29T08:31:51.211Z",
            "createdAt": "2020-04-23T11:10:48.337Z",
            "utmMarks": {}
        }
    ],
    "meta": {
        "limit": 2,
        "offset": 0,
        "filteredCount": 2,
        "totalCount": 2
    },
    "status": 1
}

Retrieve Communication Channel List

GET https://api.leeloo.ai/api/v2/connections

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

{
    "data": {
        "connections": [
            {
                "id": "65cf48536d81f496d4f9a673",
                "type": "telegram",
                "name": "Telegram bot"
            },
            {
                "id": "65b3791a9af7b6ef6f4a8afd",
                "type": "sendGrid",
                "name": "Sendgrid bot"
            }
        ]
    },
    "status": 1
}


Retrieve Person Information by Communication Channel (retrieve person_id using the account_id parameter)

GET https://api.leeloo.ai/api/v2/communication-channels/{account_id}/person 

Path Params
account_id (example: 5b3f543bb2737000133d25b0) - Communication Channel ID

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

{
    "data": {
        "id": "617fd5cc1cc06d2ae24dd9eb",
        "name": "Mark Down",
        "tags": [
            "Tag 26"
        ],
        "profileImage": "https://static.leeloo.ai/images/5e18a2a3ed0b7a000d6c9446/abd88bd0-3b0a-11ec-82ee-bb08992a1760%5B571x1100%5Djpg",
        "gender": "OTHER",
        "phone": "+380977751199",
        "email": "useremail@gmail.com",
        "locale": "ru_RU",
        "accounts": [
            {
                "account_id": "617fd5cc1cc06d42c94dd9ec",
                "connection_id": "61308ac5d087cbc40f1e478d",
                "connection_status": "OK",
                "from": "FACEBOOK"
            }
        ],
        "subscribeHistory": [
            {
                "tunnelName": "for list",
                "leadgentoolName": "New LGT",
                "trafficSource": "Default traffic source",
                "tunnelId": "617fa515557acb4a2472c560",
                "leadgentoolId": "617fa612925d13644ae58e55",
                "trafficSourceId": "617fa612925d1341eee58e58",
                "accountId": "617fd5cc1cc06d42c94dd9ec"
            }
        ],
        "links": {
            "contactedUsers": [
                {
                    "type": "users",
                    "id": "60509800acc5ae000d74ce21"
                }
            ],
            "orders": [
                {
                    "type": "orders",
                    "id": "618280605402c96fa86c125a"
                }
            ]
        },
        "custom_fields": [],
        "created_at": "2021-11-01T11:55:56.358Z",
        "updated_at": "2024-02-02T12:07:54.882Z"
    },
    "included": {},
    "status": 1
}

LGT

Create a Traffic Source in LGT

POST https://api.leeloo.ai/api/v2/leadgentools/{leadgentool_id}/create-traffic-source

Path Params
leadgentool_id (example: 5b3f543bb2737000133d25b0) - The ID of the lead generation tool

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body (json)
name - The name of the traffic source
description - A description of the traffic source

{
    "name": "some ts",
    "description": "some ts description"
}

Response

{
  "data": {
        "type": "normal",
        "fb_adset_id": null,
        "name": "some ts",
        "description": "some ts description",
        "synchronized_with_fb": false,
        "synchronization_error": false,
        "disabled": false,
        "company_id": "5b9f63e3d244d2000e27692f",
        "leadgentool_id": "5e1f119d6c384804b31e945e",
        "tunnel_id": "5e1f11566c384804b31e9457",
        "created_by": "5b9f63e3d244d2000e276957",
        "hash": "nn7n15",
        "resubscribe_button_id": "5e32d0ed28faf61fc396f6b1",
        "createdAt": "2020-01-30T12:49:49.273Z",
        "updatedAt": "2020-01-30T12:49:49.273Z",
        "id": "5e32d0ed28faf61fc396f6b0"
  },
  "status": 1
}

Orders

Create a Manual Order

POST https://api.leeloo.ai/api/v2/orders

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body(json)
paymentCreditsId (example: 5b3f543bb2737000133d25b2) - Payment System ID: Obtainable in the platform settings under the payment systems section.
email - The email address of the person
phone - The phone number of the person.
transactionDate - The date for the transaction to display on the platform, in the format 2020-02-04T11:46:48.803Z
offerId (example: 5b3f543bb2737000133d25b0) - The ID of the offer
isNotifyAccount - Notify Person About Order Creation: Set to true or false depending on whether you want to notify the person.
personId (example: 5b3f543bb2737000133d25b1) - The ID of the person.
managerId (example: 5b3f543bb2737000133d25b0) - Platform User ID Assigned to the Order (Optional): If not specified, the sale will be assigned to "System."

{
    "paymentCreditsId": "5e3c3533f04b1f000c27b534",
    "email": "email123@gmail.com",
    "phone": "+380669999777",
    "transactionDate": "2020-02-04T11:46:48.803Z",
    "offerId": "5e3c357bf04b1f000c27b83a",
    "isNotifyAccount": "false",
    "personId": "5e1c4676b70fb2001279c268",
    "managerId": "5e1c1236b70fb3331279c444"
}

Response

{
    "data": {
          "id": "5e5502a01b1668000ccc93ee",
          "title": "Ручной оффер",
          "price": 100,
          "currency": "USD",
          "status": "OPENED",
          "createdAt": "2020-02-25T11:18:56.419Z",
          "updatedAt": "2020-02-25T11:18:56.419Z"
      },
    "status": 1
}

Retrieve Order List

GET https://api.leeloo.ai/api/v2/orders?limit=20&offset=0

Query Params
limit - Limit on the Number of Results: It is not recommended to retrieve large amounts of data at once, as this may slow down data export.
offset - Specify how many results to skip

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

{
    "data": [
        {
            "id": "5e399d72a2d0e2000dd584c1",
            "person_id": "5df0fac42121a5000e07d80b",
            "title": "manual offer",
            "price": 200,
            "currency": "USD",
            "status": "RESOLVED",
            "createdAt": "2020-02-04T16:36:02.213Z",
            "updatedAt": "2020-02-04T16:38:58.168Z"
        }],
    "meta": {
        "limit": 1,
        "offset": 0,
        "filteredCount": 20,
        "totalCount": 93
    },
    "status": 1
}

Retrieve Information on a Specific Order

GET https://api.leeloo.ai/api/v2/orders/{order_id}

Path Params
order_id (example: 5b3f543bb2737000133d25b0) - The ID of the specific order

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

{
    "status": 1,
    "data": {
        "id": "5e2825e081fbca000d8596e4",
        "createdAt": "2015-04-02T14:20Z",
        "updatedAt": "2015-04-02T14:20Z",
        "title": "Title11",
        "description": "Description1",
        "price": 100,
        "currency": "UAH", //['USD', 'EUR', 'UAH', 'RUB']
        "status": "SUCCESS", //['ORDER', 'PENDING', 'FAILED', 'SUCCESS', 'REFUNDED'],
        "paymentMethod": "WAYFORPAY", //['WAYFORPAY', 'YANDEX_MONEY', 'ASSET_PAYMENT', 'MANUAL']
    }
}

Update Information in a Manual Order

Order Cannot Have Partial Payments

POST https://api.leeloo.ai/api/v2/orders/{order_id}

Path Params
order_id (example: 5b3f543bb2737000133d25b0) - Manual Order ID Without Partial Payments

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body (form-data)
status example: 'RESOLVED', (one_of: RESOLVED REJECTED)
paymentDate example: '2018-06-27 07:32',
currency example: 'RUB',
price example: '100' (actual price that you receive from account),
userComments example: 'actual date dont match'

Response

{
    "data": {
        "id": "5b3f608db2737000133d25b6"
      },
    "status": 1
}

Subscribers

Retrieve List of All Subscribers

GET https://api.leeloo.ai/api/v2/people?limit=20&offset=100&filter[tags]=vip&filter[tags]=tag2&filter[last_message][from]=2015-04-02&filter[last_message][to]=2015-04-03&filter[phone]=+380966565556&filter[email]=feliks@gmail.com

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Query Params
limit - Limit on the Number of Results: It is not recommended to retrieve large amounts of data at once, as this may slow down data export.
offset - Specify how many results to skip
filter[tags] - filter by specific tags if needed. Optional
filter[last_message] { from: 'js_date', to: 'js_date' } - Mandatory, filter based on the date of the last message.
filter[phone] - filter by phone number if needed. Optional.
filter[email] - filter by email if needed. Optional.

Response

{
    "status": 1,
    "data": [{
        "id": "5e1c7ce2b4066a01900cdba0",
        "name": "Feliks",
        ”email": ”feliks@gmail.com",
        ”phone": ”+380966565556"
        "tags": [
            "Mentor",
            "Professional"
            ],
        "accounts": [{
              "account_id": "5e1c7ce2b4066a01900cdba1",
              "connection_id": "5e1c7afcb4066a01900cdb8c",
              "connection_status": "OK",
              "from": "TELEGRAM"
              }],
        "lastMessageTime": "2020-01-13T14:21:36.462Z"
      }],
    "meta": {
    "totalCount": 1,
    "filteredCount": 1,
    "limit": 20,
    "offset": 0
    }
}

Retrieve Information on a Specific Person

GET https://api.leeloo.ai/api/v2/people/{person_id}?include=contactedUsers,orders

Path Params
person_id (example: 5b3f543bb2737000133d25b0) - The ID of the person

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

{
    "data": {
        "id": "625946dd585052c1629f1b2b",
        "name": "Mark Spenser",
        "tags": [],
        "profileImage": "NOT_DEFINED",
        "gender": "NO_DATA",
        "phone": "+380977451111",
        "email": "Ray37@hotmail.com",
        "locale": "",
        "accounts": [
            {
                "account_id": "625946dd58505225f49f1b2c",
                "connection_id": "5e1edc3f18fc56000c0159b3",
                "connection_status": "OK",
                "from": "TELEGRAM"
            }
        ],
        "subscribeHistory": [
            {
                "tunnelName": "Default tunnel",
                "leadgentoolName": "Default leadgentool",
                "trafficSource": "Default traffic source",
                "tunnelId": "5e18a2a3ed0b7a000d6c9484",
                "leadgentoolId": "5e18a2a3ed0b7a000d6c9486",
                "trafficSourceId": "5e18a2a3ed0b7a000d6c9488",
                "accountId": "625946dd58505225f49f1b2c"
            }
        ],
        "links": {
            "contactedUsers": [
                {
                    "type": "users",
                    "id": "60509800acc5ae000d74ce21"
                }
            ],
            "orders": [
                {
                    "type": "orders",
                    "id": "65cf58ba1261175f8d40a75f"
                }
            ]
        },
        "custom_fields": [
            {
                "type": "PHONE",
                "name": "phone",
                "value": "+48881644207"
            }
        ],
        "created_at": "2022-04-15T10:20:13.546Z",
        "updated_at": "2024-02-16T16:16:57.065Z"
    },
    "included": {
        "users": [
            {
                "id": "60509800acc5ae000d74ce21",
                "name": "Max",
                "createdAt": "2021-03-16T11:35:28.644Z",
                "updatedAt": "2024-02-19T12:59:04.460Z"
            }
        ],
        "orders": [
            {
                "id": "65cf58ba1261175f8d40a75f",
                "title": "for API",
                "price": 100,
                "currency": "USD",
                "status": "OPENED",
                "updatedAt": "2024-02-16T12:44:42.569Z"
            }
        ]
    },
    "status": 1
}

Update Information in a Client Card

PUT https://api.leeloo.ai/api/v2/people/{person_id}

Path Params
person_id (example: 5b3f543bb2737000133d25b0) - The ID of the person

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body(json)

{
    "phone": "+380669991876",
    "email": "newmail@gmail.com",
    "custom_fields": [
        {
            "type": "EMAIL", 
            "name": "emailcust",
            "value": "customemail@gmail.com"
        }
    ]
}

Add a Person to the Platform

POST https://api.leeloo.ai/api/v2/people

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body (json)

{
    "name":"Feliks",
    "email":"feliks@gmail.com",
    "phone":"+380953066789",
    "leadgentool_id":"609290d3e060416cdea6823e",
    "connected_users_ids": ["609290d3e060416cdea68444"]
}

Response

{
    "data": {
        "id": "60a4bcd7bc45b806ac3b1a4a",
        "person_id": "60a4bcd7bc45b83b6e3b1a49",
        "name": "Feliks",
        "tags": [],
        "from": "MANUAL",
        "botStatus": "BOT",
        "connectionStatus": "OK",
        "gender": "NOT_DEFINED",
        "phone": "+380953066789",
        "email": "feliks@gmail.com",
        "locale": "",
        "subscribeHistory": [],
        "createdAt": "2021-05-19T07:23:03.546Z",
        "updatedAt": "2021-05-19T07:23:03.546Z"
    },
    "status": 1
}

Add SMS Connection to a Person

POST https://api.leeloo.ai/api/v2/people/sms

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body(json)

{
    "data": [{
          "name": "test123",
          "email": "test123@example.com",
          "phone": "+380667772233"
      }],
    "connection_id": "5dbfe6c5fb73e101720b3dc7",
    "leadgentool_id": "5e1f119d6c384804b31e945e",
    "tags": ["5cf7a18586236d000b1256b2"]
}

Response

{
    "data": {
        "count_to_process": 1
        },
    "status": 1
}

Add a Comment to a Person

PUT https://api.leeloo.ai/api/v2/people/{person_id}/add-comment

Path Params
person_id (example: 5b3f543bb2737000133d25b0) - The ID of the person

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body(json)

{
  "comment": "some text"
}

Response

{
    "data": {
        "created_by": "5b9f63e3d244d2000e276957",
        "company_id": "5b9f63e3d244d2000e27692f",
        "text": "some text",
        "entity_id": "5da5998fcecdb311d73d3049",
        "entity_type": "PERSON",
        "created_at": "2020-01-30T10:08:50.677Z",
        "updated_at": "2020-01-30T10:08:50.677Z",
        "id": "5e32ab3228faf61fc396f625"
    },
    "status": 1
}

Add a Call to the Client Card

POST https://api.leeloo.ai/api/v2/calls

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body(form-data, all required)
user_id example: ‘5b0d313b307879002915b3cc’
from example: ‘606'
to example: ‘607'
date example: ‘2024-03-22T15:30:17.339Z'
account_id example: '6b0d313b307879002915b3c1’
record_link example: 'https://file-examples.com/storage/2017/11/file_example_MP3_5MG.mp3’ or 'NOT_DEFINED’
status example: 'SUCCESS' (one of: 'TALKING', 'SUCCESS', 'NO_ANSWER', 'CLOSED_BY_SYSTEM')
duration example: '100' (seconds)
type example: INBOUND or OUTBOUND

{
  "user_id": "65d5ed778c9636bd775f715b",
  "from": "606",
  "to": "607",
  "date": "2024-03-22T15:30:17.339Z",
  "account_id": "66fac2b853d5472551d207b7",
  "record_link": "https://file-examples.com/storage/2017/11/file_example_MP3_5MG.mp3",
  "status": "SUCCESS",
  "duration": 100,
  "type": "INBOUND"
}

Response

{
  "data": {
    "raw_response": {},
    "record_link": "https://file-examples.com/storage/fe7c2cbe4b65fa8179825d1/2017/11/file_example_MP3_5MG.mp3",
    "company_id": "5b9f63e3d244d2000e27692f",
    "user_id": "5b9f63e3d244d2000e276930",
    "account_id": "65b632d119471a0012c3cabd",
    "provider_type": "MANUAL",
    "to": "+380663332222",
    "from": "123",
    "type": "OUTBOUND",
    "status": "SUCCESS",
    "telephone_connection_id": "603e5096c4a05c3a9506f219",
    "call_id": "57fa99e0-e846-11ee-b73a-95e863e509cb",
    "billsec": 140,
    "created_at": "2024-03-22T12:00:36.980Z",
    "updated_at": "2024-03-22T12:00:36.980Z",
    "next_check": "2024-03-22T12:19:51.650Z",
    "id": "65fd772be3f8780013eac6b0"
  },
  "status": 1

Tags

Retrieve Tag List

GET https://api.leeloo.ai/api/v2/tags

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

{
    "status": 1,
          "data": [{
              "id": "595f5d522a934035decc093d",
              "name": "Tag #1",
    }]
}

Remove Tag from a Person

PUT https://api.leeloo.ai/api/v2/people/{person_id}/remove-tag

Path Params
person_id (example: 5b3f543bb2737000133d25b0) - The ID of the person

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body
tag_id - Copy the ID from Settings > Tags (Copy ID)

{
  "tag_id": "6685097a2e425c44fb9ae2e6"
}

Response

{
    "status": 1,
    "data": {}
}

Add Tag to a Person

PUT https://api.leeloo.ai/api/v2/people/{person_id}/add-tag

Path Params
person_id (example: 5b3f543bb2737000133d25b0) - The ID of the person

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body(form-data)
tag_id - Copy the ID from Settings > Tags (Copy ID)

{   
"tag_id": "6685097a2e425c44fb9ae2e6"
 }

Response

{
    "status": 1,
    "data": {}
}

Sales Tunnels

Retrieve Sales Tunnel List

GET https://api.leeloo.ai/api/v2/tunnels?limit=20&offset=0

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Query Params
limit - Limit on the Number of Results: It is not recommended to retrieve large amounts of data at once, as this may slow down data export.
offset - Specify how many results to skip.

Response

{
    "status": 1,
    "data": [{
          "id": "595f5d522a934035decc093d",
          "name": "My tunnel",
          "createdAt": "2015-04-02T14:20Z",
          "updatedAt": "2015-04-02T14:20Z",
    }],
    "meta": {
          "totalCount": 1,
          "filteredCount": 1,
          "limit": 20,
          "offset": 0
    }
}

Retrieve Information on a Specific Sales Tunnel

GET https://api.leeloo.ai/api/v2/tunnels/{tunnel_id}?include=leadgentools

Path Params
tunnel_id (example: 5b3f543bb2737000133d25b0) - tunnel id

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

{
    "status": 1,
    "data": {
        "id": "595f5d522a934035decc093d",
        "name": "My tunnel",
        "createdAt": "2015-04-02T14:20Z",
        "updatedAt": "2015-04-02T14:20Z",
        "links": {
            "leadgentools": [{
                        "type": "leadgentools",
                        "id": "222f5d522a934035decc093d" }]
        }
    },
    "linked": {
        "leadgentools": [{
            "id": "222f5d522a934035decc093d",
            "name": "LGT1",
            "type": "LINK", //['LINK', 'QR', 'WIDGET', 'POPUP', 'FORM', 'FB_AD', 'DEFAULT']
          }]
    }
}

Retrieve Statistics for All Sales Tunnels

GET https://api.leeloo.ai/api/v2/tunnels/stats

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

{
    "status": 1,
    "data": [{
          "subscribers": 10,
          "uniqSubscribers":2,
          "orders": 4,
          "sales": 3,
          "uniqSales": 2
          "visits": 14,
          "uniqVisits": 5
          "shows": 5,
          "uniqShows": 3
          "totalSale": 200, // in USD
          "totalExpenses": 100
      }]  
}

Retrieve Statistics for a Specific Sales Tunnel


GET https://api.leeloo.ai/api/v2/tunnels/{tunnel_id}/stats

Path Params
tunnel_id (example: 5b3f543bb2737000133d25b0) - tunnel id

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

{
    "status": 1,
    "data": [{
        "subscribers": 10,
        "uniqSubscribers":2,
        "orders": 4,
        "sales": 3,
        "uniqSales": 2
        "visits": 14,
        "uniqVisits": 5
        "shows": 5,
        "uniqShows": 3
        "totalSale": 200, // in USD
        "totalExpenses": 100
      }]
}

Subscribe to a Sales Tunnel and Specific Tunnel Block

POST https://api.leeloo.ai/api/v2/communication-channels/{account_id}/manual-subscribe

Path Params
account_id - Communication Channel ID

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Request Body (form-data)
tunnel_id (example: 5b3f543bb2737000133d25b0) - tunnel id
tunnel_block_id (example: 5b3f543bb2737000133d25b0) - block id in tunnel

{
    "tunnel_id": "66fabfc013ed14bf97f0d897",
    "tunnel_block_id": "66fabfc013ed14cddff0d8a9"
}

Response

{
  "status": 1,
  "data": {}
}

Users

Retrieve Platform User List

GET https://api.leeloo.ai/api/v2/users?limit=20&offset=0

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Query Params
limit - Limit on the Number of Results. It is not recommended to retrieve large amounts of data at once, as this may slow down data export.
offset - Offset (Default 0): Specify how many results to skip.

Response

{
    "status": 1,
    "data": [
        {
        "id": "445f5d522a934035decc093d",
        "name": "Igor",
        "createdAt": "2015-04-02T14:20Z",
        "updatedAt": "2015-04-02T14:20Z",
        },
        {
        "id": "125f5d522a934035decc093d",
        "name": "Alexey",
        "createdAt": "2015-04-02T14:20Z",
        "updatedAt": "2015-04-02T14:20Z",
        }
      ],
    "meta": {
        "totalCount": 1,
        "filteredCount": 1,
        "limit": 20,
        "offset": 0
      }
}

Retrieve Information on a Specific Platform User

GET https://api.leeloo.ai/api/v2/users/{user_id}

Path Params
user_id - Platform User ID

IMPORTANT: In Headers, add “Request Header.” In “Key,” enter X-Leeloo-AuthToken, and in “Value,” insert your Leeloo.ai API token.

Response

{
    "data": {
        "id": "632af797bd3cc466fe1af584",
        "name": "John Mack",
        "createdAt": "2022-09-21T11:37:59.353Z",
        "updatedAt": "2022-09-27T12:26:12.786Z"
    },
    "status": 1
}
  • No labels