Skip to content

Authentication

The API uses Bearer token (API key) to authorize all requests.

Creating an API Key

Navigate to InformationAPI Keys.

Access: Only organization administrators can create and manage API keys.

Creation steps:

  1. Click "Create Key"
  2. Enter a name (for example, "Production ETL", "Daily Export")
  3. 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_xxxxxxxxxxxxxxxxxxxxx

Using in Requests

Add the key to the Authorization header with the Bearer prefix:

text
Authorization: Bearer abn_xxxxxxxxxxxxxxxxxxxxx

Example 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.csv

Example 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:

  1. Navigate to Information → API Keys
  2. Click "Regenerate Key"
  3. The old key will be deleted, a new one will be created
  4. 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 Bearer prefix)
  • Key is not passed in header

Solution:

  1. Check header format: Authorization: Bearer abn_...
  2. Ensure key is active in Information → API Keys section
  3. Check for absence of extra spaces or characters
  4. 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

AB-Labz - Product Experiments Laboratory