Update a collector metrics target

Updates an existing collector target. Only include the fields you want to change — omitted fields are preserved.

The kind field cannot be changed after creation. To switch to a different kind, remove the target and create a new one.

Changing any connection field (host, port, username, password, ssl_mode, tls, scheme, listen_ip, endpoint, api_key) resets the target's status to pending so the collector can re-verify the connection.

PATCH https://telemetry.betterstack.com/api/v1/collectors/{collector_id}/targets/{target_id}

Headers

Authorization
required string

Body parameters

host
string
port
integer
service
string
listen_ip
string
endpoint
string
username
string
password
string
api_key
string
ssl_mode
string
tls
string
scheme
string
enabled
boolean
200

Response body

{
  "data": {
    "id": "1",
    "type": "collector_target",
    "attributes": {
      "kind": "postgres",
      "host": "new-db.example.com",
      "port": 5432,
      "service": null,
      "listen_ip": null,
      "endpoint": null,
      "scheme": null,
      "username": "monitor",
      "ssl_mode": "require",
      "tls": null,
      "status": "pending",
      "enabled": true,
      "container": null,
      "detected_host": null,
      "autogenerated": false,
      "paused_until": null,
      "consecutive_failure_count": 0,
      "last_ping_at": "2025-06-15T14:32:00.000Z",
      "created_at": "2025-06-01T12:00:00.000Z",
      "updated_at": "2025-06-16T09:00:00.000Z"
    }
  }
}
422

Response body

{
  "errors": [
    "Ssl mode can't be blank"
  ],
  "invalid_attributes": [
    "ssl_mode"
  ]
}
404

Response body

{
  "errors": "Not found"
}

Example: Change host

cURL
curl -X PATCH "https://telemetry.betterstack.com/api/v1/collectors/1/targets/1" \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "host": "new-db.example.com"
     }'


Example: Rotate credentials

cURL
curl -X PATCH "https://telemetry.betterstack.com/api/v1/collectors/1/targets/1" \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "username": "new-monitor",
       "password": "new-secret"
     }'


Example: Disable a target

cURL
curl -X PATCH "https://telemetry.betterstack.com/api/v1/collectors/1/targets/1" \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "enabled": false
     }'