Grafana Cloud

The Collector HTTP API v2

Version 2 of the Grafana Fleet Management Collector API manages collectors and their remote attributes. It offers CRUD operations on individual collectors, paginated listing with filtering and sorting, collector counts, configuration previews, and bulk updates and deletes by ID or by filter.

For a full definition of the Collector API v2, refer to the .proto file.

Before you begin, ensure you have the following:

  • A Grafana Cloud stack with Fleet Management enabled.
  • Your stack’s Fleet Management instance ID and an access policy token with Fleet Management permissions, used as the basic authentication username and password.

Differences from version 1

Use the Collector API v2 to manage collectors and preview their configuration. Collectors continue to use the Collector API v1 to register and fetch their configuration.

Version 2 changes the following behavior compared to version 1:

  • Configuration preview: The new PreviewConfig endpoint returns the configuration a collector would receive, without registering the collector, recording a heartbeat, or reactivating it.
  • Pagination: ListCollectors returns results in pages of up to 500 collectors. Use next_page_token from the response to fetch the next page. The response type changes from Collectors to ListCollectorsResponse.
  • Filtering and sorting: ListCollectors takes a filter object instead of a top-level matchers list. The filter combines matchers, health statuses, an ID substring, a collector type, and activity states. You can sort by ID or last modified time, in ascending or descending order.
  • Collector state: ListCollectors returns each collector’s health status, last heartbeat, remote configuration status, and capabilities when you set include_state.
  • Counting: The new CountCollectors endpoint returns the number of collectors that match a filter.
  • Bulk operations by filter: The new BulkUpdateCollectorsByFilter and BulkDeleteCollectorsByFilter endpoints act on every collector that matches a filter, with optional exclusions and an optional expected count as a safety check.
  • Create and update responses: CreateCollector and UpdateCollector return the stored collector, including server-assigned timestamps, instead of an empty collector.
  • Empty attribute keys: CreateCollector and UpdateCollector reject remote attributes with an empty key with a 400 invalid_argument error.
  • Removed fields: The deprecated attributes and attribute_overrides fields are gone. Use local_attributes and remote_attributes.
  • Collector-only endpoints: The .proto file defines GetConfig, RegisterCollector, and UnregisterCollector, but version 2 doesn’t implement them. Requests to them fail with a 501 unimplemented error.

Find the base URL

You can find the base URL for the Collector API in the Grafana Cloud Fleet Management interface.

  1. In your Grafana Cloud stack, click Connections > Fleet Management in the left-side menu.

  2. On the Fleet Management interface, switch to the API tab.

  3. Find the URL in the Base URL section. It looks like one of the following URLs, depending on the region where your Grafana Cloud stack is hosted. Replace collector.v1 with collector.v2 to call version 2 of the API.

    Flat format, where <CLUSTER_NAME> is the production cluster of your stack:

    https://fleet-management-<CLUSTER_NAME>.grafana.net/collector.v2.CollectorService/

    Nested format, where <CSP> is the cloud provider, <CSP_REGION> is the cloud provider’s region identifier, and <COUNTER> distinguishes multiple Grafana Cloud regions hosted in the same cloud provider region:

    https://fleet-management-<CLUSTER_NAME>.<CSP>-<CSP_REGION>-<COUNTER>.grafana.net/collector.v2.CollectorService/

    Caution

    Always copy the exact URL from your Fleet Management interface instead of constructing it by hand. For details on the URL differences, refer to Determine Grafana Cloud URLs based on region.

Secure connection

If you need to secure your API traffic, you can configure a private endpoint in place of the base URL. You can find the service name for endpoint configuration and the private DNS name on the same API tab where the base URL is found. For more information, refer to the instructions for your cloud provider:

Rate limits and timeouts

You can make a request to the Fleet Management Tenant API to find out the requests-per-second limits applied to your stack.

All Collector API v2 requests count toward the requests_per_second:api limit reported by the Tenant API, which is 3 requests per second by default. Rate-limited requests fail with a 429 status code.

