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.
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 /healthCheck the key and service readiness. Authentication is required.
GET /projectsList projects allowed by this key. Continue with cursor if complete is false.
GET /projects/{project_id}/entriesRead 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.
curl --fail-with-body --config - <<EOF
url = "https://track.expans.ua/integrations/client-portal/v1/health"
header = "Authorization: Bearer ${EXPANS_API_KEY}"
EOFcurl --fail-with-body --config - <<EOF
url = "https://track.expans.ua/integrations/client-portal/v1/projects"
header = "Authorization: Bearer ${EXPANS_API_KEY}"
EOFOne project, one reporting period
| Parameter | Required | Meaning |
|---|---|---|
period_start | Yes | First local date, YYYY-MM-DD |
period_end | Yes | Last local date, YYYY-MM-DD |
timezone | Yes | IANA time zone, such as Europe/Kyiv |
snapshot_id | Continuation | Snapshot ID from the first response |
cursor | Continuation | Exact next_cursor from the previous page |
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{
"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
| Field | What it means |
|---|---|
entry_id | Opaque entry ID. Treat it as a string. |
project_id | Project ID returned by the project list. |
revision | Entry revision, returned as a string. |
started_at | Start of the original interval in UTC. |
ended_at | End of the original interval in UTC. |
seconds | Full original duration, floored to whole seconds. Clip it to your report period. |
category | Work category name; empty for internal projects or missing data. |
client_title | Task title, up to 500 characters; links removed. Empty for internal projects or missing data. |
work_id | Opaque grouping ID within a project and client. Do not parse it or use it as an entry ID. |
deleted | Always 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.
- Keep downloading until complete is true and next_cursor is null. An empty final result is a valid complete report.
- Build the new result separately. Replace the previous report only after every page has loaded successfully.
- On 410, discard the partial result and start again without snapshot_id or cursor. On 401 or 403, stop the import and check access.
- 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
| HTTP | Codes | What to do |
|---|---|---|
| 400 | invalid_query · invalid_period · invalid_cursor · snapshot_mismatch · https_required | Fix the parameters, date range, HTTPS URL or cursor; do not retry unchanged requests indefinitely. |
| 401 | invalid_token | Check whether the key is missing, expired, replaced or revoked. |
| 403 | project_not_allowed · scope_changed | Stop importing and review the project grant or changed access scope. |
| 404 | not_found · snapshot_not_found | Check the route or identifier format. |
| 410 | snapshot_expired | Discard the partial download and restart the full snapshot. |
| 413 | snapshot_too_large | Split the reporting period into smaller ranges. |
| 429 | rate_limited · snapshot_capacity | Respect Retry-After and retry with bounded exponential backoff and jitter. Keep the last complete report. |
| 503 | integration_unavailable · snapshot_busy · snapshot_unavailable · temporarily_unavailable | Keep the last complete report. Respect Retry-After; contact support if service access is unavailable. |
| 405 | method_not_allowed | Use 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.
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))