# Subscription

Subscriptions are tied to a user and are created once a user has a plan and SIM. This allows connectivity for their device and SIM.

## Properties

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `object` | string | Yes | Type of object is always `subscription`. |
| `id` | string | Yes | Unique identifier for the subscription. |
| `metadata` | object | Yes | A set of key-value pairs, to store [metadata](https://developers.gigs.com/docs/core/metadata) related to the resource. |
| `activatedAt` | string,null | Yes | Time when the subscription was activated. |
| `billing` | object,null | Yes | Billing details for the subscription. Present when Billing is enabled on your project. |
| `canceledAt` | string,null | Yes | Time when the subscription was canceled. |
| `cancellationDetails` | object,null | Yes | Details about the cancellation of the subscription. |
| `createdAt` | string | Yes | Time when the subscription was created. |
| `currentPeriod` | mixed | Yes | Current subscription period. Only present for active subscriptions. |
| `earliestEndAt` | string,null | Yes | Earliest time at which the subscription can currently be ended. This depends on the minimum period of the plan. This value is present after the first period has already started, and before the subscription has ended."  |
| `endedAt` | string,null | Yes | Time when the subscription will end or has ended. This field is populated in different scenarios: - When a subscription is canceled, this represents the future date when it will be terminated - When a subscription has already ended, this represents the past date when it was terminated - For active subscriptions, this field is null  |
| `firstUsageAt` | string,null | Yes | Time when the subscription was first used. |
| `lastPorting` | mixed | Yes | Last porting (if any) related with the subscription. |
| `phoneNumber` | string,null | Yes | The phone number attached to the SIM in E.164 string_format. Only available for voice plans. |
| `plan` | object | Yes | Plans define the network options and parameters offered to the end user, e.g. 'Unlimited data, voice & text'. Plan allowances (data, sms, voice) and limits are configurable, and Gigs will work with you to find the best balance for your users. |
| `restrictedAt` | string,null | Yes | Time when the subscription was restricted. |
| `restrictionDetails` | object,null | Yes | Details about the restriction applied to the subscription. Present when the subscription is restricted. |
| `sim` | mixed | Yes |  |
| `status` | pending | initiated | active | restricted | ended | Yes | The current status of the subscription. Note that the `initiated` status is currently only available when using the Billing API, where it implies that the subscription's first invoice has not yet been paid.  |
| `user` | object | Yes | Users are end consumers of subscriptions. Users can have multiple devices, SIMs, and subscriptions. |
| `userAddress` | string,null | Yes | Current [user address](https://developers.gigs.com/core/user-addresses#the-user-address-resource) identifier (if any) related with the subscription. |
| `porting` | mixed | Yes | First porting requested by the user. Refer to `lastPorting` to get the latest porting information. |
