DEVELOPER DOCUMENTATION
Create Admin-Balance Milestone
Create and internally fund a later milestone through OpenTrain's restricted platform-admin workflow.
/api/public/v1/contracts/{contractId}/admin-balance-milestonesCreates a later milestone and marks it ACTIVE_FUNDED through OpenTrain’s restricted internal-balance workflow. This endpoint is for eligible OpenTrain platform administrators in the canonical admin organization; it is not an alternative funding method for ordinary employers.
At the funding step, the operation moves $0 and creates no Stripe charge or PaymentIntent. Releasing the funded milestone later is a separate action that still requires human authorization.
For hourly and per-label contracts, send a positive volume or omit it so OpenTrain derives the value from amountUsd and the canonical contract rate. When all three values are present, they must agree.
Authorization
Section titled “Authorization”The server independently verifies the restricted scope, claimed account, platform-admin status, canonical admin-organization membership, Admin Pay eligibility, matching token organization, target organization, and the default-off rollout. Possessing the scope alone never grants access.
Request
Section titled “Request”contractIdstringpathrequiredContract that will own the new milestone.
idempotencyKeystringbodyrequiredStable request key, 1–128 characters. Reuse it only for an identical retry.
milestone.descriptionstringbodyrequiredWork covered by the milestone.
milestone.amountUsdnumberbodyrequiredPositive milestone amount in USD.
milestone.volumenumberbodyPositive hours or labels for a volume-based contract. Omit to derive it from the amount and canonical rate.
milestone.namestringbodyOptional short milestone name.
milestone.dueDatestringbodyOptional ISO 8601 due date.
Response
Section titled “Response”Returns 201 for a new milestone or 200 for an identical idempotent replay. The result includes the contract and job IDs, the milestone ID and status, fundingSource: "ADMIN_BALANCE", moneyMoved: false, releaseRequiresHumanApproval: true, and idempotentReplay.
TypeScript SDK
Section titled “TypeScript SDK”@opentrain-ai/sdk 0.22.0 or later exposes the same operation:
import { OpenTrainClient } from '@opentrain-ai/sdk';
const opentrain = new OpenTrainClient({ apiToken: process.env.OPENTRAIN_API_TOKEN!,});
const result = await opentrain.createAdminBalanceMilestone('<CONTRACT_ID>', { idempotencyKey: 'later-milestone-2026-09', milestone: { description: 'Complete the approved bonus work', amountUsd: 300, volume: 2.5, },});Errors
Section titled “Errors”| Status | Meaning |
|---|---|
400 | Invalid key or milestone fields, including an invalid or inconsistent volume |
401 | Missing or invalid token |
403 | One or more restricted platform-admin authorization conditions failed |
404 | Contract not found within the authorized organization boundary |
409 | Conflicting idempotency reuse, an in-progress request, or a milestone sequencing conflict |