REST API ReferenceComplete API documentation for developers
Comprehensive reference for all REST API endpoints, authentication, request/response formats, and error handling.
API Sections
Authentication
Configuration and examples
API Key Authentication
All API requests require authentication using your API key. Include your API key in the Authorization header as a Bearer token.
Authorization: Bearer YOUR_API_KEY
Getting Your API Key
- Log into your Litends dashboard
- Navigate to "API Keys" section
- Click "Generate New Key"
- Copy and securely store your key
- Never share your API key publicly
Security Best Practices
- Store keys in environment variables
- Rotate keys regularly
- Use different keys for dev/prod
- Monitor API usage patterns
Text Analysis
2 endpoints
/v2/text/sentiment
Analyze sentiment of text content
Parameters
Name | Type | Required | Description |
---|---|---|---|
text | string | Required | Text content to analyze (max 10,000 characters) |
language | string | Optional | Language code (auto-detected if not provided) |
detailed | boolean | Optional | Return detailed sentiment scores |
Request Example
{
"text": "I absolutely love using this AI platform! It's incredibly powerful and easy to use.",
"language": "en",
"detailed": true
}
Response Example
{
"sentiment": "positive",
"confidence": 0.94,
"scores": {
"positive": 0.94,
"negative": 0.03,
"neutral": 0.03
},
"entities": [
{
"text": "AI platform",
"type": "PRODUCT",
"sentiment": "positive"
}
],
"language": "en",
"processing_time_ms": 45
}
/v2/text/entities
Extract named entities from text
Parameters
Name | Type | Required | Description |
---|---|---|---|
text | string | Required | Text content to analyze |
types | array | Optional | Entity types to extract (PERSON, ORGANIZATION, LOCATION, etc.) |
Request Example
{
"text": "Apple Inc. was founded by Steve Jobs in Cupertino, California.",
"types": ["PERSON", "ORGANIZATION", "LOCATION"]
}
Response Example
{
"entities": [
{
"text": "Apple Inc.",
"type": "ORGANIZATION",
"confidence": 0.98,
"start": 0,
"end": 10
},
{
"text": "Steve Jobs",
"type": "PERSON",
"confidence": 0.99,
"start": 25,
"end": 35
},
{
"text": "Cupertino, California",
"type": "LOCATION",
"confidence": 0.97,
"start": 39,
"end": 60
}
],
"processing_time_ms": 32
}
Image Analysis
2 endpoints
/v2/vision/classify
Classify objects and scenes in images
Parameters
Name | Type | Required | Description |
---|---|---|---|
image | string | Required | Base64 encoded image or image URL |
max_results | integer | Optional | Maximum number of results (default: 10) |
min_confidence | float | Optional | Minimum confidence threshold (default: 0.5) |
Request Example
{
"image": "https://example.com/image.jpg",
"max_results": 5,
"min_confidence": 0.7
}
Response Example
{
"classifications": [
{
"label": "Golden Retriever",
"confidence": 0.94,
"category": "animal"
},
{
"label": "Dog",
"confidence": 0.98,
"category": "animal"
},
{
"label": "Pet",
"confidence": 0.89,
"category": "animal"
}
],
"image_properties": {
"width": 1024,
"height": 768,
"format": "JPEG"
},
"processing_time_ms": 127
}
/v2/vision/detect
Detect and locate objects in images
Parameters
Name | Type | Required | Description |
---|---|---|---|
image | string | Required | Base64 encoded image or image URL |
objects | array | Optional | Specific objects to detect |
Request Example
{
"image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
"objects": ["person", "car", "bicycle"]
}
Response Example
{
"detections": [
{
"object": "person",
"confidence": 0.92,
"bounding_box": {
"x": 145,
"y": 67,
"width": 128,
"height": 245
}
},
{
"object": "car",
"confidence": 0.87,
"bounding_box": {
"x": 320,
"y": 180,
"width": 240,
"height": 120
}
}
],
"processing_time_ms": 89
}
Prediction Models
1 endpoint
/v2/predict/timeseries
Generate time series forecasts
Parameters
Name | Type | Required | Description |
---|---|---|---|
data | array | Required | Historical time series data points |
periods | integer | Required | Number of future periods to predict |
confidence_interval | float | Optional | Confidence interval (default: 0.95) |
Request Example
{
"data": [
{"timestamp": "2024-01-01", "value": 100},
{"timestamp": "2024-01-02", "value": 110},
{"timestamp": "2024-01-03", "value": 105},
{"timestamp": "2024-01-04", "value": 120}
],
"periods": 7,
"confidence_interval": 0.95
}
Response Example
{
"predictions": [
{
"timestamp": "2024-01-05",
"predicted_value": 125.3,
"lower_bound": 118.1,
"upper_bound": 132.5
},
{
"timestamp": "2024-01-06",
"predicted_value": 128.7,
"lower_bound": 119.8,
"upper_bound": 137.6
}
],
"model_info": {
"algorithm": "ARIMA",
"accuracy_score": 0.94,
"trend": "increasing"
},
"processing_time_ms": 156
}
Error Handling
Configuration and examples
HTTP Status Codes
Success Codes
200
Request successful201
Resource created202
Request acceptedError Codes
400
Bad request401
Unauthorized429
Rate limit exceeded500
Server errorError Response Format
{
"error": {
"code": "INVALID_REQUEST",
"message": "The request contains invalid parameters",
"details": {
"field": "text",
"reason": "Text cannot be empty"
},
"request_id": "req_123456789"
}
}
Rate Limiting
API calls are limited based on your plan:
- • Free: 1,000 requests/month
- • Pro: 100,000 requests/month
- • Enterprise: Custom limits
Rate limit headers are included in all responses to help you monitor usage.
Retry Strategy
For transient errors, implement exponential backoff:
- Wait 1 second, then retry
- Wait 2 seconds, then retry
- Wait 4 seconds, then retry
- Wait 8 seconds, then retry
- Give up after 4 attempts
Ready to integrate our API?
Try our API in your preferred development environment or explore our SDK libraries for easier integration.