API Documentation

Retailab APIDocumentation

Integrate our AI-powered product detection into your applications with our RESTful API.

Getting Started
Quick start guide to using the Retailab API

Base URL

http://localhost:8080/protected-api

All API requests should be made to this base URL.

Quick Example

Here's a simple example of creating a job to detect products in an image:

curl -X POST http://localhost:8080/protected-api/jobs \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "image=@/path/to/image.jpg" \
  -F 'all_skus=[{"code":"coca_cola_classic_500ml","name":"Coca-Cola Classic 500ml","description":"Red can with white logo"}]'
Authentication
How to authenticate your API requests

Getting Your API Key

To use the Retailab API, you need an API key. You can create and manage your API keys from the dashboard.

Steps to Get Your API Key:

  1. Sign in to your Retailab account
  2. Navigate to the Dashboard
  3. Click "Create New Key" in the API Keys section
  4. Configure your key with appropriate permissions (read, write, auto_labeling)
  5. Copy your API key immediately - it's only shown once!
Go to Dashboard

Using Your API Key

Include your API key in every request using one of these methods:

Include your API key in the X-API-Key header:

X-API-Key: YOUR_API_KEY

Security Best Practices

  • • Never expose your API keys in client-side code or public repositories
  • • Use environment variables to store your keys securely
  • • Rotate your keys periodically and revoke unused ones
API Endpoints
Complete reference for all available endpoints
POST/jobsCreate Job

Create a new auto-labeling job to detect products in an uploaded image. The job will be processed asynchronously.

Request

Content-Type: multipart/form-data

Form Fields:

  • image (required) - Image file (JPG, PNG, WEBP)
  • all_skus (required) - JSON string array of SKU objects

SKU Object Format

{
  "code": "coca_cola_classic_500ml",
  "name": "Coca-Cola Classic 500ml Aluminum Can",
  "description": "Bright red background (#DC143C), white Spencerian script logo..."
}

Example Request

curl -X POST http://localhost:8080/protected-api/jobs \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "image=@/path/to/image.jpg" \
  -F 'all_skus=[{"code":"coca_cola_classic_500ml","name":"Coca-Cola Classic 500ml","description":"Red can with white logo"}]'

Response

{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "message": "Job created successfully",
  "status": "pending"
}
GET/jobsList Jobs

Retrieve a list of all your auto-labeling jobs. Returns jobs ordered by creation date (newest first).

Example Request

curl -X GET http://localhost:8080/protected-api/jobs \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "data": [
    {
      "id": 1,
      "job_id": "550e8400-e29b-41d4-a716-446655440000",
      "status": "completed",
      "user_email": "user@example.com",
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:45Z",
      "completed_at": "2024-01-15T10:30:45Z",
      "used_ai_input_tokens": 1500,
      "used_ai_output_tokens": 800,
      "used_tokens": 50000,
      "error_message": null
    }
  ]
}
GET/jobs/{id}/stateGet Job State

Check the current state of a job. Useful for polling to know when a job has completed.

Path Parameters

  • id (required) - The job ID returned from creating a job

Example Request

curl -X GET http://localhost:8080/protected-api/jobs/550e8400-e29b-41d4-a716-446655440000/state \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "data": "completed"
}

Possible values: pending, processing, completed, failed

GET/jobs/{id}Get Job Result

Retrieve the complete results of a completed job, including detection images and job metadata.

This endpoint only returns results for completed jobs. Check the job state first to ensure it's completed.

Example Request

curl -X GET http://localhost:8080/protected-api/jobs/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "data": {
    "job": {
      "id": 1,
      "job_id": "550e8400-e29b-41d4-a716-446655440000",
      "status": "completed",
      "user_email": "user@example.com",
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:45Z",
      "completed_at": "2024-01-15T10:30:45Z",
      "used_ai_input_tokens": 1500,
      "used_ai_output_tokens": 800,
      "used_tokens": 50000,
      "error_message": null
    },
    "result_image": "https://example.com/results/result_image.jpg",
    "detections_image": "https://example.com/results/detections_image.jpg"
  }
}
ML Model Performance
Live accuracy metrics from our latest model evaluation on 7,360 test images — trained on real Colombian retail shelves.

Brand Accuracy

96.92%

Macro F1: 94.50%

Sub-Brand Accuracy

94.61%

Macro F1: 93.67%

Avg. Confidence

95.51%

On correct predictions: 96.73%

Classes Supported

189 brands

+ 358 sub-brand classes

