Firsty

Search...

Search...

Subscription PlansExperimental

Create a subscription plan

Creates a subscription plan that bundles the included package plans and renews on its renewal schedule.

post/subscription-plans

Authorization

Authorization: Bearer {token} — an OAuth2 access token from the client-credentials flow. How authentication works

Headers

X-Idempotency-Keystring

Optional idempotency key for requests that change state. If provided, duplicate requests with the same key within 48 hours will return the cached original response without duplicating side effects.

Behavior:

  • Same key + same method, path and request body → returns cached response (prevents duplicate operations)
  • Same key + different method, path or request body → returns 422 error
  • Same key + in-flight request → returns 423 error
  • Keys are held for at least 48 hours; use a fresh key for every new request

Request Body Matching: Request bodies are compared by their JSON content. Object key order, including in nested objects, and whitespace do not affect matching. This means:

  • {"a":1,"b":2} and {"b":2,"a":1} are treated as identical ✓
  • Whitespace differences are ignored ✓
  • The method and the full path, query included, must match as well; headers are not compared

Best Practices:

  • Use UUIDs or client-generated unique strings
  • Store keys on your side to support retries
  • Don't reuse keys across different operations

Request body

application/json · required

namestringrequired
includedPlanReferencesarray of PlanReferencerequired

The plan references of the package plans the subscription plan includes. The list is always the whole set, so an update replaces it rather than adding to it. Each package plan must be available to your account, have alignment relative, and have a validity at least as long as the subscription plan's renewal period. Where the two use different units, a month of validity counts as 28 days and a monthly renewal as 31. Otherwise the request is refused with a 400.

renewalone of Monthly renewal | Daily renewalrequired

Required immutable cadence, calculated from the subscription's original UTC anchor.

Show properties
Monthly renewalobject
Show properties
unitstringrequired
countintegerrequired
Daily renewalobject
Show properties
unitstringrequired
countintegerrequired

Responses

200Requested or post-mutation subscription planapplication/json
Show response body
dataobject
Show properties
subscriptionPlanReferencestring

Subscription-plan reference.

namestring
renewalone of Monthly renewal | Daily renewal

Required immutable cadence, calculated from the subscription's original UTC anchor.

Show properties
Monthly renewalobjectoptional
Show properties
unitstring
countinteger
Daily renewalobjectoptional
Show properties
unitstring
countinteger
revisioninteger
includedPackagePlansarray of PackagePlan

The package plans this revision includes.

Show properties
planReferencestring

Plan reference

namestring
typestring

Extensible enum. Package type: data for mobile data, sms for text messaging, voice for calls, voice_sms for one allowance that calls and text messages both draw on.

Examplesdatasmsvoicevoice_sms
allowanceobject

What a package of the plan can use, for each renewal cycle of a recurring plan and for the whole validity of any other plan. Carries either count or unlimited, never both.

Show properties
unitstring

Extensible enum. Unit a package's amounts are expressed in, determined by the package type: mb for data, seconds for voice, sms for text messages and units for voice and SMS, where a call minute and a text message each count as one unit. A package's amounts and its plan's allowance count the same megabyte, so they compare directly.

Examplesmbsecondssmsunits
countintegeroptional

The allowance in unit. Absent when the allowance is unlimited.

unlimitedbooleanoptional

Present, as true, when the allowance has no limit; count is then absent.

speedKbpsintegeroptional

Speed cap in kilobits per second. Absent when the speed is not capped.

throttleobjectoptional

Data the package keeps at a reduced speed once its allowance is used up. Carries either count or unlimited, never both. Absent when the plan has no reduced speed.

Show properties
countintegeroptional

The reduced-speed data, in the allowance's unit. Absent when it is unlimited.

unlimitedbooleanoptional

Present, as true, when the reduced-speed data has no limit; count is then absent.

speedKbpsinteger

The reduced speed in kilobits per second.

capacityMbinteger | nullDeprecated

Use allowance. The allowance of a data plan in megabytes; null for any other type or an unlimited plan.

speedKbpsinteger | nullDeprecated

Use allowance.speedKbps. Speed cap in kilobits per second; null when the speed is not capped.

throttleCapacityMbinteger | nullDeprecated

Use allowance.throttle. Reduced-speed data in megabytes once the allowance is used up; null when that data is unlimited or the plan has no reduced speed.

throttleSpeedKbpsinteger | nullDeprecated

Use allowance.throttle. Reduced speed in kilobits per second once the allowance is used up; null when the plan has no reduced speed.

smsCountinteger | nullDeprecated

Use allowance. The allowance of an SMS plan in messages; null for any other type or an unlimited plan.

voiceSecondsinteger | nullDeprecated

Use allowance. The allowance of a voice plan in seconds; null for any other type or an unlimited plan.

validityobject

How long a package of this plan stays valid; indefinite when its packages never expire.

Show properties
unitstring

Extensible enum. minute, day, month or indefinite. With relative alignment a day is 24 hours and a month ends on the same day of the month, or on the last day of a shorter month; with calendar alignment a day ends at midnight and a month at 00:00 on the 1st.

Examplesdaymonthindefinite
countinteger
renewalobject | null

How often a recurring plan's allowance renews. Null for a non-recurring plan.

Show properties
unitstring

Extensible enum. minute, day, month or indefinite. With relative alignment a day is 24 hours and a month ends on the same day of the month, or on the last day of a shorter month; with calendar alignment a day ends at midnight and a month at 00:00 on the 1st.

Examplesdaymonthindefinite
countinteger
alignmentstring

Extensible enum. Where the plan's validity and renewal boundaries fall. relative: every boundary is counted from the moment the package's validity starts. calendar: every boundary falls at midnight, or at 00:00 on the 1st for a duration in months, in the local time of the plan's network; the first period is shorter and carries the plan's full allowance.

Examplesrelativecalendar
validityMinutesintegerDeprecated

Use validity. The validity in minutes, a month counted as 30 days.

coverageobject

Where the plan works.

Show properties
regionNamestring

Name of the plan's region

countryCodesarray of string

ISO 3166-1 alpha-2 codes of the countries the region's plans work in, whether or not the country has plans of its own. Besides the assigned codes, the list can hold XK (Kosovo), which ISO leaves to users, and AN (Netherlands Antilles) and TA (Tristan da Cunha), which ISO reserves. A single-country region lists its own country.

countryCodestring | nulloptionalDeprecated

The code of the plan's country (e.g. 'NL'), or global for a plan whose region covers several countries.

recurringboolean

Whether this plan auto-renews when it expires

renewalPeriodMinutesinteger | nullDeprecated

Use renewal. The renewal cycle in minutes, a month counted as 30 days; null for a non-recurring plan.

createdAtstring · date-time
updatedAtstring · date-time
400Bad request - invalid parameters401Unauthorized - missing or invalid API key404Resource not found409Request with this idempotency key is still being processed