Skip to main content
Getting Started

Authentication

Authenticate with the BlueRockTEL API using Laravel Passport bearer tokens. Learn how to obtain and use API tokens.

Base URL: /api/

The BlueRockTEL API uses bearer tokens issued by Laravel Passport for authentication. To access protected endpoints, first obtain a token via the login endpoint, then include it in subsequent requests using the Authorization: Bearer {token} header.


POST /login

Authenticate with email and password. Returns an API bearer token.

Auth required: No

Body (JSON):

Field Type Required Description
email string Yes User email address
password string Yes User password

Response 200:

{
  "token": "...",
  "user": { "id": 1, "name": "...", "email": "...", ... },
  "teams": [...],
  "support_teams": [...]
}

Response 401: Invalid credentials.

Examples:

curl -X POST https://your-instance.bluerocktel.net/api/login \
  -H "Content-Type: application/json" \
  -d '{"email": "user@example.com", "password": "your-password"}'
import requests

response = requests.post("https://your-instance.bluerocktel.net/api/login", json={
    "email": "user@example.com",
    "password": "your-password"
})
token = response.json()["token"]
$response = Http::post('https://your-instance.bluerocktel.net/api/login', [
    'email' => 'user@example.com',
    'password' => 'your-password',
]);
$token = $response->json('token');
const response = await fetch("https://your-instance.bluerocktel.net/api/login", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ email: "user@example.com", password: "your-password" })
});
const { token } = await response.json();

GET /brtel-login/{token}

Internal BlueRockTEL login via pre-existing API token. Only available from whitelisted IP addresses.

Auth required: No (IP whitelist enforced)

URL parameters:

Parameter Type Description
token string The user's api_token field value

Response 200:

{ "token": "..." }

Response 403: IP not whitelisted. Response 404: Token not found.


GET /api/user

Get the currently authenticated user.

Auth required: Yes (auth:api)

Response 200: User object.

Examples:

curl -X GET https://your-instance.bluerocktel.net/api/user \
  -H "Authorization: Bearer YOUR_TOKEN_HERE"
import requests

response = requests.get("https://your-instance.bluerocktel.net/api/user", headers={
    "Authorization": "Bearer YOUR_TOKEN_HERE"
})
user = response.json()
$response = Http::withToken('YOUR_TOKEN_HERE')
    ->get('https://your-instance.bluerocktel.net/api/user');
$user = $response->json();
const response = await fetch("https://your-instance.bluerocktel.net/api/user", {
  headers: { "Authorization": "Bearer YOUR_TOKEN_HERE" }
});
const user = await response.json();