Bulk import hosts
curl --request POST \
--url https://{command_center_host}/api/v1/hosts/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: text/csv' \
--data '<string>'import requests
url = "https://{command_center_host}/api/v1/hosts/batch"
payload = "<string>"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "text/csv"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'text/csv'},
body: '<string>'
};
fetch('https://{command_center_host}/api/v1/hosts/batch', 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://{command_center_host}/api/v1/hosts/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: text/csv"
],
]);
$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://{command_center_host}/api/v1/hosts/batch"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "text/csv")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{command_center_host}/api/v1/hosts/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "text/csv")
.body("<string>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{command_center_host}/api/v1/hosts/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'text/csv'
request.body = "<string>"
response = http.request(request)
puts response.read_body{
"object": "import_result",
"dry_run": true,
"stopped": true,
"counts": {
"created": 123,
"updated": 123,
"skipped": 123,
"failed": 123
},
"results": [
{
"index": 123,
"status": "created",
"id": "<string>",
"error": "<string>"
}
]
}{
"code": "VALIDATION_FAILED",
"message": "Validation failed",
"request_id": "req_3702b7e7-...",
"field": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
],
"details": {}
}{
"code": "VALIDATION_FAILED",
"message": "Validation failed",
"request_id": "req_3702b7e7-...",
"field": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
],
"details": {}
}{
"code": "VALIDATION_FAILED",
"message": "Validation failed",
"request_id": "req_3702b7e7-...",
"field": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
],
"details": {}
}Hosts
Bulk import hosts
Body is a CSV file (text/csv) or a JSON envelope. Returns 200 with a per-row verdict even when every row failed.
POST
/
api
/
v1
/
hosts
/
batch
Bulk import hosts
curl --request POST \
--url https://{command_center_host}/api/v1/hosts/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: text/csv' \
--data '<string>'import requests
url = "https://{command_center_host}/api/v1/hosts/batch"
payload = "<string>"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "text/csv"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'text/csv'},
body: '<string>'
};
fetch('https://{command_center_host}/api/v1/hosts/batch', 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://{command_center_host}/api/v1/hosts/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: text/csv"
],
]);
$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://{command_center_host}/api/v1/hosts/batch"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "text/csv")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{command_center_host}/api/v1/hosts/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "text/csv")
.body("<string>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{command_center_host}/api/v1/hosts/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'text/csv'
request.body = "<string>"
response = http.request(request)
puts response.read_body{
"object": "import_result",
"dry_run": true,
"stopped": true,
"counts": {
"created": 123,
"updated": 123,
"skipped": 123,
"failed": 123
},
"results": [
{
"index": 123,
"status": "created",
"id": "<string>",
"error": "<string>"
}
]
}{
"code": "VALIDATION_FAILED",
"message": "Validation failed",
"request_id": "req_3702b7e7-...",
"field": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
],
"details": {}
}{
"code": "VALIDATION_FAILED",
"message": "Validation failed",
"request_id": "req_3702b7e7-...",
"field": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
],
"details": {}
}{
"code": "VALIDATION_FAILED",
"message": "Validation failed",
"request_id": "req_3702b7e7-...",
"field": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
],
"details": {}
}Authorizations
An API key minted in Command Center (Settings -> API Keys), sent as Authorization: Bearer 2501_ak_.... A Command Center session cookie is also accepted.
Query Parameters
Available options:
stop, continue dry_run
Option 1 · enum<string>Option 2 · enum<string>Option 3 · enum<string>Option 4 · enum<string>
default:false
Available options:
true Body
text/csvapplication/json
A CSV file, or a JSON envelope { rows, on_error?, dry_run? }
The body is of type string.
⌘I