ListCollectors, CountCollectors, BulkUpdateCollectorsByFilter, and BulkDeleteCollectorsByFilter requests time out after 30 seconds and fail with a 504 deadline_exceeded error. A by-filter request that times out doesn’t update or delete any collectors. If a filtered request times out, narrow the filter. For ListCollectors, you can also try a smaller page_size.

CollectorService

CollectorService is the service that manages collectors and their remote attributes.

Method NameRequest TypeResponse TypeDescription
GetCollectorGetCollectorRequestCollectorReturns information about the collector
ListCollectorsListCollectorsRequestListCollectorsResponseReturns a page of collectors with optional filtering and sort order
CountCollectorsCountCollectorsRequestCountCollectorsResponseReturns the number of collectors that match a filter
PreviewConfigPreviewConfigRequestPreviewConfigResponseReturns the configuration a collector would receive, without side effects
CreateCollectorCreateCollectorRequestCollectorCreates a new collector and returns it
UpdateCollectorUpdateCollectorRequestCollectorUpdates an existing collector and returns it
BulkUpdateCollectorsBulkUpdateCollectorsRequestBulkUpdateCollectorsResponseUpdates the remote attributes of collectors listed by ID
BulkUpdateCollectorsByFilterBulkUpdateCollectorsByFilterRequestBulkUpdateCollectorsByFilterResponseUpdates the remote attributes of every collector that matches a filter
DeleteCollectorDeleteCollectorRequestDeleteCollectorResponseDeletes an existing collector
BulkDeleteCollectorsBulkDeleteCollectorsRequestBulkDeleteCollectorsResponseDeletes collectors listed by ID
BulkDeleteCollectorsByFilterBulkDeleteCollectorsByFilterRequestBulkDeleteCollectorsByFilterResponseDeletes every collector that matches a filter
ListCollectorAttributesListCollectorAttributesRequestListCollectorAttributesResponseReturns all attributes that are used for all collectors

Endpoints

This section describes the request and response messages for each endpoint, in alphabetical order.

Note

Protobuf field names are defined in snake_case. Responses use camelCase field names and can omit fields with default values, such as 0, false, or an empty string. Both snake_case and camelCase field names are accepted in requests.

BulkDeleteCollectorsByFilterRequest

BulkDeleteCollectorsByFilterRequest is a request to delete every collector that matches a filter. To preview how many collectors a filter matches, make a CountCollectors request with the same filter.

Fleet Management selects the matching collectors before it deletes them. Collectors deleted by another request in the meantime are skipped, and collectors changed in the meantime are still deleted.

FieldTypeLabelDescription
filterListCollectorsFilterrequiredCollectors that match this filter are deleted; at least one filter field must be set
exclude_idslist(string)optionalIDs of matching collectors to leave untouched; values must be unique
expected_countintegeroptionalNumber of collectors the request must act on, counted after exclude_ids are removed; must be 0 or greater

Fleet Management compares exclude_ids to collector IDs case-insensitively. IDs in exclude_ids that don’t match the filter are ignored and don’t change the count.

If expected_count is set and the number of matching collectors left after the exclusions differs from it, the request fails with a 400 failed_precondition error and no collectors are deleted.

BulkDeleteCollectorsByFilterResponse

BulkDeleteCollectorsByFilterResponse is the response to a BulkDeleteCollectorsByFilterRequest.

FieldTypeLabelDescription
deleted_countintegerNumber of collectors deleted

The deleted_count can be lower than expected_count if another request deletes some of the matching collectors in the meantime.

BulkDeleteCollectorsRequest

BulkDeleteCollectorsRequest is a request to delete multiple collectors. If any collectors don’t exist, the request fails with a 404 not_found error and no collectors are deleted.

FieldTypeLabelDescription
idslist(string)requiredIDs of collectors to delete; must contain at least one ID

BulkDeleteCollectorsResponse

BulkDeleteCollectorsResponse is the response to a BulkDeleteCollectorsRequest. This message is empty and the results of the delete are defined by the HTTP status code of the response.

BulkUpdateCollectorsByFilterRequest

BulkUpdateCollectorsByFilterRequest is a request to apply remote attribute operations to every collector that matches a filter. It accepts the same Operation list as BulkUpdateCollectorsRequest. To preview how many collectors a filter matches, make a CountCollectors request with the same filter.

