Altorney Public API
Read access, for your own systems, to one company's Altorney data: time entries, daily and weekly time summaries, cases, case roles and case metrics.
Version 1.0.0.
Authentication
A credential is created under Manage Company → API Credentials; its client secret is shown once. Request a token with the OAuth 2.0 client_credentials grant (POST https://portal.altorney.com/api/oauth/token, form-encoded, optional space-separated scope) and send it as Authorization: Bearer <access_token>; a token is valid for expires_in seconds (60 minutes by default). Every call runs as the credential's connected user, narrowed by the token's scopes: time:read (time entries, summaries, cases, roles), time:read.financial (the financial blocks of those four; it opens no endpoint of its own) and metrics:read (case metrics). GET /api/v1/me shows what a token can do. The API is server-to-server only: it sends no CORS headers.
Conventions
Dates are YYYY-MM-DD; instants are ISO 8601 UTC with a trailing Z and up to nine fractional digits. Identifiers are GUID strings. Enum values travel by their exact names, each prefixed with its enum's name (TIME_ENTRY_STATUS_APPROVED, CASE_STATUS_ACTIVE), in responses and in parameters alike. A query parameter sent empty (?caseId=) counts as not sent. A field without a value is null, never left out. Money is USD and appears only in financial blocks, which are null when the token lacks time:read.financial or the connected user lacks the Financial permission. Related objects are nested: a time entry carries case, reviewer and role objects with their ids; /cases and /cases/{id}/roles resolve the case and role ids.
Pagination
Lists return { "items": [...], "nextCursor": "..." }. Pass nextCursor back as cursor until a page comes with nextCursor null; limit is 1..500 (default 100). Cursors are opaque keyset positions: follow them rather than sorting client-side, and upsert a row that comes back again.
Keeping data in sync
Time entries: store the largest updatedAt seen and request updatedSince = that value minus 5 minutes on each run, upserting by id. updatedAt moves when the entry is saved; names, codes and recalculated costs read from related records do not move it, and a deleted entry simply stops appearing, and so does an entry of a case the connected user no longer has access to, so re-pull in full periodically and delete what did not come back. Summaries have no updatedSince: re-pull a trailing window, upsert by key and delete the rows of the window that did not come back. Cases and roles: re-pull the lists on every sync. Metrics: re-pull when asOf moves, and whenever you need a current docsReviewed, which is counted live.
Errors and rate limits
Errors are google.rpc.Status bodies, { "code": 5, "message": "...", "details": [{ "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "NOT_FOUND", "domain": "altorney.com", "metadata": {} }] }; branch on details[0].reason: INVALID_REQUEST (400), INVALID_TOKEN (401), INSUFFICIENT_SCOPE (403, with metadata.scope) or INSUFFICIENT_ACCESS (403), NOT_FOUND (404), METHOD_NOT_ALLOWED (405), RATE_LIMITED (429, with Retry-After) and SERVER_ERROR (500). A parameter that cannot be read at all (an enum value that does not exist, a number that does not parse, a repeated parameter) is a 400 with an empty details and a message that does not always name the parameter. The token endpoint answers OAuth 2.0 errors instead (error, error_description), except its 429, which is the same RATE_LIMITED error. By default a credential may make 120 requests per minute and run 2 summary or metrics requests at once; the token endpoint allows 30 requests per minute per IP. After a 429, wait Retry-After seconds and repeat the same request; cursors stay valid.
Stability
Version 1 changes only additively: new optional fields, endpoints and enum values may appear, so ignore what you do not know. Breaking changes ship under /api/v2/; a v1 route to be retired is announced 6 months ahead and answers with Deprecation and Sunset headers until then.

