Zenedu API

Zenedu API documentation

Updated over a week ago

Introduction

In this documentation, you will learn how to use Zenedu's REST API to integrate our platform with other services
โ€‹
The API is based on the HTTP protocol and all responses are returned in JSON format. All requests must have Accept: application/json key-value in headers.

Base URL

The base URL for all API endpoints is: https://app.zenedu.io/api/v1/

All requests must have Accept: application/json key-value in headers.

Authentication

The Zenedu API uses Bearer token authentication to ensure secure access to protected endpoints. To interact with the API, you must include an authorization header with each request.

Obtaining an API Token

To obtain your API token, navigate to the API section in your account page. The token is generated during registration and remains valid indefinitely.
โ€‹
It is of utmost importance not to expose your API token in publicly accessible code or repositories. If you suspect any compromise of your API token, reset it immediately and acquire a new one through the same page.

Making Authenticated Requests

Once you have obtained your API token, include it in your requests using the Authorization header. Set the value of the header to Bearer YOUR_API_TOKEN.

Example request:

curl -X GET "https://app.zenedu.io/api/v1/endpoint" -H "Accept: application/json" -H "Authorization: Bearer YOUR_API_TOKEN"


Endpoints

Bots

Description

Retrieve a list of all your bots using this endpoint.

  • URL: https://app.zenedu.io/api/v1/bots

  • Method: GET

  • Authentication: Bearer token in headers

  • Parameters: None

  • Results: The list of bots is sorted in descending order by creation date.

Example request

curl -X GET "https://app.zenedu.io/api/v1/bots" -H "Accept: application/json" -H "Authorization: Bearer YOUR_API_TOKEN"

Example response

{
"data": [
{
"id": 2,
"name": "Test Bot 2",
"username": "test_bot_2",
"is_active": true,
"created_at": "2023-07-24T07:58:52.000000Z"
},
{
"id": 1,
"name": "Test Bot",
"username": "test_bot",
"is_active": true,
"created_at": "2023-06-23T09:41:34.000000Z"
}
]
}

Subscribers

Description

Get a list of all your subscribers for given bot using this endpoint. The results are paginated with 30 items per page.

  • URL: https://app.zenedu.io/api/v1/bot/{botId}/subscibers

  • Method: GET

  • Authentication: Bearer token in headers

  • Parameters: Use the per_page and page parameters to control the number of results per page.

  • Results: The list of subscribers is sorted in descending order by creation date.

Example request

curl -X GET "https://app.zenedu.io/api/v1/bot/1/subscribers?per_page=30&page=1" -H "Accept: application/json" -H "Authorization: Bearer YOUR_API_TOKEN"

Example response

{
"data": [
{
"id": 3,
"user_id": 1002,
"first_name": "Sarah",
"last_name": "Connor",
"username": "sarah_connor",
"phone": null,
"email": null,
"notes": null,
"tags": null,
"is_active": true,
"is_blocked": false,
"last_active_at": "2023-07-24T14:43:12.000000Z"
"created_at": "2023-07-24T14:43:10.000000Z"
},
{
"id": 2,
"user_id": 1001,
"first_name": "Foo",
"last_name": "Bar",
"username": "foo_bar",
"phone": null,
"email": null,
"notes": null,
"tags": null,
"is_active": true,
"is_blocked": false,
"last_active_at": "2023-07-24T14:43:12.000000Z"
"created_at": "2023-07-24T14:41:44.000000Z"
},
{
"id": 1,
"user_id": 1000,
"first_name": "John",
"last_name": null,
"username": "john",
"phone": null,
"email": null,
"notes": null,
"tags": null,
"is_active": true,
"is_blocked": false,
"last_active_at": "2023-07-24T14:43:12.000000Z"
"created_at": "2023-06-23T09:51:07.000000Z"
}
],
"links": {
"first": "https://app.zenedu.io/api/v1/bot/1/subscribers?page=1",
"last": "https://app.zenedu.io/api/v1/bot/1/subscribers?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "<< Previous",
"active": false
},
{
"url": "https://app.zenedu.io/api/v1/bot/1/subscribers?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next >>",
"active": false
}
],
"path": "https://app.zenedu.io/api/v1/bot/1/subscribers",
"per_page": 30,
"to": 3,
"total": 3
}
}

Orders

Description

Obtain a list of all your orders for given bot using this endpoint. The results are paginated with 30 items per page.

  • URL: https://app.zenedu.io/api/v1/bot/{botId}/orders

  • Method: GET

  • Authentication: Bearer token in headers

  • Results: The list of orders is sorted in descending order by creation date.

  • Parameters: Use the per_page and page parameters to control the number of results per page.

Example request

curl -X GET "https://app.zenedu.io/api/v1/bot/1/orders?per_page=30&page=1" -H "Accept: application/json" -H "Authorization: Bearer YOUR_API_TOKEN"

Example response

{
"data": [
{
"id": 2,
"uuid": "9d76cf9c-fdb4-4f7b-98e4-76b96159df93",
"number": 2,
"offer_id": 2,
"offer_name": "Offer 2",
"price": 1,
"currency": "USD",
"type": "one-time",
"payment_system_type": "fondy",
"payment_system_name": "Fondy",
"status_changed_at": "2023-07-24T14:43:52.000000Z"
"created_at": "2023-07-24T14:43:24.000000Z",
"subscriber": {
"id": 1,
"user_id": 1000,
"first_name": "John",
"last_name": null,
"username": "john",
"phone": null,
"email": null,
"notes": null,
"tags": null,
"is_active": true,
"is_blocked": false,
"last_active_at": "2023-07-27T08:39:03.000000Z",
"created_at": "2023-06-23T09:51:07.000000Z"
}
},
{
"id": 1,
"uuid": "a9e58c73-f6a8-413e-b6c5-7af312bf315b",
"number": 1,
"offer_id": 1,
"offer_name": "Offer 1",
"price": 1,
"currency": "USD",
"subscriber_id": 1,
"type": "subscription",
"payment_system_type": "stripe",
"payment_system_name": "Stripe",
"status_changed_at": "2023-07-24T14:42:12.000000Z"
"created_at": "2023-07-24T14:41:52.000000Z",
"subscriber": {
"id": 2,
"user_id": 1001,
"first_name": "Foo",
"last_name": "Bar",
"username": "foo_bar",
"phone": null,
"email": null,
"notes": null,
"tags": null,
"is_active": true,
"is_blocked": false,
"last_active_at": "2023-07-27T08:39:03.000000Z",
"created_at": "2023-06-23T09:51:07.000000Z"
}
}
],
"links": {
"first": "https://app.zenedu.io/api/v1/bot/1/orders?page=1",
"last": "https://app.zenedu.io/api/v1/bot/1/orders?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "<< Previous",
"active": false
},
{
"url": "https://app.zenedu.io/api/v1/bot/1/orders?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next >>",
"active": false
}
],
"path": "https://app.zenedu.io/api/v1/bot/1/orders",
"per_page": 30,
"to": 2,
"total": 2
}
}

Did this answer your question?