API Reference
The Litmus Science REST API enables programmatic submission of experiment requests, status tracking, and results retrieval.
Base URL
https://api.litmus.scienceAuthentication
All endpoints require authentication via Bearer token or API key:
# Bearer token
curl -H "Authorization: Bearer YOUR_TOKEN" https://api.litmus.science/experiments
# API key
curl -H "X-API-Key: lk_your_api_key" https://api.litmus.science/experimentsSee Authentication for details.
Rate Limits
| Tier | Requests/Minute | Requests/Day |
|---|---|---|
| Standard | 100 | 1,000 |
| Pro | 1,000 | 10,000 |
| AI Agent | 500 | 5,000 |
Rate limit headers are included in all responses:
X-RateLimit-Limit: Your limitX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Unix timestamp when limit resets
Endpoints Overview
Authentication
| Endpoint | Method | Description |
|---|---|---|
/auth/register | POST | Register new user |
/auth/token | POST | Get access token |
Experiments
| Endpoint | Method | Description |
|---|---|---|
/experiments | POST | Create experiment |
/experiments | GET | List experiments |
/experiments/{id} | GET | Get experiment |
/experiments/{id} | PATCH | Update experiment |
/experiments/{id} | DELETE | Cancel experiment |
Results
| Endpoint | Method | Description |
|---|---|---|
/experiments/{id}/results | GET | Get results |
/experiments/{id}/approve | POST | Approve results |
/experiments/{id}/dispute | POST | Dispute results |
Validation
| Endpoint | Method | Description |
|---|---|---|
/validate | POST | Validate experiment |
/validate/hypothesis | POST | Validate hypothesis |
/estimate | POST | Get cost estimate |
Templates
| Endpoint | Method | Description |
|---|---|---|
/templates | GET | List templates |
/templates/{id} | GET | Get template |
Operators
| Endpoint | Method | Description |
|---|---|---|
/operator/jobs | GET | List available jobs |
/operator/jobs/{id}/claim | POST | Claim job |
/operator/jobs/{id}/submit | POST | Submit results |
Webhooks
| Endpoint | Method | Description |
|---|---|---|
/webhooks/test | POST | Test webhook |
Error Responses
All errors follow this format:
{
"error": {
"code": "error_code",
"message": "Human-readable message",
"details": {}
}
}Common Error Codes
| Code | HTTP Status | Description |
|---|---|---|
unauthorized | 401 | Invalid or missing credentials |
forbidden | 403 | Valid credentials but insufficient permissions |
not_found | 404 | Resource doesn't exist |
validation_failed | 422 | Request validation failed |
rate_limit_exceeded | 429 | Too many requests |
safety_rejected | 403 | Experiment rejected for safety reasons |
OpenAPI Specification
The complete OpenAPI 3.1 specification is available at:
- Interactive docs:
https://api.litmus.science/docs - ReDoc:
https://api.litmus.science/redoc - Raw spec:
https://api.litmus.science/openapi.json