Fleet Management selects the matching collectors before it updates them. Collectors deleted by another request in the meantime are skipped, and collectors changed in the meantime are still updated.

FieldTypeLabelDescription
filterListCollectorsFilterrequiredCollectors that match this filter are updated; at least one filter field must be set
opslist(Operation)requiredOperations applied to collectors in the order they’re provided; must not be empty
exclude_idslist(string)optionalIDs of matching collectors to leave untouched; values must be unique
expected_countintegeroptionalNumber of collectors the request must act on, counted after exclude_ids are removed; must be 0 or greater

Fleet Management compares exclude_ids to collector IDs case-insensitively. IDs in exclude_ids that don’t match the filter are ignored and don’t change the count.

The request fails and no collectors are updated in the following cases:

  • 400 failed_precondition: expected_count is set and the number of matching collectors left after the exclusions differs from it.
  • 400 invalid_argument: The operations would leave a collector with invalid remote attributes, as described in the BulkUpdateCollectorsRequest section.
  • 409 aborted: The request conflicted with another request that changed the same collectors. Retry the request.

BulkUpdateCollectorsByFilterResponse

BulkUpdateCollectorsByFilterResponse is the response to a BulkUpdateCollectorsByFilterRequest.

FieldTypeLabelDescription
updated_countintegerNumber of matching collectors, including any that the operations left unchanged

The updated_count can be lower than expected_count if another request deletes some of the matching collectors in the meantime.

BulkUpdateCollectorsRequest

BulkUpdateCollectorsRequest is a request to update multiple collectors’ remote attributes in a single request. If any requested update fails, Fleet Management applies none of the updates. A BulkUpdateCollectorsRequest can add, remove, replace, move, or copy remote attributes for the specified collectors. Each Operation applies to every collector in ids. IDs that don’t match an existing collector are skipped and don’t cause the request to fail. For a sample request, refer to the Bulk update collectors example.

Fleet Management validates each collector after it applies the operations. If the result breaks the remote_attributes limits for any collector, for example more than 100 attributes, a value longer than 150 characters, or a reserved attribute on an OpenTelemetry Collector, the request fails with a 400 invalid_argument error. If the request conflicts with another request that changes the same collectors, it fails with a 409 aborted error. Retry the request.

FieldTypeLabelDescription
idslist(string)requiredIDs of the collectors to update; must contain at least one ID
opslist(Operation)requiredOperations applied to collectors in the order they’re provided; must not be empty

BulkUpdateCollectorsResponse

BulkUpdateCollectorsResponse is the response to a BulkUpdateCollectorsRequest. This message is empty and the results of the update are defined by the HTTP status code of the response.

Collector

Collector represents the data for a single collector. The ID uniquely identifies the collector, and the local_attributes and remote_attributes determine which pipelines to include in the collector’s configuration. Remote attributes take precedence over attributes set in the collector’s local configuration except for any attributes prefixed with collector.. collector.* attributes are reserved for use by the Fleet Management service. OpenTelemetry Collectors also can’t have the remote attributes service.name, service.namespace, service.version, service.instance.id, os.type, and os.description, or remote attributes in the host. and cloud. namespaces. For more information, refer to reserved attributes.

FieldTypeLabelDescription
idstringrequiredID of the collector; OpenTelemetry Collector IDs must be UUIDs
local_attributesmap(string)optionalLast set of attributes received from the collector when it registered, plus the virtual collector.ID attribute; ignored in CreateCollector and UpdateCollector requests
remote_attributesmap(string)optionalAttributes stored in Fleet Management; up to 100 attributes, with non-empty keys of up to 100 characters and values of up to 150 characters
created_atgoogle.protobuf.TimestampoptionalTimestamp that the collector was created
updated_atgoogle.protobuf.TimestampoptionalTimestamp that the collector was last updated
namestringoptionalName of the collector used for display purposes only
enabledbooloptionalWhether remote configuration for the collector is enabled or not; disabled collectors receive empty configurations
marked_inactive_atgoogle.protobuf.TimestampoptionalTimestamp of when the collector was marked inactive
collector_typeCollectorTypeoptionalType of collector (Grafana Alloy or OpenTelemetry Collector); if unspecified in a CreateCollector or UpdateCollector request, it’s set to COLLECTOR_TYPE_ALLOY
stateCollectorStateoptionalComputed runtime state of the collector; only returned by ListCollectors when include_state is true

