Authentication
The API uses Bearer token (API key) to authorize all requests.
Creating an API Key
Navigate to Information → API Keys.
Access: Only organization administrators can create and manage API keys.
Creation steps:
- Click "Create Key"
- Enter a name (for example, "Production ETL", "Daily Export")
- Copy the generated key
Important: The key is shown only once! Save it in a secure place.
Key Format
API keys have the prefix abn_:
abn_xxxxxxxxxxxxxxxxxxxxxUsing in Requests
Add the key to the Authorization header with the Bearer prefix:
text
Authorization: Bearer abn_xxxxxxxxxxxxxxxxxxxxxExample with cURL
bash
curl -X POST "https://workbench.ab-labz.com/api/v1/datasets/upload/?experiment_id=test_exp" \
-H "Authorization: Bearer abn_xxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: text/csv" \
--data-binary @dataset.csvExample with Python
python
import requests
API_KEY = 'abn_xxxxxxxxxxxxxxxxxxxxx'
API_URL = 'https://workbench.ab-labz.com/api/v1'
with open('dataset.csv', 'rb') as f:
response = requests.post(
f'{API_URL}/datasets/upload/',
params={'experiment_id': 'test_exp'},
headers={
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'text/csv'
},
data=f
)Key Management
Each organization has one API key. Organization administrators can manage it in the Information → API Keys section.
Key Regeneration
If the key is compromised or lost:
- Navigate to Information → API Keys
- Click "Regenerate Key"
- The old key will be deleted, a new one will be created
- Copy the new key (shown only once)
Important: After regeneration, the old key stops working immediately. Update the key in all integrations.
Authorization Errors
401 Unauthorized
Possible causes:
- Key is incorrect or revoked
- Incorrect header format (missing
Bearerprefix) - Key is not passed in header
Solution:
- Check header format:
Authorization: Bearer abn_... - Ensure key is active in Information → API Keys section
- Check for absence of extra spaces or characters
- Ensure you're using current key (not expired)
Example of correct format:
python
# Correct
headers = {'Authorization': f'Bearer {API_KEY}'}
# Incorrect - no Bearer prefix
headers = {'Authorization': API_KEY}
# Incorrect - wrong header name
headers = {'auth': f'Bearer {API_KEY}'}403 Forbidden
Cause: Organization is deactivated or there is no active subscription
Solution: Contact organization administrator
