Skip to content
POST /billing/credit-grant

The same redeem as POST /billing/promotion-code, answered with the team's credits. Kept for clients that call it.

Request Body

codestring
Example: STARTUPS-7KQ2MZ4P
pro_continue_consentboolean

The person ticked "Pro continues after the credits", for an offer that asks it.

pro_continue_consent_textstring

The text of the box they ticked.

team_idstring · uuid

Or ?team_id=.

Response Body

resultobject

The team's credits. They add up: a team holds one live grant per offer it got. Draws take from the grant that ends first, then the oldest.

endedobject[]

The last 5 grants that ended, newest first.

19 properties
activated_atstring · date-time
amount_centsinteger

Credits given, in cents.

end_reasonstring

replaced only on grants from before credits added up.

Possible values:
expiredused_uprevokedenterprisereplaced
ended_atstring · date-time
expires_atstring · date-time
granted_atstring · date-time
idstring · uuid
includes_proboolean

Pro is turned on, paid by the credits, when they switch on.

left_centsinteger

Credits left, in cents. 0 once ended.

offer_idstring · uuid
offer_keystring
Example: startups
offer_namestring
Example: Truto for Startups
pays_forobject
2 properties
proboolean
usageboolean
pro_cap_centsinteger

The most these credits pay of Pro. Null for no cap.

pro_cap_left_centsinteger

What is left of pro_cap_cents. Null for no cap, and once ended.

pro_continue_askboolean

The card dialog asks whether Pro continues on the card after the credits end (pro_continue_consent).

pro_paid_by_creditsboolean

This grant pays Pro now.

statusstring

locked until the team saves a card.

Possible values:
lockedactiveended
team_offer_idstring · uuid
grantsobject[]

The live grants (not ended), the one that ends first first. Empty when there are none.

19 properties
activated_atstring · date-time
amount_centsinteger

Credits given, in cents.

end_reasonstring

replaced only on grants from before credits added up.

Possible values:
expiredused_uprevokedenterprisereplaced
ended_atstring · date-time
expires_atstring · date-time
granted_atstring · date-time
idstring · uuid
includes_proboolean

Pro is turned on, paid by the credits, when they switch on.

left_centsinteger

Credits left, in cents. 0 once ended.

offer_idstring · uuid
offer_keystring
Example: startups
offer_namestring
Example: Truto for Startups
pays_forobject
2 properties
proboolean
usageboolean
pro_cap_centsinteger

The most these credits pay of Pro. Null for no cap.

pro_cap_left_centsinteger

What is left of pro_cap_cents. Null for no cap, and once ended.

pro_continue_askboolean

The card dialog asks whether Pro continues on the card after the credits end (pro_continue_consent).

pro_paid_by_creditsboolean

This grant pays Pro now.

statusstring

locked until the team saves a card.

Possible values:
lockedactiveended
team_offer_idstring · uuid
pro_paid_by_creditsboolean

Credits pay Pro now.

pro_turn_off_lockedboolean

While true, DELETE /billing/add-on/pro is a 409.

pro_turn_off_opens_atstring · date-time

When Pro can be turned off, the 1st of the month the credits end in. The credits pay that month; the card pays from the month after.

total_amount_centsinteger

What the live grants gave, together.

total_left_centsinteger

Credits left across every live grant.

Errors

StatusDescription
400The code does not apply. truto_error_code: credit_code_invalid (unknown or paused), code_expired (the link is past its redeem_by), credit_code_expired (the offer ended), credit_code_used_up, credit_code_locked (this link is for another email), credit_code_not_eligible (the offer is not for this team), promotion_closed (the offer is paused, not started, ended or full), credit_invoiced_team (an Enterprise team, paid by invoice), promotion_redeemed (the team already has this offer from another code).
403Forbidden if the caller is not an admin of the team
curl -X POST 'https://api.truto.one/billing/credit-grant' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "team_id": "your_team_id",
  "code": "STARTUPS-7KQ2MZ4P",
  "pro_continue_consent": true,
  "pro_continue_consent_text": "your_pro_continue_consent_text"
}'
const body = {
  "team_id": "your_team_id",
  "code": "STARTUPS-7KQ2MZ4P",
  "pro_continue_consent": true,
  "pro_continue_consent_text": "your_pro_continue_consent_text"
};

const response = await fetch('https://api.truto.one/billing/credit-grant', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
import requests

url = "https://api.truto.one/billing/credit-grant"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "team_id": "your_team_id",
    "code": "STARTUPS-7KQ2MZ4P",
    "pro_continue_consent": True,
    "pro_continue_consent_text": "your_pro_continue_consent_text"
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())