Skip to main content
POST
/
creditgrants
Create a new credit grant
curl --request POST \
  --url https://api.cloud.flexprice.io/v1/creditgrants \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "cadence": "ONETIME",
  "credits": "<string>",
  "name": "<string>",
  "scope": "PLAN",
  "conversion_rate": "<string>",
  "expiration_duration": 123,
  "expiration_duration_unit": "DAY",
  "expiration_type": "NEVER",
  "metadata": {},
  "period": "DAILY",
  "period_count": 123,
  "plan_id": "<string>",
  "priority": 123,
  "subscription_id": "<string>",
  "topup_conversion_rate": "<string>"
}
'
{
  "cadence": "ONETIME",
  "conversion_rate": "<string>",
  "created_at": "<string>",
  "created_by": "<string>",
  "credit_grant_anchor": "<string>",
  "credits": "<string>",
  "end_date": "<string>",
  "environment_id": "<string>",
  "expiration_duration": 123,
  "expiration_duration_unit": "DAY",
  "expiration_type": "NEVER",
  "id": "<string>",
  "metadata": {},
  "name": "<string>",
  "period": "DAILY",
  "period_count": 123,
  "plan_id": "<string>",
  "priority": 123,
  "scope": "PLAN",
  "start_date": "<string>",
  "status": "published",
  "subscription_id": "<string>",
  "tenant_id": "<string>",
  "topup_conversion_rate": "<string>",
  "updated_at": "<string>",
  "updated_by": "<string>"
}

Authorizations

x-api-key
string
header
required

Enter your API key in the format x-api-key <api-key>*

Body

application/json

Credit Grant configuration

cadence
enum<string>
required
Available options:
ONETIME,
RECURRING
credits
string
required
name
string
required
scope
enum<string>
required
Available options:
PLAN,
SUBSCRIPTION
conversion_rate
string

amount in the currency = number of credits * conversion_rate ex if conversion_rate is 1, then 1 USD = 1 credit ex if conversion_rate is 2, then 1 USD = 0.5 credits ex if conversion_rate is 0.5, then 1 USD = 2 credits

expiration_duration
integer
expiration_duration_unit
enum<string>
Available options:
DAY,
WEEK,
MONTH,
YEAR
expiration_type
enum<string>
Available options:
NEVER,
DURATION,
BILLING_CYCLE
metadata
object
period
enum<string>
Available options:
DAILY,
WEEKLY,
MONTHLY,
ANNUAL,
QUARTERLY,
HALF_YEARLY
period_count
integer
plan_id
string
priority
integer
subscription_id
string
topup_conversion_rate
string

topup_conversion_rate is the conversion rate for the topup to the currency ex if topup_conversion_rate is 1, then 1 USD = 1 credit ex if topup_conversion_rate is 2, then 1 USD = 0.5 credits ex if topup_conversion_rate is 0.5, then 1 USD = 2 credits

Response

Created

cadence
enum<string>
Available options:
ONETIME,
RECURRING
conversion_rate
string

amount in the currency = number of credits * conversion_rate ex if conversion_rate is 1, then 1 USD = 1 credit ex if conversion_rate is 2, then 1 USD = 0.5 credits ex if conversion_rate is 0.5, then 1 USD = 2 credits

created_at
string
created_by
string
credit_grant_anchor
string
credits
string
end_date
string
environment_id
string
expiration_duration
integer
expiration_duration_unit
enum<string>
Available options:
DAY,
WEEK,
MONTH,
YEAR
expiration_type
enum<string>
Available options:
NEVER,
DURATION,
BILLING_CYCLE
id
string
metadata
object
name
string
period
enum<string>
Available options:
DAILY,
WEEKLY,
MONTHLY,
ANNUAL,
QUARTERLY,
HALF_YEARLY
period_count
integer
plan_id
string
priority
integer
scope
enum<string>
Available options:
PLAN,
SUBSCRIPTION
start_date
string
status
enum<string>
Available options:
published,
deleted,
archived
subscription_id
string
tenant_id
string
topup_conversion_rate
string

topup_conversion_rate is the conversion rate for the topup to the currency ex if topup_conversion_rate is 1, then 1 USD = 1 credit ex if topup_conversion_rate is 2, then 1 USD = 0.5 credits ex if topup_conversion_rate is 0.5, then 1 USD = 2 credits

updated_at
string
updated_by
string