DEVELOPER DOCUMENTATION
Fund Existing Milestone with Admin Balance
Apply restricted admin-balance funding to an existing eligible unfunded milestone without creating a duplicate.
/api/public/v1/contracts/{contractId}/admin-balance-milestones/{milestoneId}/fundApplies OpenTrain’s restricted ADMIN_BALANCE funding marker to one existing eligible NOT_FUNDED milestone. The operation updates that milestone in place; it never creates a replacement contract or milestone.
This endpoint is available only to eligible OpenTrain platform administrators in the canonical admin organization. It is deliberately separate from ordinary employer milestone funding, and it does not accept a client-controlled funding source.
Success transitions the existing milestone to ACTIVE_FUNDED, moves $0, and creates no Stripe charge or PaymentIntent. Releasing payment later remains a separate human-authorized action.
Authorization and validation
Section titled “Authorization and validation”The server independently verifies every restricted platform-admin condition described on Create Admin-Balance Milestone. It also verifies that:
- the milestone belongs to the named contract and authorized organization;
- the milestone is still eligible and
NOT_FUNDED; - its amount, contract rate, and volume are internally consistent; and
- sequencing and unresolved-payment rules allow funding.
Request
Section titled “Request”contractIdstringpathrequiredContract that must own the milestone.
milestoneIdstringpathrequiredExisting eligible NOT_FUNDED milestone.
idempotencyKeystringbodyrequiredStable request key, 1–128 characters. Identical retries return the original result; conflicting reuse fails closed.
No funding-source field is accepted.
Response
Section titled “Response”Returns 200. The result includes the contract and job IDs, the existing milestone ID and new 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.fundAdminBalanceMilestone( '<CONTRACT_ID>', '<MILESTONE_ID>', { idempotencyKey: 'fund-existing-milestone-2026-09' });Errors
Section titled “Errors”| Status | Meaning |
|---|---|
400 | Invalid key or internally inconsistent amount/rate/volume data |
401 | Missing or invalid token |
403 | A restricted authorization condition failed, or a payment hold blocks the operation |
404 | Contract or milestone not found within the authorized organization boundary |
409 | Idempotency conflict, ineligible milestone state, existing funding-source conflict, or sequencing blocker |