CollectorType

CollectorType represents the type of collector. If the CollectorType is left unspecified in a CreateCollector or UpdateCollector request, Fleet Management assigns COLLECTOR_TYPE_ALLOY.

ValueDescription
COLLECTOR_TYPE_UNSPECIFIEDCollector type is not specified
COLLECTOR_TYPE_ALLOYGrafana Alloy collector
COLLECTOR_TYPE_OTELOpenTelemetry Collector

CollectorState

CollectorState is the computed runtime state of a collector. ListCollectors returns it for each collector when the request sets include_state to true, so you don’t need a separate request for status and last-seen information.

FieldTypeLabelDescription
statusstringComputed health status of the collector: healthy, warning, or error
last_seengoogle.protobuf.TimestampoptionalTimestamp of the collector’s most recent heartbeat; omitted if no heartbeat exists
remote_config_statusRemoteConfigStatusoptionalLast remote configuration status reported by the collector; omitted if none has been reported
capabilitiesuint64optionalOpAMP capabilities bitmask reported by the collector; omitted if none has been reported

Fleet Management computes the status as follows:

  • error: The collector reported that it failed to apply its last remote configuration.
  • healthy: The collector sent a heartbeat in the last 30 minutes.
  • warning: The collector’s last heartbeat is older than 30 minutes or doesn’t exist.

RemoteConfigStatus

FieldTypeLabelDescription
statusRemoteConfigStatusesCurrent status of the last received remote configuration
error_messagestringoptionalError message when status is RemoteConfigStatuses_FAILED
RemoteConfigStatuses
ValueDescription
RemoteConfigStatuses_UNSETStatus not set
RemoteConfigStatuses_APPLIEDRemote config was successfully applied by the collector
RemoteConfigStatuses_APPLYINGCollector is currently applying the remote config
RemoteConfigStatuses_FAILEDApplying the previously received remote config failed (see error_message)

CountCollectorsRequest

CountCollectorsRequest is the request to count collectors that match a filter. It accepts the same ListCollectorsFilter as ListCollectors. If no filter is specified, all collectors are counted.

FieldTypeLabelDescription
filterListCollectorsFilteroptionalFilters to apply when counting collectors

CountCollectorsResponse

CountCollectorsResponse is the response to a CountCollectorsRequest. If no collectors match, the response omits the count field.

FieldTypeLabelDescription
countintegerTotal number of collectors matching the filter

CreateCollectorRequest

CreateCollectorRequest is the request to create a new collector. If no collector_type is specified in this request, COLLECTOR_TYPE_ALLOY is assigned by default. If enabled isn’t specified, the collector is enabled. Fleet Management ignores any local_attributes in this request.

The request fails in the following cases:

  • 409 already_exists: A collector with the same ID already exists.
  • 429 resource_exhausted: Your stack has reached its collector limit.
  • 400 invalid_argument: The ID is empty, an OpenTelemetry Collector ID isn’t a UUID, or the remote attributes have an empty key, use a reserved attribute or namespace, or exceed the limits.
FieldTypeLabelDescription
collectorCollectorrequiredNew collector; id must not be empty

DeleteCollectorRequest

DeleteCollectorRequest is the request to delete an existing collector. If the collector doesn’t exist, the request fails with a 404 not_found error.

FieldTypeLabelDescription
idstringrequiredID of the collector to delete

DeleteCollectorResponse

DeleteCollectorResponse is the response to a DeleteCollectorRequest. This message is empty and the results of the delete are defined by the HTTP status code of the response.

GetCollectorRequest

GetCollectorRequest is the request to retrieve a collector’s information. Its response is a Collector message. If the collector doesn’t exist, the request fails with a 404 not_found error.

FieldTypeLabelDescription
idstringrequiredID of the collector to retrieve

ListCollectorAttributesRequest

ListCollectorAttributesRequest is the request to list all attributes that are used for all collectors.

ListCollectorAttributesResponse

