Enter a commitment
Agrees to the published commitment terms: a volume of ehu per
month for the term the terms set, starting on the first day of next
month, billed at the commitment price whether or not it is used.
This is a binding agreement; read terms.body from
GET /api/v1/billing/commitment first.
acceptedmust betrue, andterms_versionmust be the version of the terms you read; if the terms have changed since, the request is refused with 409TERMS_CHANGED.ehumust be above zero.- With a commitment already running, only a larger
ehuis accepted (409NOT_AN_INCREASEotherwise). The running one then ends without any early-termination charge and the new one starts next month. To commit to less, end the current commitment first.
The acceptance records the terms version, who accepted (the person behind a personal key, or the organization key) and the address the request came from. Answers with the new commitment state.
Requires the billing:commitment:write scope.
Authorization
Request body required
ehunumber requiredEHU committed per month.terms_versioninteger requiredTheterms.versionyou read and agree to.acceptedboolean requiredMust betrue.
Responses
200
The commitment was recorded.
dataCommitmentStateShow CommitmentState properties
termsCommitmentTermsShow CommitmentTerms properties
versionintegerbodystringThe full text of the agreement.body_sha256stringterm_monthsintegerpublished_atstring (date-time)
activeCommitmentShow Commitment properties
idintegerorg_idstringehu_per_monthnumberstarts_onstring (date-time)The first day of the first committed month.ends_onstring (date-time)The first day after the term (exclusive).statusstringterms_versionintegerterms_sha256stringThe hash of the agreement text that was accepted.accepted_atstring (date-time)accepted_bystringThe person, or the organization key, that accepted.accepted_ipstringterminated_atstring (date-time)terminated_fromstring (date-time)The first month no longer committed, for an ended commitment.terminated_bystringclawback_usdnumberThe early-termination charge.clawback_invoice_idstringclawback_invoice_urlstring (uri)clawback_invoice_pdf_urlstring (uri)clawback_invoiced_atstring (date-time)ending_notice_atstring (date-time)When the organization was told the term is nearly over.created_atstring (date-time)
starts_onstring (date-time)When a commitment agreed now would start.estimated_clawback_usdnumberWhat ending the active commitment today would cost; 0 without one.commitment_usd_per_ehunumberon_demand_usd_per_ehunumberhistoryarray of CommitmentThe last 24 commitments.Show Commitment properties
idintegerorg_idstringehu_per_monthnumberstarts_onstring (date-time)The first day of the first committed month.ends_onstring (date-time)The first day after the term (exclusive).statusstringterms_versionintegerterms_sha256stringThe hash of the agreement text that was accepted.accepted_atstring (date-time)accepted_bystringThe person, or the organization key, that accepted.accepted_ipstringterminated_atstring (date-time)terminated_fromstring (date-time)The first month no longer committed, for an ended commitment.terminated_bystringclawback_usdnumberThe early-termination charge.clawback_invoice_idstringclawback_invoice_urlstring (uri)clawback_invoice_pdf_urlstring (uri)clawback_invoiced_atstring (date-time)ending_notice_atstring (date-time)When the organization was told the term is nearly over.created_atstring (date-time)
400
The body is not JSON (INVALID_BODY), accepted is not true (TERMS_NOT_ACCEPTED), or ehu is not above zero (INVALID_AMOUNT).
errorobject requiredcodestring requiredmessagestring requiredrequest_idstring
401
No API key was sent, or it is unknown, revoked or expired (UNAUTHORIZED).
errorobject requiredcodestring requiredmessagestring requiredrequest_idstring
403
The key lacks the scope this endpoint needs (FORBIDDEN).
errorobject requiredcodestring requiredmessagestring requiredrequest_idstring
409
Commitments are not being offered (TERMS_UNAVAILABLE), the
terms changed since the version you sent (TERMS_CHANGED), the
new volume is not larger than the running one (NOT_AN_INCREASE),
or a commitment is already running (COMMITMENT_EXISTS).
errorobject requiredcodestring requiredmessagestring requiredrequest_idstring
429
Too many requests (RATE_LIMITED). Wait for Retry-After seconds.
Retry-AfterintegerSeconds to wait before retrying.
errorobject requiredcodestring requiredmessagestring requiredrequest_idstring
500
The commitment could not be recorded (COMMITMENT_FAILED). Retry later.
errorobject requiredcodestring requiredmessagestring requiredrequest_idstring
Example request
curl -X POST 'https://evohub.io/api/v1/billing/commitment' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"ehu": 5000,
"accepted": true,
"terms_version": 1
}'
