Skip to content

Authentication ​

Part of the Security & Authentication API. Base URL https://your-domain.com/admin/api/v1 — replace the host with your own installation and the token placeholder with a real Bearer token (see Authentication).

Login ​

POST /admin/api/v1/login

Authenticate user and generate API token

Body parameters

ParameterTypeRequiredDescription
emailstringYesUser email address
passwordstringYesUser password
bash
curl -X POST "https://your-domain.com/admin/api/v1/login" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "admin@example.com",
  "password": "password"
}'
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/login", {
  method: "POST",
  headers: {
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "email": "admin@example.com",
  "password": "password"
}),
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://your-domain.com/admin/api/v1/login', [
    'headers' => [
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
    'json' => [
    'email' => 'admin@example.com',
    'password' => 'password',
  ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/login"

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

payload = {
    "email": "admin@example.com",
    "password": "password",
}

response = requests.post(url, headers=headers, json=payload)

data = response.json()
print(data)

Example response 200

json
{
  "message": "Login successful",
  "token": "1|abcd1234efgh5678ijkl...",
  "token_type": "Bearer",
  "user": {
    "id": 1,
    "name": "Admin User",
    "email": "admin@example.com"
  }
}
Error response — 401
json
{
  "message": "The provided credentials are incorrect."
}

Logout ​

POST /admin/api/v1/logout

Revoke current API token

🔒 Requires a valid Bearer token.

bash
curl -X POST "https://your-domain.com/admin/api/v1/logout" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json"
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/logout", {
  method: "POST",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://your-domain.com/admin/api/v1/logout', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/logout"

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

response = requests.post(url, headers=headers)

data = response.json()
print(data)

Example response 200

json
{
  "message": "Logout successful"
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Released under the MIT License.