ListCollectorAttributesResponse is the response to a ListCollectorAttributesRequest. It contains maps of all attributes and all their values that are used for all collectors.

FieldTypeLabelDescription
local_attributesmap(string, Attributes)Local attributes for all collectors
remote_attributesmap(string, Attributes)Attributes stored in Fleet Management for all collectors

If at least one collector exists, local_attributes includes the virtual attribute collector.ID with an empty list of values.

ListCollectorAttributesResponse.AttributesEntry

FieldType
keystring
valueAttributes
Attributes
FieldTypeLabelDescription
valueslist(Value)All values for a single attribute
Value
FieldTypeLabelDescription
valuestringSingle value for an attribute

ListCollectorsFilter

ListCollectorsFilter groups the filters you can apply when listing, counting, bulk updating, or bulk deleting collectors. A collector must match every filter that you set.

FieldTypeLabelDescription
matcherslist(string)optionalMatchers used to filter collectors by attribute; follows the syntax of Prometheus Alertmanager matchers
statuseslist(string)optionalHealth statuses to include: healthy, warning, or error; values must be unique; if empty, collectors of all statuses are included
idstringoptionalIncludes only collectors whose ID contains this value; case-insensitive; 256 character limit
collector_typeCollectorTypeoptionalIncludes only collectors of this type; if unset or COLLECTOR_TYPE_UNSPECIFIED, collectors of all types are included
activity_stateslist(string)optionalActivity states to include: active or inactive; values must be unique; if empty, collectors of all activity states are included

Matchers apply to the collector’s combined attributes: its local attributes, its remote attributes, which take precedence over local attributes with the same key, and the virtual collector.ID attribute. A collector is active if it hasn’t been marked inactive, and inactive otherwise. Health statuses follow the rules in the CollectorState section. Requests with an invalid matcher, or an invalid or duplicate value in statuses or activity_states, fail with a 400 invalid_argument error.

ListCollectorsRequest

ListCollectorsRequest is the request to list collectors one page at a time, with optional filtering and sort order. If no filter is specified, all collectors are returned.

To fetch the next page, send the same request with page_token set to the next_page_token from the previous response. If you change filter, sort_by, or sort_descending, omit page_token and start again from the first page. An invalid page_token fails with a 400 invalid_argument error.

FieldTypeLabelDescription
page_tokenstringoptionalToken for the page to fetch; omit to fetch the first page
page_sizeintegeroptionalMaximum number of collectors to return per page; default is 100 and maximum is 500
sort_byListCollectorsRequest.SortByoptionalField to sort results by; default is SORT_BY_ID
sort_descendingbooloptionalWhether to sort results in descending order; default is false
filterListCollectorsFilteroptionalFilters to apply to the list of collectors
include_statebooloptionalWhether to include each collector’s CollectorState in the response; default is false

If page_size is 0 or less, Fleet Management uses the default of 100. If page_size is greater than 500, Fleet Management uses 500. Every page except the last contains exactly this number of collectors. The last page might contain fewer collectors or be empty.

ListCollectorsRequest.SortBy

ValueDescription
SORT_BY_UNSPECIFIEDDefault; sorts by collector ID
SORT_BY_IDSorts by collector ID
SORT_BY_LAST_MODIFIEDSorts by the time the collector was last updated

ListCollectorsResponse

ListCollectorsResponse is the response to a ListCollectorsRequest.

FieldTypeLabelDescription
collectorslist(Collector)Collectors on the current page
next_page_tokenstringToken for fetching the next page; omitted if there are no more pages

Operation

Operation is a single operation to apply to a collector’s remote attributes.

The path and from fields use the format remoteAttributes.<ATTRIBUTE_KEY>. For example, the path for the env remote attribute is remoteAttributes.env. Everything after the first . is the attribute key, so remoteAttributes.team.name refers to the team.name attribute. You can’t modify attributes in the reserved collector. namespace.

If any operation is invalid, the request fails with a 400 invalid_argument error and no collectors are updated. An operation is invalid in the following cases:

  • Path: path or from is empty, doesn’t start with remoteAttributes., has no attribute key after the prefix, or refers to a collector. attribute.
  • ADD: The operation has no value. An empty string is a valid value.
  • REPLACE: The operation has no value, or value is an empty string.
  • MOVE and COPY: The operation has no from.
  • Operation type: op isn’t set or isn’t one of the values in the Operation.OpType table.
