Authentication | Better Sales Pro API Docs

Authenticate with staff credentials and access tokens.

curl --request POST \
  --url https://bettersalespro.com/admin/api/login \
  --data 'email=YOU@example.com' \
  --data 'password=YOUR_PASSWORD'
const body = new URLSearchParams({
  email: 'YOU@example.com',
  password: 'YOUR_PASSWORD'
});
const res = await fetch('https://bettersalespro.com/admin/api/login', {
  method: 'POST',
  body
});
const data = await res.json();
// store data.token securely
$ch = curl_init('https://bettersalespro.com/admin/api/login');
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POSTFIELDS => http_build_query([
    'email' => 'YOU@example.com',
    'password' => 'YOUR_PASSWORD',
  ]),
]);
echo curl_exec($ch);

Overview

Better Sales Pro’s partner API authenticates staff users. Successful login returns a random token stored on the staff record. Subsequent methods resolve the staff user with Authenticationi_api_model->get_staff_id($token).

OAuth 2.0 is not the public authentication mechanism for these endpoints. Do not send secrets in frontend JavaScript or documentation samples that are meant to run in browsers.

Login

POST/admin/api/login

email string required

Staff login email.

password string required

Staff password.

Using tokens

Pass token with each authenticated request (typically as a POST field). Invalid or missing tokens return:

{
  "session_expired": "…"
}

Permissions

Many write operations also enforce Better Sales Pro module permissions (view/create/edit/delete). See Permissions.

Security best practices

  • Store tokens server-side only
  • Rotate credentials if a device is compromised
  • Use HTTPS in production
  • Grant staff the least privilege required
Was this page helpful?