Sim BillingPeriod subresource
Access Super SIM billing data
https://supersim.api.korewireless.com/v1/Sims/{sid}/BillingPeriodsA Sim whose status is new will not have any BillingPeriods. A Sim's first BillingPeriod will be created when its status is updated to ready or active and will begin at the time denoted by the BillingPeriod's start_time. Events set to occur at the start of the BillingPeriod will take place. When a BillingPeriod expires — i.e., the current time is after the BillingPeriod's end_time — any events set to occur at the end of the BillingPeriod will take place. Unless the Sim's status is inactive, when its BillingPeriod expires a new one will be created. This process will be repeated for as long as the Sim's status continues to be active.
Currently, only a Sim's current or most recent BillingPeriod will be returned when reading a Sim's BillingPeriods. It will be returned as a single result in an array. In a future release, we will add the ability to view previous BillingPeriods as a paginated list.
BillingPeriod types
This section describes the behavior of each type of BillingPeriod as indicated by the BillingPeriod's period_type.
Ready BillingPeriods
A Sim resource's status can only be updated to ready from new. When this change occurs, a ready BillingPeriod resource will be created starting at that time. The ready BillingPeriod's end_time indicates when the Sim resource's status will automatically transition from ready to active if no other transition criteria are met. When a Sim's status is ready, the SIM it represents may connect to the cellular networks without incurring a monthly subscription fee until either the ready BillingPeriod expires, or some amount of data/SMS Command usage occurs, whichever comes first. Learn more about each Sim resource status.
Active BillingPeriods
A new active BillingPeriod will be created in either of these cases:
A Sim's
statusis updated toactiveand there is not already an unexpired active BillingPeriod for that Sim.An active BillingPeriod expires and the
statusof the Sim to which it belongs is stillactive.
When an active BillingPeriod is created, the monthly active SIM subscription fee will be charged. If a Sim's status is updated to inactive before the current active BillingPeriod expires, no new BillingPeriod will be created. If Sim's status is later changed back to active, a new active BillingPeriod will be created starting at that time.
Each SIM has a data limit dictated by the Fleet to which its Sim resource has been assigned. Data usage is counted during the Sim's current active BillingPeriod and compared to the Sim's data limit. If the count reaches the limit, the SIM will be blocked from using any more data until the active BillingPeriod expires. When an active BillingPeriod expires, the data usage counter is reset to zero. If a SIM has been blocked from using data because it exceeded its data limit, it will be able to resume using data at this point.
API Authorization
Before you can make requests to this resource, you must have a valid bearer token. Review our API authorization guide to learn how to generate a token. Here's a curl example on how to define your access token in a header:
curl -L "https://supersim.api.korewireless.com/v1/Sims" -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" The examples below do not show the required Authorization header due to a bug. We're working on fixing that. In the meantime, be sure to include that in all of your requests.
Read multiple BillingPeriod
As noted above, currently only a Sim's current or most recent BillingPeriod will be returned in the results.
Retrieve a list of Billing Periods for a Super SIM.
The SID of the Super SIM to list Billing Periods for.
How many resources to return in each list page. The default is 50, and the maximum is 1000.
The page index. This value is simply for client state.
The page token. This is provided by the API.
OK
curl -L "https://supersim.api.korewireless.com/v1/Sims/<Sid>/BillingPeriods" --header "Authorization: Bearer <YOUR_AUTH_TOKEN>"
OK
{
"billing_periods": [],
"meta": {
"page": 0,
"page_size": 50,
"first_page_url": "https://supersim.api.korewireless.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods?PageSize=50&Page=0",
"previous_page_url": null,
"url": "https://supersim.api.korewireless.com/v1/Sims/HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/BillingPeriods?PageSize=50&Page=0",
"next_page_url": null,
"key": "billing_periods"
}
}How to check if a SIM has hit its data limit
As indicated above, the Sim's current active BillingPeriod is used to determine whether a SIM has exceeded its data limit. A SIM will be blocked if it has used more data between the BillingPeriod's start_time and end_time than permitted by the Sim's Fleet. To determine what percentage of a SIM's data limit has been used, follow these steps:
Fetch the Sim's Fleet using the value from the Sim's
fleet_sid.Extract the
data_limitvalue.Fetch the Sim's current active BillingPeriod.
Use the current active BillingPeriod's
start_timeandend_timevalues along with the Sim's SID to query the UsageRecords resource. If you didn't provide a value for theGranularityquery parameter, you will only receive one record in the results. This represents the aggregated usage over the request period.Extract the
data_totalvalue.Divide
data_totalby the Fleet'sdata_limitto determine what percentage of the SIM's data limit has been used.
Last updated
Was this helpful?