Sets a device plan​
Sets the plan that the device is currently using, and optionally the plan that it should renew onto.
For user devices, the user must have already purchased or been allocated the target plan, and it should be available in their plan pool, see GET /users/plans
For reseller devices, an "unpaid" plan will be used, and billed on the next cycle.
If the device was previously deactivated, this action will also activate the device.
Authorizations​
API Key for authentication. Retrieval from either API version login routes, or other authentication token type. See Authentication for more details.
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."Parameters​
Path Parameters
Device ID
Request Body​
Request example
Responses​
OK
Try this endpoint
Playground​
Authorization
Variables
Body
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
info:
title: Lightbug API
version: '2'
externalDocs:
description: ''
url: ''
openapi: 3.1.0
servers:
- url: https://api.lightbug.cloud/v2
security:
- ApiKeyAuth: []
tags: []
paths:
/devices/{id}/plan:
put:
description: |-
Sets the plan that the device is currently using, and optionally the plan that it should renew onto.
For user devices, the user must have already purchased or been allocated the target plan, and it should be available in their plan pool, see <a href="https://docs.lightbug.io/apis/v2/get-users-plans">GET /users/plans</a>
For reseller devices, an "unpaid" plan will be used, and billed on the next cycle.
If the device was previously deactivated, this action will also activate the device.
parameters:
- description: Device ID
in: path
name: id
required: true
schema:
type: integerrequestBody:
content:
application/json:
schema:
properties:
ignoreSubscriptionSetup:
description: |-
Optional ignoring of subscription setup for non reseller users.
If the user has the plan already purchased, then don't setup a card or subscription if it does'nt exist...
Subscriptions are already ignored for reseller users, so this option would not be needed for them.
type: boolean
planId:
description: Plan ID to be assigned to the device if available
type: integer
renewUntil:
description: Optional date, at which the device will deactivate and plans will not be renewed
type: string
required:
- planId
type: object
description: Request
required: true responses:'200':
content:
application/json:
schema:
description: (optional) Current subscription
properties:
_stripeSubscriptionId:
description: (legacy) Stripe Subscription ID for per device subscriptions
type: string
created:
type: string
deviceId:
type: integer
expires:
type: string
id:
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:
type: integer
userId:
type: integer
type: object
description: OK'201':
content:
application/json:
schema:
description: (optional) Current subscription
properties:
_stripeSubscriptionId:
description: (legacy) Stripe Subscription ID for per device subscriptions
type: string
created:
type: string
deviceId:
type: integer
expires:
type: string
id:
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:
type: integer
userId:
type: integer
type: object
description: Created'400':
content:
application/json:
schema:
properties:
code:
example: 400
type: integer
message:
example: status bad request
type: string
type: object
description: Bad Request'401':
content:
application/json:
schema:
properties:
code:
example: 400
type: integer
message:
example: status bad request
type: string
type: object
description: Unauthorized'404':
content:
application/json:
schema:
properties:
code:
example: 400
type: integer
message:
example: status bad request
type: string
type: object
description: Not Found'429':
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 security:
- ApiKeyAuth: []
summary: Sets a device plan
tags:
- plans
operationId: put-devices-id-plan
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