Balena Devices API

IoT devices managed by balena

OpenAPI Specification

balena-devices-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Balena Cloud Applications Devices API
  version: v7
  description: 'The balenaCloud REST API is the primary interface to the Balena platform.

    It exposes OData-style resources for devices, fleets (applications), releases,

    environment variables, organizations, and user accounts. Authentication uses a

    bearer token (session token or named API key) supplied in the

    `Authorization: Bearer <token>` header. Backward-compatible paths for v1-v6

    are translated to the newest version.

    '
  contact:
    name: balenaCloud
    url: https://docs.balena.io/reference/api/overview/
servers:
- url: https://api.balena-cloud.com/v7
  description: balenaCloud v7
- url: https://api.balena-cloud.com/v6
  description: balenaCloud v6 (backward-compatible)
tags:
- name: Devices
  description: IoT devices managed by balena
paths:
  /device:
    get:
      summary: List devices
      description: 'List devices using OData-style queries. Supports `$select`, `$filter`,

        `$expand`, `$top`, `$skip`, and `$orderby`.

        '
      operationId: listDevices
      tags:
      - Devices
      parameters:
      - in: query
        name: $select
        schema:
          type: string
      - in: query
        name: $filter
        schema:
          type: string
      - in: query
        name: $expand
        schema:
          type: string
      - in: query
        name: $top
        schema:
          type: integer
      - in: query
        name: $skip
        schema:
          type: integer
      - in: query
        name: $orderby
        schema:
          type: string
      responses:
        '200':
          description: A page of devices
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceList'
      security:
      - bearer: []
    post:
      summary: Create a device
      operationId: createDevice
      tags:
      - Devices
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '201':
          description: Created device
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Device'
      security:
      - bearer: []
  /device({id}):
    parameters:
    - in: path
      name: id
      required: true
      schema:
        type: integer
    get:
      summary: Get a device by id
      operationId: getDevice
      tags:
      - Devices
      parameters:
      - in: query
        name: $select
        schema:
          type: string
      - in: query
        name: $expand
        schema:
          type: string
      responses:
        '200':
          description: Device
          content:
            application/json:
              schema:
                type: object
                properties:
                  d:
                    type: array
                    items:
                      $ref: '#/components/schemas/Device'
      security:
      - bearer: []
    patch:
      summary: Modify a device
      operationId: updateDevice
      tags:
      - Devices
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: Updated
      security:
      - bearer: []
    delete:
      summary: Delete a device
      operationId: deleteDevice
      tags:
      - Devices
      responses:
        '200':
          description: Deleted
      security:
      - bearer: []
components:
  schemas:
    DeviceList:
      type: object
      properties:
        d:
          type: array
          items:
            $ref: '#/components/schemas/Device'
    Device:
      type: object
      properties:
        id:
          type: integer
        uuid:
          type: string
        device_name:
          type: string
        device_type:
          type: string
        is_online:
          type: boolean
        ip_address:
          type: string
        os_version:
          type: string
        status:
          type: string
        belongs_to__application:
          type: object
        created_at:
          type: string
          format: date-time
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Session token or named API key supplied as

        `Authorization: Bearer <token>`. Create named API keys at

        https://dashboard.balena-cloud.com/preferences/access-tokens.

        '