MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your token by visiting your dashboard and clicking Generate API token.

DevOps

Health Check

Check availability of the backend. Should return HTTP 200.

Example request:
curl --request GET \
    --get "https://api.dev.e5.reducate.com/v1/health" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.dev.e5.reducate.com/v1/health"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.dev.e5.reducate.com/v1/health';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "status": "OK"
}
 

Request      

GET v1/health

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Tenant Domain Access Check

Used to verify that central and tenant users can access tenant routes

Example request:
curl --request GET \
    --get "https://api.dev.e5.reducate.com/v1/tenant_domain_access_check" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.dev.e5.reducate.com/v1/tenant_domain_access_check"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.dev.e5.reducate.com/v1/tenant_domain_access_check';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "url": "FULL URL"
}
 

Request      

GET v1/tenant_domain_access_check

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Test

Public route

This route is accessible without any authentication

Example request:
curl --request GET \
    --get "https://api.dev.e5.reducate.com/v1/demo/public" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.dev.e5.reducate.com/v1/demo/public"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.dev.e5.reducate.com/v1/demo/public';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "text": "This is a public message."
}
 

Request      

GET v1/demo/public

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Authenticated, no permissions

requires authentication

Required authorization header. Accessible without permissions

Example request:
curl --request GET \
    --get "https://api.dev.e5.reducate.com/v1/demo/protected" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.dev.e5.reducate.com/v1/demo/protected"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.dev.e5.reducate.com/v1/demo/protected';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "text": "This is a protected message."
}
 

Example response (401):


{
    "message": "Unauthenticated"
}
 

Request      

GET v1/demo/protected

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Authenticated, admin permission

requires authentication

Required authorization header. Requires read:admin-messages permission Permissions can be created in Auth0. They are added to a role. And a role is attached to a user.

Example request:
curl --request GET \
    --get "https://api.dev.e5.reducate.com/v1/demo/admin" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.dev.e5.reducate.com/v1/demo/admin"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.dev.e5.reducate.com/v1/demo/admin';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "text": "This is a admin message."
}
 

Example response (401):


{
    "message": "Unauthenticated"
}
 

Example response (403):


{
    "text": "Permission denied. Required: read:admin-messages"
}
 

Request      

GET v1/demo/admin

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Authenticated, editor permission

requires authentication

Required authorization header. Requires edit:courses permission Permissions can be created in Auth0. They are added to a role. And a role is attached to a user.

Example request:
curl --request GET \
    --get "https://api.dev.e5.reducate.com/v1/demo/editor" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.dev.e5.reducate.com/v1/demo/editor"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.dev.e5.reducate.com/v1/demo/editor';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "text": "This is a admin message."
}
 

Example response (401):


{
    "message": "Unauthenticated"
}
 

Example response (403):


{
    "text": "Permission denied. Required: edit:courses"
}
 

Request      

GET v1/demo/editor

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Authenticated, reader permission

requires authentication

Required authorization header. Requires read:courses permission Permissions can be created in Auth0. They are added to a role. And a role is attached to a user.

Example request:
curl --request GET \
    --get "https://api.dev.e5.reducate.com/v1/demo/reader" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.dev.e5.reducate.com/v1/demo/reader"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.dev.e5.reducate.com/v1/demo/reader';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "text": "This is a admin message."
}
 

Example response (401):


{
    "message": "Unauthenticated"
}
 

Example response (403):


{
    "text": "Permission denied. Required: read:courses"
}
 

Request      

GET v1/demo/reader

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Users

Get user

requires authentication

Example request:
curl --request GET \
    --get "https://api.dev.e5.reducate.com/v1/user/401410252676930158" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.dev.e5.reducate.com/v1/user/401410252676930158"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.dev.e5.reducate.com/v1/user/401410252676930158';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "name": "Tenant 1_1",
    "email": "tenant1_1@tenants.test",
    "created_at": "2024-02-14T16:21:02+01:00"
}
 

Request      

GET v1/user/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the user. Example: 401410252676930158

Update a new user

requires authentication

Example request:
curl --request POST \
    "https://api.dev.e5.reducate.com/v1/user/401410252676930158" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"quam\"
}"
const url = new URL(
    "https://api.dev.e5.reducate.com/v1/user/401410252676930158"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "quam"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.dev.e5.reducate.com/v1/user/401410252676930158';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'quam',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (204):

Show headers
cache-control: no-cache, private
x-ratelimit-limit: 60
x-ratelimit-remaining: 58
access-control-allow-origin: *
 
Empty response
 

Request      

POST v1/user/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the user. Example: 401410252676930158

Body Parameters

name   string   

Example: quam