Documentation
Credit and usage
View .mdOpenAPI

Check or hold an amount of credit

POSThttps://weights.fyi/run/v1/reservationsscope: submit
text
POST https://weights.fyi/run/v1/reservations
Authorization: Bearer <token>                    scope: submit
Content-Type: application/json
Available since
Not available yet: built on 2026-11-14, live with the deploy that carries it.
Answer time
synchronous: the answer is read from your account's records at once.

Asks whether an amount of credit can be reserved, or reserves it. With dry_run: true the call only answers: it compares the amount with your available credit and, when correlation names one of your compute plans, with what that plan's lifetime budget has left. Nothing is held or written, so a runner can ask before it starts a wave of work.

Without dry_run the amount is held until you release it with DELETE /v1/reservations. A hold sets credit aside from everything else your account does, and counts against the plan it was taken for. Later calls do not draw it down: each reserves its own usage as before. Release the hold before the work it was held for starts to spend.

Request

NameWhereRequiredMeaning
AuthorizationheaderyesBearer and a token that holds submit.
amount_usd_microsbodyyesThe amount, a positive integer of micro-USD.
dry_runbodynotrue to ask only. false when left out.
correlationbodynoAn object of campaign_id, run_id and stage_id, each optional: the compute plan and stage the amount belongs to. campaign_id is the plan's id, or the campaign id its submission declared under metadata.correlation.
reservation_idbodynoYour own id for the hold, 1 to 128 letters, digits and . _ : -. Sending the request again with it finds the hold instead of taking a second one.

Return value

200 OK for a dry run, with admissible and, when it is false, the reason a hold would be refused with. 201 Created with the hold when one was taken; 200 OK with the same hold when its reservation_id was sent before.

FieldMeaning
admissibleA dry run: whether a hold of this amount would be taken now.
reason, detailA dry run that is not admissible: credit_exhausted or compute_plan_conflict, and what it rests on.
creditA dry run: available_usd_micros and whether it is sufficient.
planThe plan the correlation resolved to, with its budget, what is committed, reserved and remaining; null when none matched.
not_checkedA dry run: what the answer does not cover. A token's daily spend cap is one.
reservation_id, state, amount_usd_micros, created_atA hold: its id, held, the amount and when it was taken.

Errors

StatusCodeWhen it happensWhat to do
400invalid_json, invalid_reservationThe body is not what the call takes; field names the part.Fix the field.
401unauthorized, invalid_token, token_revoked, token_expiredNo token, or one that does not work (any more).Use a valid token.
402credit_exhaustedA hold: your credit, or the plan's budget (reason), does not cover the amount.Add credit, or reserve less.
403scope_required, account_suspendedThe token lacks submit, or the account is suspended.Use a token with submit.
409compute_plan_conflictA hold: the plan has ended, or the correlation matches more than one plan.Name one running plan.
409reservation_conflictThe reservation_id holds another amount, or was released.Use a new id.
429rate_limitedThe token's request rate.Wait Retry-After.
503reservation_authority_unavailableThis deployment answers dry runs only.Send dry_run: true.

Examples

sh
curl -s -X POST https://weights.fyi/run/v1/reservations -H "Authorization: Bearer $WEIGHTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount_usd_micros": 2500000, "dry_run": true, "correlation": {"campaign_id": "rattle-w44", "run_id": "night-run-44"}}'
json
{
  "object": "reservation",
  "dry_run": true,
  "amount_usd_micros": 2500000,
  "admissible": true,
  "reason": null,
  "credit": {"available_usd_micros": 18400000, "sufficient": true},
  "plan": {"plan_id": "cp_night_44", "stage_id": null, "state": "executing", "runnable": true,
           "budget_usd_micros": 40000000, "committed_usd_micros": 1200000, "reserved_usd_micros": 0,
           "remaining_usd_micros": 38800000, "sufficient": true},
  "correlation": {"campaign_id": "rattle-w44", "run_id": "night-run-44", "matched": true},
  "not_checked": ["token_daily_cap"]
}

History

  • 2026-11-14: built, with the dry run and the hold.

See also

GET /v1/reservations, DELETE /v1/reservations, GET /v1/usage.