Skip to content

Purchased plans​

GET
/users/plans

Gets plans that are available for a user (already purchased or allocated)

Authorizations​

ApiKeyAuth

API Key for authentication. Retrieval from either API version login routes, or other authentication token type. See Authentication for more details.

Type
API Key (header: Authorization)
Example"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Parameters​

Query Parameters

consumed

Filter by plans that have already been consumed by devices or not

Type
boolean
deviceId

Filter by device ID, multiple device IDs can be passed as a comma separated list

Type
string
consumedSince

Filter by consumedOn start date

Type
string
consumedUntil

Filter by consumedOn end date

Type
string
planId

Filter by plan id, multiple plan IDs can be passed as a comma separated list

Type
integer
_limit

Limit for pagination, default 10, max 10000

Type
integer
_page

Page for pagination

Type
integer
_sort

Sort by this field

Type
string
_direction

Sort in this direction (asc, desc)

Type
string
_include

Include additional data

Type
array

Request example

Responses​

OK

application/json
JSON
{
  
"data": [
  
  
{
  
  
  
"consumedByDeviceId": 0,
  
  
  
"consumedOn": "string",
  
  
  
"creditRemainingDays": true,
  
  
  
"deviceId": 0,
  
  
  
"id": 0,
  
  
  
"needsPayment": true,
  
  
  
"orderId": 0,
  
  
  
"plan": {
  
  
  
  
"description": "string",
  
  
  
  
"displayName": "string",
  
  
  
  
"features": "string",
  
  
  
  
"id": 0,
  
  
  
  
"name": "string",
  
  
  
  
"onoWhitelistId": 0,
  
  
  
  
"prices": {
  
  
  
  
  
"eur": [
  
  
  
  
  
  
[
  
  
  
  
  
  
]
  
  
  
  
  
],
  
  
  
  
  
"gbp": [
  
  
  
  
  
  
[
  
  
  
  
  
  
]
  
  
  
  
  
],
  
  
  
  
  
"tax": "[Circular Reference]",
  
  
  
  
  
"usd": [
  
  
  
  
  
  
[
  
  
  
  
  
  
]
  
  
  
  
  
]
  
  
  
  
},
  
  
  
  
"sku": "string",
  
  
  
  
"sleepLimit": 0,
  
  
  
  
"wakeLimit": 0
  
  
  
},
  
  
  
"planId": 0,
  
  
  
"removedOn": "string",
  
  
  
"userId": 0
  
  
}
  
],
  
"limit": 0,
  
"page": 0,
  
"totalElements": 0,
  
"totalPages": 0
}
Try this endpoint

Playground​

Authorization
Variables
Key
Value

OpenAPI definition ​

References are expanded below, except recursive definitions and references with sibling fields. Documentation overrides are included. Full original OpenAPI spec (JSON).

View endpoint OpenAPI definition
yaml
info:
  title: Lightbug API
  version: '2'
externalDocs:
  description: ''
  url: ''
openapi: 3.1.0
servers:
  - url: https://api.lightbug.cloud/v2
security:
  - ApiKeyAuth: []
tags: []
paths:
  /users/plans:
    get:
      description: Gets plans that are available for a user (already purchased or allocated)
      parameters:
        - description: Filter by plans that have already been consumed by devices or not
          in: query
          name: consumed
          schema:
            type: boolean
        - description: Filter by device ID, multiple device IDs can be passed as a comma separated list
          in: query
          name: deviceId
          schema:
            type: string
        - description: Filter by consumedOn start date
          in: query
          name: consumedSince
          schema:
            type: string
        - description: Filter by consumedOn end date
          in: query
          name: consumedUntil
          schema:
            type: string
        - description: Filter by plan id, multiple plan IDs can be passed as a comma separated list
          in: query
          name: planId
          schema:
            type: integer
        - description: Limit for pagination, default 10, max 10000
          in: query
          name: _limit
          schema:
            type: integer
        - description: Page for pagination
          in: query
          name: _page
          schema:
            type: integer
        - description: Sort by this field
          in: query
          name: _sort
          schema:
            type: string
        - description: Sort in this direction (asc, desc)
          in: query
          name: _direction
          schema:
            type: string
        - description: Include additional data
          in: query
          name: _include
          schema:
            items:
              enum:
                - plan
              type: string
            type: array
      responses:
