Provision a new device
curl --request POST \
--url https://acusight.io/api/devices/provision \
--header 'Content-Type: application/json' \
--data '
{
"device_info": {
"device_id": "docker-abc123",
"agent_version": "1.0.0",
"hardware_id": "RPi4-8GB-v1.4",
"ip_address": "192.168.1.100",
"mac_address": "00:1A:2B:3C:4D:5E",
"name": "Edge Camera 1"
},
"token": "apt_abc123..."
}
'import requests
url = "https://acusight.io/api/devices/provision"
payload = {
"device_info": {
"device_id": "docker-abc123",
"agent_version": "1.0.0",
"hardware_id": "RPi4-8GB-v1.4",
"ip_address": "192.168.1.100",
"mac_address": "00:1A:2B:3C:4D:5E",
"name": "Edge Camera 1"
},
"token": "apt_abc123..."
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
device_info: {
device_id: 'docker-abc123',
agent_version: '1.0.0',
hardware_id: 'RPi4-8GB-v1.4',
ip_address: '192.168.1.100',
mac_address: '00:1A:2B:3C:4D:5E',
name: 'Edge Camera 1'
},
token: 'apt_abc123...'
})
};
fetch('https://acusight.io/api/devices/provision', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://acusight.io/api/devices/provision",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'device_info' => [
'device_id' => 'docker-abc123',
'agent_version' => '1.0.0',
'hardware_id' => 'RPi4-8GB-v1.4',
'ip_address' => '192.168.1.100',
'mac_address' => '00:1A:2B:3C:4D:5E',
'name' => 'Edge Camera 1'
],
'token' => 'apt_abc123...'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://acusight.io/api/devices/provision"
payload := strings.NewReader("{\n \"device_info\": {\n \"device_id\": \"docker-abc123\",\n \"agent_version\": \"1.0.0\",\n \"hardware_id\": \"RPi4-8GB-v1.4\",\n \"ip_address\": \"192.168.1.100\",\n \"mac_address\": \"00:1A:2B:3C:4D:5E\",\n \"name\": \"Edge Camera 1\"\n },\n \"token\": \"apt_abc123...\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://acusight.io/api/devices/provision")
.header("Content-Type", "application/json")
.body("{\n \"device_info\": {\n \"device_id\": \"docker-abc123\",\n \"agent_version\": \"1.0.0\",\n \"hardware_id\": \"RPi4-8GB-v1.4\",\n \"ip_address\": \"192.168.1.100\",\n \"mac_address\": \"00:1A:2B:3C:4D:5E\",\n \"name\": \"Edge Camera 1\"\n },\n \"token\": \"apt_abc123...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://acusight.io/api/devices/provision")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"device_info\": {\n \"device_id\": \"docker-abc123\",\n \"agent_version\": \"1.0.0\",\n \"hardware_id\": \"RPi4-8GB-v1.4\",\n \"ip_address\": \"192.168.1.100\",\n \"mac_address\": \"00:1A:2B:3C:4D:5E\",\n \"name\": \"Edge Camera 1\"\n },\n \"token\": \"apt_abc123...\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"api_endpoint": "https://192.168.1.100",
"api_key": "adk_xyz789...",
"device_id": "docker-abc123",
"edge_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"endpoint_id": "docker-abc123",
"portainer_endpoint_id": 5,
"tls_hostname": "titan.local"
},
"error": {
"code": "<string>",
"details": "<string>",
"message": "<string>"
},
"meta": {
"count": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"success": true
}{
"data": "<unknown>",
"error": {
"code": "<string>",
"details": "<string>",
"message": "<string>"
},
"meta": {
"count": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"success": true
}{
"data": "<unknown>",
"error": {
"code": "<string>",
"details": "<string>",
"message": "<string>"
},
"meta": {
"count": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"success": true
}{
"data": "<unknown>",
"error": {
"code": "<string>",
"details": "<string>",
"message": "<string>"
},
"meta": {
"count": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"success": true
}{
"data": "<unknown>",
"error": {
"code": "<string>",
"details": "<string>",
"message": "<string>"
},
"meta": {
"count": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"success": true
}Devices & provisioning
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.
POST
/
devices
/
provision
Provision a new device
curl --request POST \
--url https://acusight.io/api/devices/provision \
--header 'Content-Type: application/json' \
--data '
{
"device_info": {
"device_id": "docker-abc123",
"agent_version": "1.0.0",
"hardware_id": "RPi4-8GB-v1.4",
"ip_address": "192.168.1.100",
"mac_address": "00:1A:2B:3C:4D:5E",
"name": "Edge Camera 1"
},
"token": "apt_abc123..."
}
'import requests
url = "https://acusight.io/api/devices/provision"
payload = {
"device_info": {
"device_id": "docker-abc123",
"agent_version": "1.0.0",
"hardware_id": "RPi4-8GB-v1.4",
"ip_address": "192.168.1.100",
"mac_address": "00:1A:2B:3C:4D:5E",
"name": "Edge Camera 1"
},
"token": "apt_abc123..."
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
device_info: {
device_id: 'docker-abc123',
agent_version: '1.0.0',
hardware_id: 'RPi4-8GB-v1.4',
ip_address: '192.168.1.100',
mac_address: '00:1A:2B:3C:4D:5E',
name: 'Edge Camera 1'
},
token: 'apt_abc123...'
})
};
fetch('https://acusight.io/api/devices/provision', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://acusight.io/api/devices/provision",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'device_info' => [
'device_id' => 'docker-abc123',
'agent_version' => '1.0.0',
'hardware_id' => 'RPi4-8GB-v1.4',
'ip_address' => '192.168.1.100',
'mac_address' => '00:1A:2B:3C:4D:5E',
'name' => 'Edge Camera 1'
],
'token' => 'apt_abc123...'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://acusight.io/api/devices/provision"
payload := strings.NewReader("{\n \"device_info\": {\n \"device_id\": \"docker-abc123\",\n \"agent_version\": \"1.0.0\",\n \"hardware_id\": \"RPi4-8GB-v1.4\",\n \"ip_address\": \"192.168.1.100\",\n \"mac_address\": \"00:1A:2B:3C:4D:5E\",\n \"name\": \"Edge Camera 1\"\n },\n \"token\": \"apt_abc123...\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://acusight.io/api/devices/provision")
.header("Content-Type", "application/json")
.body("{\n \"device_info\": {\n \"device_id\": \"docker-abc123\",\n \"agent_version\": \"1.0.0\",\n \"hardware_id\": \"RPi4-8GB-v1.4\",\n \"ip_address\": \"192.168.1.100\",\n \"mac_address\": \"00:1A:2B:3C:4D:5E\",\n \"name\": \"Edge Camera 1\"\n },\n \"token\": \"apt_abc123...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://acusight.io/api/devices/provision")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"device_info\": {\n \"device_id\": \"docker-abc123\",\n \"agent_version\": \"1.0.0\",\n \"hardware_id\": \"RPi4-8GB-v1.4\",\n \"ip_address\": \"192.168.1.100\",\n \"mac_address\": \"00:1A:2B:3C:4D:5E\",\n \"name\": \"Edge Camera 1\"\n },\n \"token\": \"apt_abc123...\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"api_endpoint": "https://192.168.1.100",
"api_key": "adk_xyz789...",
"device_id": "docker-abc123",
"edge_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"endpoint_id": "docker-abc123",
"portainer_endpoint_id": 5,
"tls_hostname": "titan.local"
},
"error": {
"code": "<string>",
"details": "<string>",
"message": "<string>"
},
"meta": {
"count": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"success": true
}{
"data": "<unknown>",
"error": {
"code": "<string>",
"details": "<string>",
"message": "<string>"
},
"meta": {
"count": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"success": true
}{
"data": "<unknown>",
"error": {
"code": "<string>",
"details": "<string>",
"message": "<string>"
},
"meta": {
"count": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"success": true
}{
"data": "<unknown>",
"error": {
"code": "<string>",
"details": "<string>",
"message": "<string>"
},
"meta": {
"count": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"success": true
}{
"data": "<unknown>",
"error": {
"code": "<string>",
"details": "<string>",
"message": "<string>"
},
"meta": {
"count": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"success": true
}Was this page helpful?