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

Approve Milestone

Request payment release for a funded milestone — returns a pending approval a human must co-sign before payout.

POST/api/public/v1/milestones/{milestoneId}/approve

Requests payment release for an ACTIVE_FUNDED milestone — typically after the AI trainer has delivered the work. This call never releases money. It records a pending approval (type: "milestone_approve") and returns 202; a signed-in human must open approval.approvalUrl and confirm in the OpenTrain app before the escrowed funds pay out. Approvals expire after ~72 hours.

Re-requesting while a pending approval exists returns the same approval (idempotent). Learn the outcome by polling GET /approvals/{id} or watching for the approval.confirmed event on GET /updates. The request has no body.

Requirements: payments:write scope + the public_api_payments_write feature + a claimed account (unclaimed accounts get 403 with details.reason: "account_claim_required" and a claimUrl). The milestone must be ACTIVE_FUNDEDfund it first.

milestoneIdstringpathrequired

The milestone to release payment for. Must be ACTIVE_FUNDED, not cancelled, on an active contract you own.

Returns 202 — the request is recorded, nothing has been released yet.

approvalobject

The pending approval, in the same shape as GET /approvals/{id}: {id, type: "milestone_approve", status: "pending", contractId, milestoneId, jobId, proposalId: null, approvalUrl, expiresAt, resolvedAt, result, createdAt}.

messagestring

Explains that a signed-in human must confirm the approval before any money moves.

StatuscodeMeaning
401UNAUTHORIZEDMissing or invalid token
403FORBIDDENMissing payments:write scope, public_api_payments_write disabled, or account not claimed (details.reason: "account_claim_required", details.claimUrl)
404NOT_FOUNDNo such milestone, or its contract is on another account
409CONFLICTSee the reason catalog below
details.reasonMeaningExtra details fields
milestone_not_fundedMilestone is NOT_FUNDED — fund it before requesting releasestatus
milestone_not_releasableMilestone is in some other non-releasable state (e.g. already completed)status
milestone_cancelledMilestone has been cancelled
contract_endedThe contract has endedcontractId