Enroll Device
curl --request POST \
--url https://api.promptguard.co/api/v1/enroll \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"token": "<string>",
"device_name": "<string>",
"platform": "macos",
"end_user_id": "<string>",
"coverage": "proxy",
"machine_identity": "<string>",
"machine_identity_source": "<string>"
}
'import requests
url = "https://api.promptguard.co/api/v1/enroll"
payload = {
"token": "<string>",
"device_name": "<string>",
"platform": "macos",
"end_user_id": "<string>",
"coverage": "proxy",
"machine_identity": "<string>",
"machine_identity_source": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
token: '<string>',
device_name: '<string>',
platform: 'macos',
end_user_id: '<string>',
coverage: 'proxy',
machine_identity: '<string>',
machine_identity_source: '<string>'
})
};
fetch('https://api.promptguard.co/api/v1/enroll', 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://api.promptguard.co/api/v1/enroll",
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([
'token' => '<string>',
'device_name' => '<string>',
'platform' => 'macos',
'end_user_id' => '<string>',
'coverage' => 'proxy',
'machine_identity' => '<string>',
'machine_identity_source' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://api.promptguard.co/api/v1/enroll"
payload := strings.NewReader("{\n \"token\": \"<string>\",\n \"device_name\": \"<string>\",\n \"platform\": \"macos\",\n \"end_user_id\": \"<string>\",\n \"coverage\": \"proxy\",\n \"machine_identity\": \"<string>\",\n \"machine_identity_source\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://api.promptguard.co/api/v1/enroll")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\",\n \"device_name\": \"<string>\",\n \"platform\": \"macos\",\n \"end_user_id\": \"<string>\",\n \"coverage\": \"proxy\",\n \"machine_identity\": \"<string>\",\n \"machine_identity_source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptguard.co/api/v1/enroll")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"token\": \"<string>\",\n \"device_name\": \"<string>\",\n \"platform\": \"macos\",\n \"end_user_id\": \"<string>\",\n \"coverage\": \"proxy\",\n \"machine_identity\": \"<string>\",\n \"machine_identity_source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"api_key": "pg_live_Hq3nW8vR_...",
"project_id": "910b6423-8a12-4461-a6bf-9148d9b6b8e3",
"device_id": "5c1f0a9e-3b7d-4e2a-9c41-7d2e8f6a0b13",
"organization_id": "12613a5a-ff26-4e72-8105-a36b40327a7c",
"enforced": false,
"mode": "enforce",
"fail_closed": true,
"end_user_label": "jane@acme.example",
"account_name": "Acme Corp",
"identity_verified": true,
"account_email": "jane@acme.example",
"account_type": "org"
}{
"error": {
"message": "The request is invalid: body.messages: Field required",
"type": "invalid_request_error",
"code": "invalid_request",
"details": [
{
"type": "missing",
"loc": [
"body",
"messages"
],
"msg": "Field required",
"input": {
"direction": "input"
}
}
],
"error_id": "3f0b8c1e-6a0e-4d52-9a57-0c2a9a7f5b11",
"doc_url": "https://docs.promptguard.co/production/error-handling#invalid_request"
},
"detail": [
{
"type": "missing",
"loc": [
"body",
"messages"
],
"msg": "Field required",
"input": {
"direction": "input"
}
}
]
}Enroll Device
Guide: Enroll your team’s devices
POST
/
api
/
v1
/
enroll
Enroll Device
curl --request POST \
--url https://api.promptguard.co/api/v1/enroll \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"token": "<string>",
"device_name": "<string>",
"platform": "macos",
"end_user_id": "<string>",
"coverage": "proxy",
"machine_identity": "<string>",
"machine_identity_source": "<string>"
}
'import requests
url = "https://api.promptguard.co/api/v1/enroll"
payload = {
"token": "<string>",
"device_name": "<string>",
"platform": "macos",
"end_user_id": "<string>",
"coverage": "proxy",
"machine_identity": "<string>",
"machine_identity_source": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
token: '<string>',
device_name: '<string>',
platform: 'macos',
end_user_id: '<string>',
coverage: 'proxy',
machine_identity: '<string>',
machine_identity_source: '<string>'
})
};
fetch('https://api.promptguard.co/api/v1/enroll', 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://api.promptguard.co/api/v1/enroll",
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([
'token' => '<string>',
'device_name' => '<string>',
'platform' => 'macos',
'end_user_id' => '<string>',
'coverage' => 'proxy',
'machine_identity' => '<string>',
'machine_identity_source' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://api.promptguard.co/api/v1/enroll"
payload := strings.NewReader("{\n \"token\": \"<string>\",\n \"device_name\": \"<string>\",\n \"platform\": \"macos\",\n \"end_user_id\": \"<string>\",\n \"coverage\": \"proxy\",\n \"machine_identity\": \"<string>\",\n \"machine_identity_source\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://api.promptguard.co/api/v1/enroll")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\",\n \"device_name\": \"<string>\",\n \"platform\": \"macos\",\n \"end_user_id\": \"<string>\",\n \"coverage\": \"proxy\",\n \"machine_identity\": \"<string>\",\n \"machine_identity_source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptguard.co/api/v1/enroll")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"token\": \"<string>\",\n \"device_name\": \"<string>\",\n \"platform\": \"macos\",\n \"end_user_id\": \"<string>\",\n \"coverage\": \"proxy\",\n \"machine_identity\": \"<string>\",\n \"machine_identity_source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"api_key": "pg_live_Hq3nW8vR_...",
"project_id": "910b6423-8a12-4461-a6bf-9148d9b6b8e3",
"device_id": "5c1f0a9e-3b7d-4e2a-9c41-7d2e8f6a0b13",
"organization_id": "12613a5a-ff26-4e72-8105-a36b40327a7c",
"enforced": false,
"mode": "enforce",
"fail_closed": true,
"end_user_label": "jane@acme.example",
"account_name": "Acme Corp",
"identity_verified": true,
"account_email": "jane@acme.example",
"account_type": "org"
}{
"error": {
"message": "The request is invalid: body.messages: Field required",
"type": "invalid_request_error",
"code": "invalid_request",
"details": [
{
"type": "missing",
"loc": [
"body",
"messages"
],
"msg": "Field required",
"input": {
"direction": "input"
}
}
],
"error_id": "3f0b8c1e-6a0e-4d52-9a57-0c2a9a7f5b11",
"doc_url": "https://docs.promptguard.co/production/error-handling#invalid_request"
},
"detail": [
{
"type": "missing",
"loc": [
"body",
"messages"
],
"msg": "Field required",
"input": {
"direction": "input"
}
}
]
}Authorizations
Body
application/json
Response
Successful Response