Skip to content

Sets plans for multiple devices in bulk​

PUT
/devices/plan

Sets the plan for multiple devices simultaneously. This is more efficient than individual requests and helps avoid deadlocks when setting plans for reseller devices.
For user devices, the user must have already purchased or been allocated the target plan for each device.
For reseller devices, "unpaid" plans will be created and billed on the next cycle.
Currently only supports device identifiers as numerical IDs.

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..."

Request Body​

application/json
JSON
{
  
"deviceIdentifiers": [
  
  
"string"
  
],
  
"ignoreSubscriptionSetup": true,
  
"planId": 0,
  
"renewUntil": "string"
}

Request example

Responses​

OK

application/json
JSON
{
  
"results": [
  
  
{
  
  
  
"identifier": "string",
  
  
  
"message": "string",
  
  
  
"status": "string"
  
  
}
  
],
  
"summary": {
  
  
"errorCount": 0,
  
  
"successCount": 0,
  
  
"totalRequested": 0
  
}
}
Try this endpoint

Playground​

Authorization
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
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:
  /devices/plan:
    put:
      description: |-
        Sets the plan for multiple devices simultaneously. This is more efficient than individual requests and helps avoid deadlocks when setting plans for reseller devices.
        For user devices, the user must have already purchased or been allocated the target plan for each device.
        For reseller devices, "unpaid" plans will be created and billed on the next cycle.
        Currently only supports device identifiers as numerical IDs.
requestBody:
yaml
        content:
          application/json:
            schema:
              properties:
                deviceIdentifiers:
                  description: Device identifiers - currently only numerical IDs are supported
                  items:
                    type: string
                  type: array
                  uniqueItems: false
                ignoreSubscriptionSetup:
                  description: Optional ignoring of subscription setup for non reseller users.
                  type: boolean
                planId:
                  description: Plan ID to be assigned to the devices if available
                  type: integer
                renewUntil:
                  description: Optional date, at which the devices will deactivate and plans will not be renewed
                  type: string
              required:
                - deviceIdentifiers
                - planId
              type: object
        description: Bulk plan request
        required: true
yaml
      responses:
'200':
yaml
          content:
            application/json:
              schema:
                properties:
                  results:
                    items:
                      properties:
                        identifier:
                          type: string
                        message:
                          type: string
                        status:
                          description: '"SUCCESS" or "ERROR"'
                          type: string
                      type: object
                    type: array
                    uniqueItems: false
                  summary:
                    properties:
                      errorCount:
                        type: integer
                      successCount:
                        type: integer
                      totalRequested:
                        type: integer
                    type: object
                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: Sets plans for multiple devices in bulk
      tags:
        - plans
      operationId: put-devices-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...