POST
/
api
/
v1
/
agents
{
  "error": "invalid label key format"
}
Create a new agent and generate an authentication token for it. Network policies are not included in the creation response.
Requires Bearer token authentication

Request Body

name
string
required
Agent name
os
string
required
Operating system (required)
ip
string
Agent IP address (must be valid IP format)
kind
string
required
Agent kind (must be valid agent kind)
labels
object
Agent labels (maximum 64 labels, keys ≤63 chars, values ≤1024 chars)

Example

curl -X POST "https://api.garnet.ai/v1/agents" \
  -H "Authorization: Bearer $GARNET_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "production-server-1",
    "os": "linux",
    "ip": "10.0.1.100",
    "kind": "kubernetes",
    "labels": {
      "environment": "production",
      "region": "us-west-1"
    }
  }'

Response

id
string
Unique agent identifier
token
string
Agent authentication token
created_at
string
ISO 8601 timestamp of creation

Error Examples

{
  "error": "invalid label key format"
}
{
  "error": "invalid agent: os is required"
}