FieldTypeLabelDescription
opOperation.OpTyperequiredOperation to perform
pathstringrequiredPath for the operation formatted as a JSON path, for example remoteAttributes.env
fromstringoptionalUsed by the MOVE and COPY operations for the source path to move or copy the value from
valuestringoptionalValue for ADD and REPLACE operations, as well as selective removal
oldValuestringoptionalOld value to match against for a selective replace

Operation.OpType

ValueDescription
ADDAdds a new attribute or replaces one with the specified path
REMOVERemoves the attribute at the specified path; if value is set, removes it only if its value matches value
REPLACEReplaces the existing value of the attribute at the specified path but doesn’t create one if none exists; if oldValue is set, replaces it only if its value matches oldValue
MOVEMoves the attribute with the specified from to the specified path; does nothing if from doesn’t exist
COPYCopies the attribute at the specified from to the specified path; does nothing if from doesn’t exist

PreviewConfigRequest

PreviewConfigRequest is the request to preview the configuration a collector would receive. Fleet Management builds the configuration from the collector’s stored local and remote attributes. Unlike a collector’s own GetConfig request, a preview doesn’t register the collector, record a heartbeat, or reactivate an inactive collector. If the collector is disabled, the preview returns the configuration a disabled collector receives: a base configuration with no pipelines for Alloy, or an empty configuration for an OpenTelemetry Collector.

The request fails in the following cases:

  • 404 not_found: The collector doesn’t exist.
  • 400 failed_precondition: A matching pipeline references an export that can’t be resolved.
FieldTypeLabelDescription
idstringrequiredID of the collector to preview configuration for

PreviewConfigResponse

PreviewConfigResponse is the response to a PreviewConfigRequest.

FieldTypeLabelDescription
contentstringFull configuration the collector would receive
hashstringHash of the configuration content

UpdateCollectorRequest

UpdateCollectorRequest is the request to update an existing collector. It updates the collector with the exact values provided in the request. If the enabled field isn’t provided, the collector’s existing state persists. All other updates aren’t selective, and any fields that aren’t provided are removed. Fleet Management ignores any local_attributes in this request.

The request also replaces collector_type. If you leave it unset, Fleet Management sets the type to COLLECTOR_TYPE_ALLOY, even if the collector was an OpenTelemetry Collector. To update an OpenTelemetry Collector, set collector_type to COLLECTOR_TYPE_OTEL.

The request fails in the following cases:

  • 404 not_found: The collector doesn’t exist.
  • 400 invalid_argument: The collector fails the same checks as in a CreateCollectorRequest.
FieldTypeLabelDescription
collectorCollectorrequiredCollector to be updated; id must not be empty

Examples

The examples in this section use curl with basic authentication. Replace user:pass with your Fleet Management instance ID and access policy token, and replace the base URL with the one from your API tab.

The following JSON files contain sample payloads about a collector, karasu:

JSON
--- create-collector.json ---
{
    "collector": {
        "id": "karasu",
        "remote_attributes": {"myremoteattr": "myremoteval"},
        "name": "raven",
        "enabled": true,
        "collector_type": "COLLECTOR_TYPE_ALLOY"
    }
}

--- update-collector.json ---
{
    "collector": {
        "id": "karasu",
        "remote_attributes": {"myremoteattr": "mynewremoteval"},
        "name": "raven"
    }
}

--- get-collector.json ---
{
    "id": "karasu"
}

--- delete-collector.json ---
{
    "id": "karasu"
}

You can use these payloads to make the following requests. CreateCollector and UpdateCollector return the collector as it’s stored in Fleet Management:

shell
$ curl -q \
    -d @create-collector.json \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/CreateCollector
{"id":"karasu","localAttributes":{"collector.ID":"karasu"},"remoteAttributes":{"myremoteattr":"myremoteval"},"createdAt":"2026-09-02T14:59:13Z","updatedAt":"2026-09-02T14:59:13Z","name":"raven","enabled":true,"collectorType":"COLLECTOR_TYPE_ALLOY"}%

