Skip to content
OpenTrain AIOpenTrain AIOpenTrain AIDocs

Ask OpenTrain

Answers from the documentation, with sources.

What would you like to do with OpenTrain?

AI answers can be mistaken. Check the linked sources. Don’t include private account information.

Open app

DEVELOPER DOCUMENTATION

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/api/partner/v1/contracts/{contractId}/usage

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.

contractIdstringpathrequired

The OpenTrain contract to attribute usage to.

entriesobject[]bodyrequired

1–100 usage entries. One entry per (worker, day).

Entry fields
workDatestringbodyrequired

Calendar day the work happened, as YYYY-MM-DD (UTC). Cannot be in the future.

workerOpentrainUserIdstringbody

OpenTrain user ID of the worker. Defaults to the contract’s hired AI trainer; if provided, it must match a participant on the contract.

totalSecondsnumberbody

Cumulative seconds worked that day, 0–86400. Consumes budget on PAY_PER_HOUR contracts (hours = seconds / 3600).

tasksCompletedintegerbody

Cumulative tasks completed that day. Non-negative. Informational on all payment types.

labelsCompletedintegerbody

Cumulative labels completed that day. Non-negative. Consumes budget on PAY_PER_LABEL contracts.

externalReportIdstringbody

Your report identifier for audit, max 200 characters.

contractIdstring

The contract the usage was recorded against.

acceptedinteger

Number of entries upserted.

budgetobject

The recomputed budget — same shape as GET /contracts/{contractId}/budget.

StatuscodeMeaning
400BAD_REQUESTInvalid entries: missing/malformed workDate, future date, totalSeconds out of range, negative counts, more than 100 entries, or workerOpentrainUserId not a participant on this contract
401UNAUTHORIZEDMissing, invalid, or revoked token
403FORBIDDENToken lacks usage:write
404NOT_FOUNDContract not found, or its job is not linked by this install
409CONFLICTContract has no hired AI trainer to attribute usage to