Authentication API
Authenticate an account, validate a token, manage API keys, and log out.
All paths are relative to https://www.labii.dev. Authentication and token-validation endpoints do not require an existing bearer token; API key management and logout do.
Endpoints
| Operation | Method | Path |
|---|---|---|
| Authenticate account | POST | /accounts/auth/ |
| Check token | GET | /accounts/checktoken/ |
| Get API key list | GET | /accounts/apikey/list/organization/{{organization_sid}}/list/ |
| Create API key | POST | /accounts/apikey/list/organization/{{organization_sid}}/detail/ |
| Get API key detail | GET | /accounts/apikey/detail/{{api_key_sid}}/ |
| Update API key | PATCH | /accounts/apikey/detail/{{api_key_sid}}/ |
| Delete API key | DELETE | /accounts/apikey/detail/{{api_key_sid}}/ |
| Log out | GET | /accounts/logout/ |
Authenticate account
Send the account email in username and the account password in password.
curl --request POST \
--url 'https://www.labii.dev/accounts/auth/' \
--header 'Content-Type: application/json' \
--data '{
"username": "user@example.com",
"password": "<password>"
}'
When multifactor authentication (MFA) is not required, a successful response uses the current user detail serializer and adds authentication and session fields:
{
"sid": null,
"first_name": null,
"last_name": null,
"full_name": null,
"email": null,
"phone": null,
"timezone": null,
"language": null,
"token": "<redacted>",
"secret": "<redacted>",
"metadata": null
}
The response can also include tag and expired_days when the password has expired, and session_timeout_minutes when a session timeout is configured.
When MFA is required, the response contains the fields needed to continue the MFA flow:
{
"secret": "<redacted>",
"email": null,
"phone": null,
"is_authenticator_enabled": false
}
Check token
Send the token as bearer authentication. The endpoint returns a localized detail message that states whether the token is valid.
curl --request GET \
--url 'https://www.labii.dev/accounts/checktoken/' \
--header 'Authorization: Bearer <token>'
{
"detail": "Valid token."
}
API key fields
List response item: sid, name, key, user, created, expiry_date, is_archived, change_permission, verbose_name
Detail response: sid, name, key, user, created, expiry_date, is_archived, help_text, change_permission, verbose_name
Write serializer: sid, name, created, expiry_date, user, is_archived
The API key view assigns sid and user from the authenticated user when it creates a key. The unmasked key value is returned only at creation; later responses mask it.
API key list response JSON
The values below are placeholders that show the exact current serializer keys. They do not indicate that every field is nullable.
{
"page_size": 10,
"page_number": 1,
"page_count": 1,
"count": 1,
"next": null,
"previous": null,
"add_permission": true,
"results": [
{
"sid": null,
"name": null,
"key": "prefix.***",
"user": null,
"created": null,
"expiry_date": null,
"is_archived": null,
"change_permission": null,
"verbose_name": null
}
]
}
Create an API key
Provide name and, optionally, expiry_date as a date. The endpoint converts the date to the start of that day.
curl --request POST \
--url 'https://www.labii.dev/accounts/apikey/list/organization/{{organization_sid}}/detail/' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Automation key",
"expiry_date": "2027-12-31"
}'
{
"sid": null,
"name": "Automation key",
"key": "<redacted>",
"user": null,
"created": null,
"expiry_date": null,
"is_archived": false,
"help_text": null,
"change_permission": true,
"verbose_name": null
}
Log out
Logout invalidates the current token and returns HTTP 200 with no response body.
curl --request GET \
--url 'https://www.labii.dev/accounts/logout/' \
--header 'Authorization: Bearer <token>'