Pagination & Filtering

All list endpoints support pagination and field selection to efficiently retrieve data.

Pagination Parameters

ParameterTypeDefaultDescription
pagenumber1Page number (1-indexed)
limitnumber100Items per page (max 500)

Example Request

curl -X GET "https://orchestrator.assemblyline.sh/api/v1/stations?page=2&limit=50" \
  -H "api-key: al_xxxxxxxxxxxx" \
  -H "api-secret: xxxxxxxxxxxxxxxx"

Response Format

All list responses include a page_context object with pagination metadata:

{
  "data": [...],
  "page_context": {
    "count": 50,
    "page": 2,
    "per_page": 50,
    "total": 142,
    "has_more": true
  }
}
FieldDescription
countNumber of items in this page
pageCurrent page number
per_pageItems requested per page
totalTotal number of items matching the query
has_moreWhether more pages are available

Field Selection

Use the fields parameter to request only specific fields:

curl -X GET "https://orchestrator.assemblyline.sh/api/v1/stations?fields=id,short_code,name" \
  -H "api-key: al_xxxxxxxxxxxx" \
  -H "api-secret: xxxxxxxxxxxxxxxx"

This returns only the requested fields:

{
  "data": [
    {
      "id": "abc123",
      "short_code": "P1",
      "name": "Invoice Validation"
    }
  ],
  "page_context": { ... }
}

Filtering

Each endpoint supports specific filter parameters. Common patterns include:

FilterExampleDescription
is_enabled?is_enabled=trueFilter by enabled stations
tag?tag=monthlyFilter by tag name
station_id?station_id=def456Filter work records by station
status?status=completedFilter work records by status

See individual endpoint documentation for available filters.

Iterating Through All Results

To retrieve all results, iterate through pages until has_more is false:

let page = 1;
let has_more = true;
const all_results = [];

while (has_more) {
  const response = await fetch(
    `https://orchestrator.assemblyline.sh/api/v1/stations?page=${page}&limit=100`,
    { headers: { 'api-key': key, 'api-secret': secret } }
  );
  const data = await response.json();

  all_results.push(...data.data);
  has_more = data.page_context.has_more;
  page++;
}