BrandF1-ScorePrecisionRecallSupport
Aguardiente Amarillo100.00%100.00%100.00%1
Aguila Roja100.00%100.00%100.00%1
Ariel100.00%100.00%100.00%84
Baby Dove100.00%100.00%100.00%50
Bacardi100.00%100.00%100.00%16
Bonfiest100.00%100.00%100.00%1
Cheese Tris100.00%100.00%100.00%8
Cheetos100.00%100.00%100.00%22
Choclitos100.00%100.00%100.00%15
Choco Listo100.00%100.00%100.00%10
Chocorramo100.00%100.00%100.00%9
Chokis100.00%100.00%100.00%5
Clorox100.00%100.00%100.00%22
Doritos100.00%100.00%100.00%28
Ego100.00%100.00%100.00%10
Familia100.00%100.00%100.00%12
Fassi100.00%100.00%100.00%17
Flips100.00%100.00%100.00%11
Gala100.00%100.00%100.00%6
Gol100.00%100.00%100.00%10
Hills100.00%100.00%100.00%9
Huggies100.00%100.00%100.00%31
Intibon100.00%100.00%100.00%4
Jgb Alcohol100.00%100.00%100.00%7
Kelloggs100.00%100.00%100.00%5
Kotex100.00%100.00%100.00%12
Ladysoft100.00%100.00%100.00%19
Loreal100.00%100.00%100.00%11
Los Cuates100.00%100.00%100.00%7
Mani Moto100.00%100.00%100.00%12
Max100.00%100.00%100.00%25
Mexsana100.00%100.00%100.00%51
Mr Tea100.00%100.00%100.00%4
Natuchips100.00%100.00%100.00%12
Old Spice100.00%100.00%100.00%34
Olmeca100.00%100.00%100.00%5
Palette100.00%100.00%100.00%23
Raid100.00%100.00%100.00%14
Recamier100.00%100.00%100.00%14
Sanson100.00%100.00%100.00%7
Seven Up100.00%100.00%100.00%4
Sprite100.00%100.00%100.00%21
Stay Free100.00%100.00%100.00%6
Suavitel100.00%100.00%100.00%10
Super Ricas100.00%100.00%100.00%51
Tostacos100.00%100.00%100.00%14
Trolli100.00%100.00%100.00%7
Valle100.00%100.00%100.00%35
Todorico99.32%100.00%98.65%74
Super Blank99.27%100.00%98.55%69
Bebex99.22%98.46%100.00%64
De Todito99.21%98.44%100.00%63
Cristalino99.20%100.00%98.41%63
Arrurru99.16%98.33%100.00%59
Dogourmet99.05%99.57%98.53%475
Margarita99.05%100.00%98.11%106
Nosotras98.99%98.99%98.99%99
Cat Chow98.92%100.00%97.87%235
Pequenin98.89%100.00%97.80%91
Bbc98.82%97.67%100.00%42
Carefree98.82%97.67%100.00%42
Axion98.73%100.00%97.50%80
Mi Dia98.72%98.72%98.72%78
Head Shoulders98.71%99.48%97.96%196
Igora98.70%100.00%97.44%39
Ponds98.70%97.44%100.00%38
Protex98.62%100.00%97.28%147
Schick98.55%97.14%100.00%34
Lady Speed Stick98.38%100.00%96.81%94
Postobon98.36%96.77%100.00%30
Winny98.36%98.36%98.36%183
Aromax98.31%96.67%100.00%29
Nescafe98.31%100.00%96.67%30
Quatro98.31%96.67%100.00%29
Babysec98.18%96.43%100.00%27
Fortident98.18%97.59%98.78%82
Oralb98.16%98.77%97.56%82
Balance98.15%99.07%97.25%109
Dorado98.04%96.15%100.00%25
Fluocardent97.96%96.00%100.00%96
Hit97.92%97.92%97.92%48
Johnsons97.92%99.40%96.49%171
Rexona97.92%98.60%97.24%145
Listerine97.83%97.83%97.83%92
Savital97.79%99.25%96.38%138
Agility Gold97.78%97.78%97.78%45
Speed Max97.67%95.45%100.00%21
Pantene97.52%96.72%98.33%120
Nutriss97.51%97.16%97.86%140
Carey97.37%97.37%97.37%76
Pepsi97.37%94.87%100.00%37
Nutribela97.26%97.93%96.60%147
Brisa97.06%97.06%97.06%34
Soka97.06%97.06%97.06%34
Colgate96.80%99.07%94.64%336
Jumbo96.77%95.74%97.83%46
Gillette96.73%97.37%96.10%77
Grisly96.55%93.33%100.00%14
Nectar96.55%100.00%93.33%15
Cocosette96.43%93.10%100.00%27
Cristal96.36%98.15%94.64%56
Nucita96.30%92.86%100.00%13
Vive 10096.30%92.86%100.00%13
Lak96.24%94.12%98.46%65
Colombiana96.10%100.00%92.50%40
Coca Cola96.04%95.10%97.00%100
Aguardiente Antioqueno96.00%94.74%97.30%74
Ritz96.00%92.31%100.00%12
Axe95.89%92.11%100.00%35
Sedal95.89%98.13%93.75%112
Blancox95.71%96.30%95.12%82
Electrolit95.65%95.65%95.65%23
Speed Stick95.65%91.67%100.00%11
Aromatel95.30%95.95%94.67%75
Dove95.24%90.91%100.00%50
Excellent95.24%90.91%100.00%10
Tio Nacho95.24%92.59%98.04%51
Pony Malta94.87%94.87%94.87%39
Equilibrio94.74%90.00%100.00%9
Festival94.74%90.00%100.00%9
Gato Negro94.74%94.74%94.74%19
Natumalta94.74%90.00%100.00%9
Pulp94.74%90.00%100.00%9
Nutre Can94.44%89.47%100.00%17
Ron Santafe94.44%94.44%94.44%18
Sol94.44%94.44%94.44%18
Pilsen94.34%96.15%92.59%27
Aguila94.12%94.12%94.12%17
Chi Ricos94.12%88.89%100.00%8
Cifrut94.12%94.12%94.12%17
Ellas94.12%94.12%94.12%17
Gatorlit94.12%88.89%100.00%8
Lubriderm94.12%94.12%94.12%17
Andina93.65%95.16%92.19%64
Coco93.33%87.50%100.00%7
Fab93.33%87.50%100.00%7
Minichips93.33%87.50%100.00%7
Suntea93.33%100.00%87.50%8
Yodora92.90%92.39%93.41%91
Aguardiente Nectar92.31%85.71%100.00%6
Saviloe92.31%100.00%85.71%7
Top91.89%100.00%85.00%20
Azul Clean91.80%93.33%90.32%31
Chivas Regal90.91%90.91%90.91%11
Gatorade90.91%83.33%100.00%10
Nivea90.91%86.96%95.24%21
Sanpic90.91%83.33%100.00%10
Tanga90.91%83.33%100.00%5
H2o90.32%87.50%93.33%15
Black And White90.00%81.82%100.00%9
Ron Viejo De Caldas90.00%85.71%94.74%38
Venus90.00%100.00%81.82%11
Elite89.66%81.25%100.00%13
Maizitos89.66%81.25%100.00%13
Jack Daniels89.47%89.47%89.47%19
Big Cola89.23%93.55%85.29%68
Hatsu89.09%89.09%89.09%55
Baileys88.89%88.89%88.89%9
Corona88.89%100.00%80.00%5
Dampy88.89%100.00%80.00%5
Yupi88.89%100.00%80.00%5
Something Special88.00%91.67%84.62%13
Sporade88.00%78.57%100.00%11
Angela87.50%87.50%87.50%8
Buen Dia87.50%93.33%82.35%17
Crema N487.50%100.00%77.78%9
Deseo85.71%75.00%100.00%9
Fabuloso85.71%75.00%100.00%6
Kola Roman85.71%75.00%100.00%9
Vanish85.71%100.00%75.00%8
Lozocrem84.85%82.35%87.50%16
Tecate84.85%73.68%100.00%14
Deo Pies83.33%71.43%100.00%5
Dersa83.33%83.33%83.33%6
Royal Canin82.35%77.78%87.50%8
Ron Medellin81.82%90.00%75.00%24
Carinoso80.00%66.67%100.00%4
Grants80.00%100.00%66.67%6
Jose Cuervo80.00%100.00%66.67%6
Lava80.00%100.00%66.67%6
Lite80.00%100.00%66.67%6
Cielo78.26%64.29%100.00%9
Br For Dog76.92%71.43%83.33%6
Cicatricure75.00%60.00%100.00%6
Trululu75.00%100.00%60.00%10
Asepxia73.68%63.64%87.50%8
Mk72.73%80.00%66.67%6
La Joya70.59%60.00%85.71%7
Club Colombia66.67%100.00%50.00%2

Showing 189 of 189 brands · sorted by F1-Score

How to Read These Results

Metric Definitions

  • F1-Score: Harmonic mean of precision & recall — the primary quality signal
  • Precision: Of all predictions, what fraction was correct
  • Recall: Of all true instances, what fraction was found
  • Confidence ✓: Avg. model confidence when the prediction was correct
  • Support: Number of real instances in the test set

Color Legend

≥ 95%Excellent — production-ready
≥ 85%Good — reliable for most use cases
≥ 75%Acceptable — limited training data
< 75%Low — rare class or visual ambiguity
Error Handling
Understanding API error responses

The API uses standard HTTP status codes to indicate success or failure. Error responses include a message describing what went wrong.

400 Bad Request

Invalid request parameters or missing required fields.

401 Unauthorized

Invalid or missing API key.

403 Forbidden

API key doesn't have required permissions.

404 Not Found

Job ID not found or doesn't belong to you.

Ready to get started?

Create your API key and start integrating product detection into your applications.