> ## Documentation Index
> Fetch the complete documentation index at: https://docs.acusight.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Provision a new device

> Provisions a new edge device using a valid provisioning token. Creates the device record, generates an API key, and optionally creates a Portainer Edge endpoint. This endpoint is called by the setup script on edge devices.



## OpenAPI

````yaml /api-spec.json post /devices/provision
openapi: 3.0.0
info:
  contact:
    name: Acusight API Support
  description: >-
    Acusight platform API - custom endpoints + Portainer proxy routes for edge
    AI deployments
  title: Acusight API
  version: 1.0.0
servers:
  - url: https://acusight.io/api
    description: AcuSight Cloud (hosted)
security: []
tags:
  - name: Devices & provisioning
    description: Register, provision, and manage edge devices and their agents.
  - name: Virtual devices
    description: Create and drive simulated devices for testing and demos.
  - name: Alerts & telemetry
    description: Model alerts, alert rules, and product telemetry.
  - name: Organization
    description: Organization-level settings.
  - name: Datasets & data
    description: Projects, batches, datasets, images, annotations, and drift.
  - name: Models & training
    description: Model registry, training jobs, exports, and inference.
  - name: Pipeline data
    description: Detection time-series and aggregated pipeline analytics.
paths:
  /devices/provision:
    post:
      tags:
        - Devices & provisioning
      summary: Provision a new device
      description: >-
        Provisions a new edge device using a valid provisioning token. Creates
        the device record, generates an API key, and optionally creates a
        Portainer Edge endpoint. This endpoint is called by the setup script on
        edge devices.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/handlers.ProvisionDeviceRequest'
        description: Device provisioning request
        required: true
      responses:
        '201':
          description: Device provisioned successfully
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/types.APIResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/handlers.ProvisionDeviceResponse'
                    type: object
        '400':
          description: Invalid request body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.APIResponse'
        '401':
          description: Invalid or expired provisioning token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.APIResponse'
        '409':
          description: Device already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.APIResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.APIResponse'
      security: []
components:
  schemas:
    handlers.ProvisionDeviceRequest:
      properties:
        device_info:
          $ref: '#/components/schemas/handlers.ProvisionDeviceInfoInput'
        token:
          example: apt_abc123...
          type: string
      required:
        - device_info
        - token
      type: object
    types.APIResponse:
      properties:
        data: {}
        error:
          $ref: '#/components/schemas/types.APIError'
        meta:
          $ref: '#/components/schemas/types.APIMeta'
        success:
          type: boolean
      type: object
    handlers.ProvisionDeviceResponse:
      properties:
        api_endpoint:
          example: https://api.acusight.io
          type: string
        api_key:
          example: adk_xyz789...
          type: string
        device_id:
          example: docker-abc123
          type: string
        edge_key:
          example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
          type: string
        endpoint_id:
          example: docker-abc123
          type: string
        portainer_endpoint_id:
          example: 5
          type: integer
      type: object
    handlers.ProvisionDeviceInfoInput:
      properties:
        agent_version:
          example: 1.0.0
          type: string
        device_id:
          description: Docker daemon ID or persisted UUID
          example: docker-abc123
          type: string
        hardware_id:
          example: RPi4-8GB-v1.4
          type: string
        ip_address:
          example: 192.168.1.100
          type: string
        mac_address:
          example: 00:1A:2B:3C:4D:5E
          type: string
        name:
          description: Optional display name
          example: Edge Camera 1
          type: string
      required:
        - device_id
      type: object
    types.APIError:
      properties:
        code:
          type: string
        details:
          type: string
        message:
          type: string
      type: object
    types.APIMeta:
      properties:
        count:
          type: integer
        limit:
          type: integer
        offset:
          type: integer
        total:
          type: integer
      type: object

````