EXPANS API · V1

API reference

Start with a project list, then load completed time entries for the dates you need. This guide covers the external reporting API v1.

REST / JSONHTTPSRead-only

Authentication

Use a separate integration key in Authorization: Bearer <key>. Cookies, account passwords and extension tokens do not authenticate this API. Keys belong to one workspace and can expire or be revoked. To replace a key without interrupting imports, create a second one, verify it and then revoke the first. Call the API from your backend. Cross-origin browser access (CORS) is not enabled; an integration key must not be exposed to the browser.

A client-scoped key returns explicitly allowed client projects under their approved names. A workspace-wide key includes current and future projects, including archived and internal ones, using their tracker names. Choose the narrowest scope that fits. Archived projects retain their history; entries without a project are excluded.

You need a workspace and permission to issue an API key. If health returns integration_unavailable, contact support to check whether API access is enabled for your service.

Base URLhttps://track.expans.ua/integrations/client-portal/v1

Endpoints

GET /health

Check the key and service readiness. Authentication is required.

GET /projects

List projects allowed by this key. Continue with cursor if complete is false.

GET /projects/{project_id}/entries

Read completed entries intersecting a local date range for an allowed project.

GET reads data. HEAD and OPTIONS require a key and do not create a snapshot. Write methods are not supported. Paths below have no trailing slash.

Request and response

Use an ID returned by projects. All dates, IDs, names and the snapshot below are illustrative. Load your key from protected server configuration into EXPANS_API_KEY before running the examples; do not paste a real secret into the command.

Check the connection

curl --fail-with-body --config - <<EOF
url = "https://track.expans.ua/integrations/client-portal/v1/health"
header = "Authorization: Bearer ${EXPANS_API_KEY}"
EOF

Get permitted projects

curl --fail-with-body --config - <<EOF
url = "https://track.expans.ua/integrations/client-portal/v1/projects"
header = "Authorization: Bearer ${EXPANS_API_KEY}"
EOF

One project, one reporting period

ParameterRequiredMeaning
period_startYesFirst local date, YYYY-MM-DD
period_endYesLast local date, YYYY-MM-DD
timezoneYesIANA time zone, such as Europe/Kyiv
snapshot_idContinuationSnapshot ID from the first response
cursorContinuationExact next_cursor from the previous page

Request time entries

curl --fail-with-body --config - <<EOF
url = "https://track.expans.ua/integrations/client-portal/v1/projects/42/entries?period_start=2026-11-01&period_end=2026-11-30&timezone=Europe%2FKyiv"
header = "Authorization: Bearer ${EXPANS_API_KEY}"
EOF

Example response

{
  "schema_version": 1,
  "snapshot_id": "00000000-0000-4000-8000-000000000001",
  "project_id": "42",
  "period_start": "2026-11-01",
  "period_end": "2026-11-30",
  "timezone": "Europe/Kyiv",
  "generated_at": "2026-11-18T12:00:00Z",
  "records": [
    {
      "entry_id": "123",
      "project_id": "42",
      "revision": "3",
      "started_at": "2026-11-18T09:00:00Z",
      "ended_at": "2026-11-18T10:00:00Z",
      "seconds": 3600,
      "category": "Design",
      "client_title": "Homepage layout review",
      "work_id": "a4d2c1b0a4d2c1b0a4d2c1b0a4d2c1b0a4d2c1b0a4d2c1b0a4d2c1b0a4d2c1b0",
      "deleted": false
    }
  ],
  "next_cursor": null,
  "complete": true
}

Record fields

FieldWhat it means
entry_idOpaque entry ID. Treat it as a string.
project_idProject ID returned by the project list.
revisionEntry revision, returned as a string.
started_atStart of the original interval in UTC.
ended_atEnd of the original interval in UTC.
secondsFull original duration, floored to whole seconds. Clip it to your report period.
categoryWork category name; empty for internal projects or missing data.
client_titleTask title, up to 500 characters; links removed. Empty for internal projects or missing data.
work_idOpaque grouping ID within a project and client. Do not parse it or use it as an entry ID.
deletedAlways false in v1. Deleted entries are absent from a new full snapshot.

Pagination and updates