'200':
yaml
          content:
            application/json:
              schema:
                properties:
                  data:
                    description: Paginated data
                    items:
                      properties:
                        consumedByDeviceId:
                          description: |-
                            DEPRECATED, i favour of deviceId
                            Will continue being returned until at least Mid 2025
                          type: integer
                        consumedOn:
                          description: Date the plan has been consumed, if null then it has not been consumed
                          type: string
                        creditRemainingDays:
                          description: |-
                            If the plan is removed, should the remaining days be credited back to the user account?
                            Often the case when plan upgrades have happened
                          type: boolean
                        deviceId:
                          description: The device that has consumed the plan, if it has been consumed
                          type: integer
                        id:
                          type: integer
                        needsPayment:
                          description: |-
                            Flag recording if payment may still be needed for this ordered plan
                            It may have been assigned before payment, such as for resellers
                          type: boolean
                        orderId:
                          description: Order that the plan is associated with, if already paid via a regular order
                          type: integer
                        plan:
                          description: Details of the plan.
                          properties:
                            description:
                              type: string
                            displayName:
                              type: string
                            features:
                              type: string
                            id:
                              type: integer
                            name:
                              type: string
                            onoWhitelistId:
                              description: |-
                                Connectivity *string `json:"connectivity"`
                                Group        string  `json:"group"`
                                ResellerID *int32 `json:"resellerId"`
                                ResellerPlanID *int32  `json:"resellerPlanId"`
                                Archived *int32 `json:"archived"`
                                PlanType       string  `json:"planType"`
                              type: integer
                            prices:
                              properties:
                                eur:
                                  description: 'breaks:  example:"[0,1.99],[10,1.89]"` // Array of quantity to price in EUR'
                                  items:
                                    items:
                                      type: number
                                    type: array
                                  type: array
                                  uniqueItems: false
                                gbp:
                                  description: 'breaks:   example:"[1,2.34],[10,2.22]"` // Array of quantity to price in GBP'
                                  items:
                                    items:
                                      type: number
                                    type: array
                                  type: array
                                  uniqueItems: false
                                tax:
                                  $ref: '#/components/schemas/ProductPricing'
                                usd:
                                  description: 'breaks:   example:"[1,4.35],[10,4.26]"` // Array of quantity to price in USD'
                                  items:
                                    items:
                                      type: number
                                    type: array
                                  type: array
                                  uniqueItems: false
                              type: object
                            sku:
                              type: string
                            sleepLimit:
                              type: integer
                            wakeLimit:
                              description: |-
                                Term           string  `json:"term"`
                                Price          float64 `json:"price"`
                                Currency       string  `json:"currency"`
                                OwnerID        int32   `json:"ownerId"`
                              type: integer
                          type: object
                        planId:
                          description: Plan that has been ordered
                          type: integer
                        removedOn:
                          description: |-
                            Date the plan has been removed from a device, can be used to detect partially consumed plans
                            This might also just be the end of the month
                          type: string
                        userId:
                          description: User that has ordered the plan
                          type: integer
                      type: object
                    type: array
                    uniqueItems: false
                  limit:
                    description: Requested elements per page
                    type: integer
                  page:
                    description: Requested page number
                    type: integer
                  totalElements:
                    description: Total elements in the database for given filters
                    type: integer
                  totalPages:
                    description: Total pages of elements given limit and filters
                    type: integer
                type: object
          description: OK
'400':
yaml
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: 400
                    type: integer
                  message:
                    example: status bad request
                    type: string
                type: object
          description: Bad Request
'401':
yaml
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: 400
                    type: integer
                  message:
                    example: status bad request
                    type: string
                type: object
          description: Unauthorized
'429':
yaml
          content:
            application/json:
              schema:
                type: string
          description: Limit exceeded
          headers:
            X-Ratelimit-Limit:
              schema:
                type: integer
            X-Ratelimit-Remaining:
              schema:
                type: integer
            X-Ratelimit-Reset:
              schema:
                type: integer
yaml
      security:
        - ApiKeyAuth: []
      summary: Purchased plans
      tags:
        - plans
      operationId: get-users-plans
components:
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: Authorization
      type: apiKey
      description: API Key for authentication. Retrieval from either API version login routes, or other authentication token type. See <a href='/apis/authentication'>Authentication</a> for more details.
      example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
  schemas:
    ProductPricing:
      properties:
        eur:
          description: 'breaks:  example:"[0,1.99],[10,1.89]"` // Array of quantity to price in EUR'
          items:
            items:
              type: number
            type: array
          type: array
          uniqueItems: false
        gbp:
          description: 'breaks:   example:"[1,2.34],[10,2.22]"` // Array of quantity to price in GBP'
          items:
            items:
              type: number
            type: array
          type: array
          uniqueItems: false
        tax:
          $ref: '#/components/schemas/ProductPricing'
        usd:
          description: 'breaks:   example:"[1,4.35],[10,4.26]"` // Array of quantity to price in USD'
          items:
            items:
              type: number
            type: array
          type: array
          uniqueItems: false
      type: object