$ curl -q \
    -d @update-collector.json \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/UpdateCollector
{"id":"karasu","localAttributes":{"collector.ID":"karasu"},"remoteAttributes":{"myremoteattr":"mynewremoteval"},"createdAt":"2026-09-02T14:59:13Z","updatedAt":"2026-09-02T16:18:38Z","name":"raven","enabled":true,"collectorType":"COLLECTOR_TYPE_ALLOY"}%

$ curl -q \
    -d @get-collector.json \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/GetCollector
{"id":"karasu","localAttributes":{"collector.ID":"karasu"},"remoteAttributes":{"myremoteattr":"mynewremoteval"},"createdAt":"2026-09-02T14:59:13Z","updatedAt":"2026-09-02T16:18:38Z","name":"raven","enabled":true,"collectorType":"COLLECTOR_TYPE_ALLOY"}%

$ curl -q \
    -d @delete-collector.json \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/DeleteCollector
{}%

List collectors

The following JSON file contains a sample ListCollectorsRequest payload. It requests the 2 most recently updated active Grafana Alloy collectors running on Linux that are in a warning or error state, and includes each collector’s state in the response:

JSON
--- list-collectors.json ---
{
    "page_size": 2,
    "sort_by": "SORT_BY_LAST_MODIFIED",
    "sort_descending": true,
    "include_state": true,
    "filter": {
        "matchers": ["collector.os=linux"],
        "statuses": ["warning", "error"],
        "collector_type": "COLLECTOR_TYPE_ALLOY",
        "activity_states": ["active"]
    }
}

You can use this payload to make the following request:

shell
curl -q \
    -d @list-collectors.json \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/ListCollectors

The output resembles the following:

JSON
{
  "collectors": [
    {
      "id": "kuro",
      "localAttributes": {
        "collector.ID": "kuro",
        "collector.os": "linux",
        "collector.version": "v1.12.0"
      },
      "createdAt": "2026-09-01T10:12:44Z",
      "updatedAt": "2026-09-03T08:21:05Z",
      "enabled": true,
      "collectorType": "COLLECTOR_TYPE_ALLOY",
      "state": {
        "status": "error",
        "lastSeen": "2026-09-03T08:20:58Z",
        "remoteConfigStatus": {
          "status": "RemoteConfigStatuses_FAILED",
          "errorMessage": "... error details ..."
        },
        "capabilities": "8191"
      }
    },
    {
      "id": "hayabusa",
      "localAttributes": {
        "collector.ID": "hayabusa",
        "collector.os": "linux",
        "collector.version": "v1.11.3"
      },
      "createdAt": "2026-08-28T15:40:02Z",
      "updatedAt": "2026-09-02T19:03:37Z",
      "enabled": true,
      "collectorType": "COLLECTOR_TYPE_ALLOY",
      "state": {
        "status": "warning",
        "lastSeen": "2026-09-02T19:03:30Z",
        "remoteConfigStatus": {
          "status": "RemoteConfigStatuses_APPLIED"
        },
        "capabilities": "8191"
      }
    }
  ],
  "nextPageToken": "<NEXT_PAGE_TOKEN>"
}

The response returns the capabilities value as a JSON string.

To fetch the next page, send the same payload with page_token set to the nextPageToken value from the response, where <NEXT_PAGE_TOKEN> is the token returned by the previous request:

shell
jq --arg token "<NEXT_PAGE_TOKEN>" '.page_token = $token' list-collectors.json > list-collectors-next.json

When the response doesn’t contain nextPageToken, you’ve reached the last page.

Count collectors

The CountCollectors request takes the same filter as ListCollectors. The following request counts all collectors in an error state:

shell
curl -q \
    -d '{"filter": {"statuses": ["error"]}}' \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/CountCollectors
{"count":12}%

To count all collectors, send an empty payload, {}.

Preview a collector’s configuration

The PreviewConfig request returns the configuration Fleet Management would send to a collector, based on the attributes it has stored. Use it to check the effect of remote attribute or pipeline changes before the collector picks them up:

