Linkit

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/v1

All endpoints are prefixed with /api/v1. HTTPS is required for all requests.


Request Format

  • Content-Type: application/json for 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_here

Obtained by authenticating with email and password. Tokens expire after a configurable period.

API Key

Authorization: your_api_key_here

Generated from the admin dashboard. Better suited for server-to-server communication.

See Authentication for full details.


HTTP Methods

MethodPurpose
GETRetrieve resources
POSTCreate resources or execute actions
PUTFull replacement update
PATCHPartial update
DELETERemove resources

Status Codes

CodeMeaning
200Success
201Created
204Deleted (no response body)
400Bad request (invalid input)
401Unauthorized (missing or invalid credentials)
403Forbidden (insufficient permissions)
404Resource not found
409Conflict (duplicate resource)
422Validation error
429Rate limit exceeded
500Internal server error

Pagination

List endpoints return paginated results:

{
  "data": [],
  "count": 25,
  "total_count": 1234,
  "page": 1,
  "limit": 25,
  "has_next": true,
  "meta": {}
}

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number (1-indexed)
limitinteger20Items per page (max 100)

Sorting

Use the sort parameter for custom ordering:

GET /api/v1/products?sort=name_en
GET /api/v1/products?sort=-created

Prefix 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=active

Most list endpoints support a search parameter for full-text search across relevant fields:

GET /api/v1/products?search=paracetamol

Error Response Format

All errors follow a consistent structure:

{
  "code": 400,
  "error": "Validation failed",
  "details": {
    "field": "name_en",
    "message": "Name is required"
  }
}
FieldTypeDescription
codeintegerHTTP status code
errorstringHuman-readable error message
detailsstring/objectAdditional 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:

ScopeLimit
Read endpoints300 requests/min
Write endpoints100 requests/min
Bulk operations100 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

Next Steps