Skip to content

Agents

The /agents endpoint provides read-only access to MetaKraftwerk agents. Agents are client programs that connect to the MetaKraftwerk server via WebSocket to execute deployments and other automated tasks.

See Also

GET /api/v1/agents — Find Agents

Retrieve a list of agents, optionally filtered by name, status, or group.

Endpoint

GET https://app.metakraftwerk.com/api/v1/agents

Query Parameters

ParameterTypeRequiredDescription
namestringNoFilter by agent name.
agent_idstringNoFilter by agent UUID.
onlinebooleanNoFilter by online status (true or false).
group_idintegerNoFilter by agent group ID.
groupstringNoFilter by agent group name.

Response Schema

Returns an array of agent objects:

FieldTypeDescription
idintegerUnique agent ID.
agent_idstringAgent UUID identifier.
namestringAgent name.
deletedbooleanWhether the agent is marked as deleted.
disabledbooleanWhether the agent is disabled.
onlinebooleanWhether the agent is currently connected.
group_idintegerAgent group ID.

Examples

cURL

bash
# List all agents
curl -X GET "https://app.metakraftwerk.com/api/v1/agents" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Find by name
curl -X GET "https://app.metakraftwerk.com/api/v1/agents?name=dev_md_agent" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Find by UUID
curl -X GET "https://app.metakraftwerk.com/api/v1/agents?agent_id=de058784-c9cc-448d-8e64-bfda70b314cc" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Find online agents
curl -X GET "https://app.metakraftwerk.com/api/v1/agents?online=true" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Find by group name
curl -X GET "https://app.metakraftwerk.com/api/v1/agents?group=DEV_AGENTS" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

JavaScript (Fetch)

javascript
const response = await fetch(
  'https://app.metakraftwerk.com/api/v1/agents?name=dev_md_agent',
  { headers: { 'Authorization': `Bearer ${accessToken}` } }
);

const agents = await response.json();

Response Example

json
[
  {
    "id": 301,
    "agent_id": "de058784-c9cc-448d-8e64-bfda70b314cc",
    "name": "dev_md_agent",
    "deleted": false,
    "disabled": false,
    "online": false,
    "group_id": 1
  }
]

Error Responses

StatusConditionExample Message
401Missing or invalid tokenNot authenticated
404Agent group not foundAn agent group with the name 'X' does not exist!

GET /api/v1/agents/:id — Get Agent

Retrieve a single agent by its ID.

Endpoint

GET https://app.metakraftwerk.com/api/v1/agents/:id

Path Parameters

ParameterTypeRequiredDescription
idintegerYesThe agent ID.

Examples

cURL

bash
curl -X GET "https://app.metakraftwerk.com/api/v1/agents/301" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

JavaScript (Fetch)

javascript
const response = await fetch(
  'https://app.metakraftwerk.com/api/v1/agents/301',
  { headers: { 'Authorization': `Bearer ${accessToken}` } }
);

const agent = await response.json();

Error Responses

StatusConditionExample Message
401Missing or invalid tokenNot authenticated
404Agent not foundNo record found for id 'X'

POST /api/v1/agents — Create

Not implemented

PUT /api/v1/agents — Update

Not implemented

PATCH /api/v1/agents/:id — Patch

Not implemented

DELETE /api/v1/agents/:id — Remove

Not implemented