shell
curl -q \
    -d '{"id": "karasu"}' \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/PreviewConfig

The output resembles the following, where content contains the full configuration:

JSON
{"content":"declare \"my_pipeline\" {\n  ...\n}\n","hash":"<CONFIG_HASH>"}

Bulk update collectors

The following JSON file contains a sample BulkUpdateCollectorsRequest payload that updates the remote attributes of three collectors, karasu, kuro, and hayabusa, in a single request:

JSON
--- bulk-update-collectors.json ---
{
    "ids": ["karasu", "kuro", "hayabusa"],
    "ops": [
        {
            "op": "ADD",
            "path": "remoteAttributes.env",
            "value": "production"
        },
        {
            "op": "REPLACE",
            "path": "remoteAttributes.team",
            "oldValue": "platform",
            "value": "observability"
        },
        {
            "op": "MOVE",
            "from": "remoteAttributes.region",
            "path": "remoteAttributes.cloud_region"
        },
        {
            "op": "REMOVE",
            "path": "remoteAttributes.deprecated"
        }
    ]
}

Fleet Management applies the operations in order to each collector:

  1. ADD sets env to production, creating the attribute or overwriting its current value.
  2. REPLACE changes team to observability, but only on collectors where team is currently platform.
  3. MOVE renames the region attribute to cloud_region and keeps its value.
  4. REMOVE deletes the deprecated attribute.

Operations that don’t match a collector, for example a REPLACE where the current value differs from oldValue, leave that collector unchanged and don’t cause the request to fail.

You can use this payload to make the following request:

shell
$ curl -q \
    -d @bulk-update-collectors.json \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/BulkUpdateCollectors
{}%

To confirm the changes, make a GetCollector request for one of the collectors, or a ListCollectors request with a matcher on the new attribute:

shell
$ curl -q \
    -d '{"filter": {"matchers": ["env=production"]}}' \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/ListCollectors

Bulk update collectors by filter

Before you update by filter, use ListCollectors with the same filter to review the matching collectors. Then use CountCollectors to get the number of matches. The following request counts the active collectors with env=staging:

shell
$ curl -q \
    -d '{"filter": {"matchers": ["env=staging"], "activity_states": ["active"]}}' \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/CountCollectors
{"count":42}%

The following JSON file contains a sample BulkUpdateCollectorsByFilterRequest payload. It sets tier to gold on the same collectors, except kuro, and requires the request to act on exactly 41 collectors:

JSON
--- bulk-update-by-filter.json ---
{
    "filter": {
        "matchers": ["env=staging"],
        "activity_states": ["active"]
    },
    "ops": [
        {
            "op": "ADD",
            "path": "remoteAttributes.tier",
            "value": "gold"
        }
    ],
    "exclude_ids": ["kuro"],
    "expected_count": 41
}

You can use this payload to make the following request:

shell
$ curl -q \
    -d @bulk-update-by-filter.json \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/BulkUpdateCollectorsByFilter
{"updatedCount":41}%

If collectors register or change between the count and the update so that the filter no longer matches exactly 41 collectors after the exclusion, the request fails with a 400 failed_precondition error and no collectors are updated. Review the matching collectors with ListCollectors before you count again and retry.

Bulk delete collectors

The BulkDeleteCollectors request deletes multiple collectors by ID in a single request. If any collector in the list doesn’t exist, the request fails with a 404 not_found error and no collectors are deleted:

shell
$ curl -q \
    -d '{"ids": ["karasu", "kuro", "hayabusa"]}' \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/BulkDeleteCollectors
{}%

Bulk delete collectors by filter

The BulkDeleteCollectorsByFilter request deletes every collector that matches a filter. The following request deletes all inactive collectors, and requires the count from a previous CountCollectors request with the same filter to still be accurate:

shell
$ curl -q \
    -d '{"filter": {"activity_states": ["inactive"]}, "expected_count": 17}' \
    -u "user:pass" \
    --header "Content-Type: application/json" \
    -X POST https://fleet-management-prod-001.grafana.net/collector.v2.CollectorService/BulkDeleteCollectorsByFilter
{"deletedCount":17}%

A by-filter request must set at least one filter field.

Next steps