Platform API reference
Report Usage
Report cumulative per-worker, per-day work totals (time, tasks, labels) on a linked contract. Idempotent upserts — re-POSTing never double counts.
POST
Reports work done on your platform against an OpenTrain contract. Entries are cumulative per-worker, per-day totals: each entry replaces the stored totals for its (worker,
workDate), so re-POSTing the same report — or a corrected one — is idempotent and never double counts. Fields omitted from an entry keep their previously stored values.
The response includes the recomputed budget. Crossing the 80% / 100% consumption thresholds emits milestone.budget_low / milestone.budget_depleted webhooks.
Requirements: usage:write scope, and the contract’s job must be referenced by a project link on the calling token’s install.
Request
The OpenTrain contract to attribute usage to.
1–100 usage entries. One entry per (worker, day).
Response
The contract the usage was recorded against.
Number of entries upserted.
The recomputed budget — same shape as
GET /contracts/{contractId}/budget.Errors
| Status | code | Meaning |
|---|---|---|
400 | BAD_REQUEST | Invalid entries: missing/malformed workDate, future date, totalSeconds out of range, negative counts, more than 100 entries, or workerOpentrainUserId not a participant on this contract |
401 | UNAUTHORIZED | Missing, invalid, or revoked token |
403 | FORBIDDEN | Token lacks usage:write |
404 | NOT_FOUND | Contract not found, or its job is not linked by this install |
409 | CONFLICT | Contract has no hired AI trainer to attribute usage to |