A first entries request creates a fixed snapshot. For the next page, send snapshot_id and next_cursor as cursor, keeping project, dates and timezone unchanged. Copy these opaque values exactly; do not construct them. Projects pagination uses cursor only, without snapshot_id.

  1. Keep downloading until complete is true and next_cursor is null. An empty final result is a valid complete report.
  2. Build the new result separately. Replace the previous report only after every page has loaded successfully.
  3. On 410, discard the partial result and start again without snapshot_id or cursor. On 401 or 403, stop the import and check access.
  4. Snapshots are full replacements, not change feeds. Reconcile missing entries only against the same project and date range; v1 has no deletion events.

Refresh active periods on a schedule, for example every 15–60 minutes, and allow a manual refresh. Avoid downloading the entire history every minute. Recheck closed periods when corrections are expected.

Dates and time zones

period_start and period_end are inclusive local dates in YYYY-MM-DD format. timezone is an IANA name, for example Europe/Kyiv. The API selects intervals overlapping the period, accounting for daylight saving changes, and returns each original interval in full.

For a report ending on 18 November, a session from 18 November 23:30 to 19 November 00:30 is returned with seconds = 3600. Only 1800 seconds belong to the 18 November report. Convert local midnight boundaries to UTC and clip intervals before summing adjacent periods. Do not assume every local day has 24 hours.

Limits and errors

Plan your requests

Requests
120 per minute per key
New entry snapshots
6 per minute per key
Page size
Up to 1000 records
Reporting period
Up to 366 inclusive days
Snapshot size
Up to 20,000 entries
Snapshot lifetime
30 minutes, or until the key expires if sooner
HTTPCodesWhat to do
400invalid_query · invalid_period · invalid_cursor · snapshot_mismatch · https_requiredFix the parameters, date range, HTTPS URL or cursor; do not retry unchanged requests indefinitely.
401invalid_tokenCheck whether the key is missing, expired, replaced or revoked.
403project_not_allowed · scope_changedStop importing and review the project grant or changed access scope.
404not_found · snapshot_not_foundCheck the route or identifier format.
410snapshot_expiredDiscard the partial download and restart the full snapshot.
413snapshot_too_largeSplit the reporting period into smaller ranges.
429rate_limited · snapshot_capacityRespect Retry-After and retry with bounded exponential backoff and jitter. Keep the last complete report.
503integration_unavailable · snapshot_busy · snapshot_unavailable · temporarily_unavailableKeep the last complete report. Respect Retry-After; contact support if service access is unavailable.
405method_not_allowedUse GET, HEAD or OPTIONS.

Errors have the form {"error":"code"}. Additional shared storage limits can temporarily reject a new snapshot. Do not bypass a limit by switching keys or silently publish an incomplete result.

Python example

This server-side example gathers a complete project snapshot. Set EXPANS_API_KEY and EXPANS_PROJECT_ID through your server configuration. On an HTTP error it stops without returning a partial report; use the error table to decide whether to retry or restart. Never log the Authorization header.

Python 3 · urllib

import json
import os
from urllib.parse import quote, urlencode
from urllib.request import Request, urlopen


def load_entries(project_id, start, end, timezone="Europe/Kyiv"):
    key = os.environ["EXPANS_API_KEY"]
    url = "https://track.expans.ua/integrations/client-portal/v1/projects/"
    url += quote(project_id, safe="") + "/entries"
    query = {"period_start": start, "period_end": end, "timezone": timezone}
    records, seen = [], set()
    snapshot = None
    while True:
        request = Request(url + "?" + urlencode(query),
                          headers={"Authorization": "Bearer " + key})
        with urlopen(request, timeout=30) as response:
            page = json.load(response)
        if snapshot is not None and page["snapshot_id"] != snapshot:
            raise ValueError("Snapshot changed; discard this import")
        snapshot = page["snapshot_id"]
        records.extend(page["records"])
        cursor = page["next_cursor"]
        if page["complete"] is True and cursor is None:
            return records
        if page["complete"] is not False or not cursor or cursor in seen:
            raise ValueError("Invalid continuation; discard this import")
        seen.add(cursor)
        query.update(snapshot_id=snapshot, cursor=cursor)


entries = load_entries(os.environ["EXPANS_PROJECT_ID"], "2026-11-01", "2026-11-30")
print(len(entries))
Download OpenAPI 3.1 ↓