API Overview
Base URL, request format, authentication, pagination, filtering, and error handling
API Overview
The Linkit REST API provides programmatic access to your product catalog, inventory, orders, customers, and integrations. All endpoints follow consistent conventions for authentication, pagination, and error handling.
Base URL
https://linkit.works/api/v1All endpoints are prefixed with /api/v1. HTTPS is required for all requests.
Request Format
- Content-Type:
application/jsonfor all request bodies - Character encoding: UTF-8
- Date format: ISO 8601 / RFC 3339 (e.g.,
2024-01-15T10:30:00Z) - IDs: 15-character alphanumeric strings (PocketBase format)
Authentication
Every request requires one of two authentication methods:
Bearer Token
Authorization: Bearer your_token_hereObtained by authenticating with email and password. Tokens expire after a configurable period.
API Key
Authorization: your_api_key_hereGenerated from the admin dashboard. Better suited for server-to-server communication.
See Authentication for full details.
HTTP Methods
| Method | Purpose |
|---|---|
GET | Retrieve resources |
POST | Create resources or execute actions |
PUT | Full replacement update |
PATCH | Partial update |
DELETE | Remove resources |
Status Codes
| Code | Meaning |
|---|---|
200 | Success |
201 | Created |
204 | Deleted (no response body) |
400 | Bad request (invalid input) |
401 | Unauthorized (missing or invalid credentials) |
403 | Forbidden (insufficient permissions) |
404 | Resource not found |
409 | Conflict (duplicate resource) |
422 | Validation error |
429 | Rate limit exceeded |
500 | Internal server error |
Pagination
List endpoints return paginated results:
{
"data": [],
"count": 25,
"total_count": 1234,
"page": 1,
"limit": 25,
"has_next": true,
"meta": {}
}Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number (1-indexed) |
limit | integer | 20 | Items per page (max 100) |
Sorting
Use the sort parameter for custom ordering:
GET /api/v1/products?sort=name_en
GET /api/v1/products?sort=-createdPrefix with - for descending order. Default sort is -created (newest first).
Filtering
Resources support field-level filtering through query parameters:
GET /api/v1/products?is_enabled=true&brand_id=brand_123
GET /api/v1/orders?status=delivered&source=salla
GET /api/v1/customers?type=vip&status=activeText Search
Most list endpoints support a search parameter for full-text search across relevant fields:
GET /api/v1/products?search=paracetamolError Response Format
All errors follow a consistent structure:
{
"code": 400,
"error": "Validation failed",
"details": {
"field": "name_en",
"message": "Name is required"
}
}| Field | Type | Description |
|---|---|---|
code | integer | HTTP status code |
error | string | Human-readable error message |
details | string/object | Additional context about the error |
Rate Limiting
API requests are rate-limited per organization. When you exceed the limit, the API returns 429 Too Many Requests with a Retry-After header indicating how long to wait.
Standard limits:
| Scope | Limit |
|---|---|
| Read endpoints | 300 requests/min |
| Write endpoints | 100 requests/min |
| Bulk operations | 100 requests/min |
Common Patterns
Iterate All Pages
async function fetchAll(endpoint, token) {
const results = [];
let page = 1;
let hasNext = true;
while (hasNext) {
const response = await fetch(
`https://linkit.works/api/v1/${endpoint}?page=${page}&limit=100`,
{ headers: { 'Authorization': `Bearer ${token}` } }
);
const data = await response.json();
results.push(...data.data);
hasNext = data.has_next;
page++;
}
return results;
}import requests
def fetch_all(endpoint, token):
results = []
page = 1
while True:
response = requests.get(
f'https://linkit.works/api/v1/{endpoint}',
params={'page': page, 'limit': 100},
headers={'Authorization': f'Bearer {token}'}
)
data = response.json()
results.extend(data['data'])
if not data['has_next']:
break
page += 1
return results