The Pipeline HTTP API v2
The Grafana Fleet Management Pipeline API v2 allows you to perform CRUD operations on configuration pipelines. It also lets you list, count, and delete pipelines in bulk using filters, and page through large result sets.
For a full definition of the Pipeline API v2, refer to the .proto file.
Differences from v1
When you migrate from the Pipeline API v1, the following changes affect the requests you send and the responses you receive:
- Pagination:
ListPipelines,ListPipelinesRevisions, andListPipelineRevisionsreturn results one page at a time. Use thenext_page_tokenfrom a response to request the next page. - Filtering and sorting:
ListPipelinesfilters by pipeline name, enabled state, and metadata type, and sorts by name or last modified time. It no longer filters bylocal_attributes,remote_attributes, orconfig_type. To find the pipelines that match a set of collector attributes, useGetMatchingPipelines. - Revision order and filters: The revision RPCs return revisions newest first and accept filters for operation, author, and creation time.
- New RPCs:
CountPipelines,BulkDeletePipelinesByFilter, andGetMatchingPipelinesare only available in v2. - Stricter validation:
BulkDeletePipelines.ids,BulkDeletePipelinesByFilter.exclude_ids,ListPipelineRevisions.id,ListPipelinesRevisionsFilter.pipeline_id, andGetPipelineRevision.revision_idmust be digit-only strings.
Find the base URL
You can find the base URL for the Pipeline API in the Grafana Cloud Fleet Management interface.
In your Grafana Cloud stack, click Connections > Fleet Management in the left-side menu.
On the Fleet Management interface, switch to the API tab.
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. To call the Pipeline API v2, replace
pipeline.v1withpipeline.v2in the URL.Flat format, where
<CLUSTER_NAME>is the production cluster of your stack:https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/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/pipeline.v2.PipelineService/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 limit
You can make a request to the Fleet Management Tenant API to find out the requests-per-second limits applied to your stack.
Requests to the Pipeline API v2 are included in the requests_per_second:api limit reported by the Tenant API and are limited to 3 requests per second by default.
Requests to the Pipeline API v1 and v2 share this limit.
PipelineService
The PipelineService defines the RPCs for managing pipelines.
Endpoints
This section describes the request and response messages of the PipelineService RPCs and the types they use.
Note
Protobuf field names are defined in
snake_case. Responses usecamelCasefield names. Bothsnake_caseandcamelCasefield names are accepted in requests.
CreatePipelineRequest
CreatePipelineRequest is the request to create a new pipeline.
Don’t set pipeline.id; Fleet Management assigns the ID when it creates the pipeline.
If a pipeline with the same name already exists, the request returns a 409 ALREADY EXISTS error.
If no config_type is specified in this request, CONFIG_TYPE_ALLOY is assigned by default.
DeletePipelineRequest
DeletePipelineRequest is the request to delete a pipeline by its ID.
Requests with an id that isn’t a digit-only string fail with a 400 BAD REQUEST validation error.
DeletePipelineResponse
DeletePipelineResponse is the response to deleting a pipeline.
This message is empty and the results of the deletion are defined by the HTTP status code of the response.
BulkDeletePipelinesRequest
BulkDeletePipelinesRequest is the request to delete multiple pipelines by their IDs.
The operation is atomic: either all pipelines are deleted or none are.
If any pipeline in the list doesn’t exist, the entire operation fails with a 404 NOT FOUND error and no pipelines are deleted.
Requests with duplicate IDs, or with an ID that isn’t a digit-only string, fail with a 400 BAD REQUEST validation error.
BulkDeletePipelinesResponse
BulkDeletePipelinesResponse is the response to deleting multiple pipelines.
This message is empty and the results of the deletion are defined by the HTTP status code of the response.
BulkDeletePipelinesByFilterRequest
BulkDeletePipelinesByFilterRequest is the request to delete every pipeline matching a filter.
To preview which pipelines the request deletes, send a ListPipelinesRequest with the same filter.
The filter must set enabled, metadata_type, or a non-empty name.
Requests that don’t set one fail with a 400 BAD REQUEST validation error.
Fleet Management selects the matching pipelines before it deletes them.
It skips pipelines that another request deletes in the meantime, and still deletes pipelines that another request changes in the meantime.
Skipped pipelines don’t count toward deleted_count, so deleted_count can be smaller than the number of matching pipelines you didn’t exclude.
To guard against unexpected changes, set expected_count to the number of pipelines you expect the request to delete: the count that CountPipelines returns for the same filter, minus the matching pipelines in exclude_ids.
Fleet Management compares expected_count with the number of matching pipelines after it removes the exclude_ids.
If the numbers differ, the request fails with a 400 FAILED PRECONDITION error and deletes no pipelines.
BulkDeletePipelinesByFilterResponse
BulkDeletePipelinesByFilterResponse is the response to deleting pipelines by filter.
GetPipelineRequest
GetPipelineRequest is the request to retrieve a pipeline by its ID.
GetPipelineIDRequest
GetPipelineIDRequest is the request to retrieve a pipeline ID by its name.
GetPipelineIDResponse
GetPipelineIDResponse is the response to retrieving a pipeline ID.
ListPipelinesRequest
ListPipelinesRequest is the request to get a page of pipelines, including their contents and matchers.
You can filter the returned pipelines by name, enabled state, and metadata type, and sort them by name or last modified time.
To get 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.
Requests with an invalid page_token fail with a 400 BAD REQUEST error.
ListPipelinesRequest.SortBy
ListPipelinesFilter
ListPipelinesFilter narrows down the pipelines returned by ListPipelinesRequest, counted by CountPipelinesRequest, and deleted by BulkDeletePipelinesByFilterRequest.
When you set more than one field, a pipeline must match all of them.
ListPipelinesResponse
ListPipelinesResponse is the response to listing pipelines.
CountPipelinesRequest
CountPipelinesRequest is the request to count the pipelines matching a filter.
It accepts the same filter as ListPipelinesRequest.
CountPipelinesResponse
CountPipelinesResponse is the response to counting pipelines.
GetMatchingPipelinesRequest
GetMatchingPipelinesRequest is the request to retrieve the pipelines whose matchers match a set of collector attributes.
Fleet Management matches pipelines against the attributes in the request and doesn’t look up a stored collector.
The collector_id is applied as the collector.ID attribute and replaces any collector.ID key in the supplied attributes.
If a key exists in both local_attributes and remote_attributes, the remote attribute takes precedence.
The response doesn’t guarantee an order of pipelines.
GetMatchingPipelinesResponse
GetMatchingPipelinesResponse is the response to retrieving matching pipelines.
ConfigType
Represents the type of config used by a pipeline.
If the ConfigType is left unspecified in a create, update, upsert, or sync request, Fleet Management assigns CONFIG_TYPE_ALLOY.
To keep an OpenTelemetry Collector pipeline, set CONFIG_TYPE_OTEL every time you update it.
Pipeline
A Pipeline is a self-contained piece of configuration that can be assigned to collectors based on matchers.
PipelineSource
PipelineSource indicates the external source of a pipeline.
Although the two fields type and namespace are optional, if type is specified, then namespace must also be specified.
If type is set to SOURCE_TYPE_UNSPECIFIED, namespace must be an empty string.
Requests that don’t follow these rules fail with a 400 BAD REQUEST validation error.
PipelineSource_SourceType
UpdatePipelineRequest
UpdatePipelineRequest is the request to update an existing pipeline.
Set pipeline.id to the ID of the pipeline to update.
The pipeline supplied in this request replaces the existing configuration.
Include all configuration fields you want to keep.
If the pipeline doesn’t already exist, this request returns a 404 NOT FOUND error.
UpsertPipelineRequest
UpsertPipelineRequest is the request to create a new pipeline or update an existing one by name.
Don’t set pipeline.id; Fleet Management uses pipeline.name to find the pipeline.
If the pipeline already exists, Fleet Management replaces its configuration, as in an UpdatePipelineRequest.
Include all configuration fields you want to keep.
ListPipelinesRevisionsRequest
ListPipelinesRevisionsRequest is the request to get a page of revisions across all pipelines, excluding contents.
The response lists revisions newest first.
To get the next page, send the same request with page_token set to the next_page_token from the previous response.
If you change filter, omit page_token and start again from the first page.
Requests with an invalid page_token fail with a 400 BAD REQUEST error.
ListPipelinesRevisionsFilter
ListPipelinesRevisionsFilter narrows down the revisions returned by ListPipelinesRevisionsRequest.
The pipeline_name filter matches the name stored in each revision; later renames don’t change earlier revisions.
When you set more than one field, a revision must match all of them.
If you set both created_after and created_before, created_before must be later than created_after.
ListPipelinesRevisionsResponse
ListPipelinesRevisionsResponse is the response to listing revisions across all pipelines.
The pipeline snapshot in each revision doesn’t include the pipeline contents.
ListPipelineRevisionsRequest
ListPipelineRevisionsRequest is the request to retrieve a page of pipeline revisions by pipeline ID.
The response lists revisions newest first.
An unknown pipeline ID returns an empty list.
To get the next page, send the same request with page_token set to the next_page_token from the previous response.
If you change id or filter, omit page_token and start again from the first page.
Requests with an invalid page_token fail with a 400 BAD REQUEST error.
ListPipelineRevisionsFilter
ListPipelineRevisionsFilter narrows down the revisions returned by ListPipelineRevisionsRequest.
It accepts the same fields as ListPipelinesRevisionsFilter, except pipeline_name and pipeline_id.
ListPipelineRevisionsResponse
ListPipelineRevisionsResponse is the response to listing the revisions of a single pipeline.
GetPipelineRevisionRequest
GetPipelineRevisionRequest is the request to retrieve a pipeline revision by revision ID.
If the revision doesn’t exist, the request returns a 404 NOT FOUND error.
PipelineRevision
A PipelineRevision represents a point in time for a Pipeline.
Revisions created without author context or before author tracking was available omit the author field.
PipelineRevision.Operation
SyncPipelinesRequest
SyncPipelinesRequest is the request to bulk update pipelines from a common source.
Fleet Management creates pipelines that don’t exist and updates existing pipelines as it does for an UpsertPipelineRequest.
Fleet Management deletes pipelines that have the same source type and namespace as the request’s source but aren’t in the request’s pipelines.
It leaves pipelines with a different source or no source unchanged.
The source must set a type other than SOURCE_TYPE_UNSPECIFIED and a non-empty namespace.
SyncPipelinesResponse
SyncPipelinesResponse is the response to bulk updating pipelines.
This message is empty and the results of the sync are defined by the HTTP status code of the response.
An HTTP status code of 400 indicates a validation error in the source field of the request or in one or more of the pipelines.
Examples
This section shows example requests and responses for the Pipeline API v2.
For examples of SyncPipelines requests, refer to Sync configuration pipelines from a Git repository.
The examples use the following placeholders:
<INSTANCE_ID>: Your Grafana Cloud instance ID, which you can find on the API tab in the Fleet Management interface. The API uses it as the Basic Auth username.<ACCESS_POLICY_TOKEN>: Your Grafana Cloud access policy token, which the API uses as the Basic Auth password.<CLUSTER_NAME>: The production cluster of your stack, as described in the Find the base URL section. If your base URL uses the nested format, replace the whole host with the one from your base URL.<PIPELINE_NAME>: The name of the pipeline to create or update.
Pipeline API requests and responses require proper escaping of the pipeline contents.
For this reason, some use of jq is helpful.
In this example, the contents of the pipeline are saved in a file named config.alloy:
--- config.alloy ---
prometheus.exporter.self "alloy" { }
prometheus.scrape "alloy" {
targets = prometheus.exporter.self.alloy.targets
forward_to = [prometheus.remote_write.grafanacloud.receiver]
scrape_interval = "60s"
}
prometheus.remote_write "grafanacloud" {
// Must match the uniquely-identifiable ID set up in the remotecfg block.
external_labels = {"collector_id" = constants.hostname}
endpoint {
url = <SERVICE_URL>
basic_auth {
username = <USERNAME>
password_file = <PASSWORD_FILE>
}
}
}In this file, <SERVICE_URL> is the remote write endpoint, <USERNAME> is the username for that endpoint, and <PASSWORD_FILE> is the path to a file that contains its password.
To build a payload for the CreatePipeline and UpsertPipeline requests with properly escaped content, the following command is a good starting point.
It redirects the content to a create-pipeline.json file for easier handling:
jq --arg contents "$(cat config.alloy)" \
--arg name "<PIPELINE_NAME>" \
--argjson matchers '["collector.os=linux", "team!=team-a"]' \
--argjson enabled true \
'.pipeline = {name: $name, contents: $contents, matchers: $matchers, enabled: $enabled}' \
<<< '{}' > create-pipeline.jsonTo create the pipeline, send the payload in a CreatePipeline request:
curl -q \
-d @create-pipeline.json \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/CreatePipelineThe response shows what Fleet Management created, including the unique ID of the pipeline:
{
"name": "myname",
"contents": " ... pipeline contents ...",
"matchers": [
"collector.os=\"linux\"",
"team!=\"team-a\""
],
"enabled": true,
"id": "22234",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
}The ListPipelines request returns one page of pipelines.
In this example, the request asks for enabled pipelines whose name contains pipeline, two at a time:
curl -q \
-d '{"page_size": 2, "filter": {"name": "pipeline", "enabled": true}}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/ListPipelinesThe response includes a nextPageToken because more pipelines match the filter:
{
"pipelines": [
{
"name": "pipeline_1",
"contents": " ... pipeline contents ...",
"matchers": [
"team=\"team-a\""
],
"createdAt": "2024-09-02T12:31:47Z",
"updatedAt": "2024-09-02T14:08:10Z",
"enabled": true,
"id": "22231",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
},
{
"name": "pipeline_2",
"contents": " ... pipeline contents ...",
"matchers": [
"collector.os=\"darwin\""
],
"createdAt": "2024-09-02T16:42:26Z",
"updatedAt": "2024-09-02T16:42:26Z",
"enabled": true,
"id": "22235",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
}
],
"nextPageToken": "eyJwcmltYXJ5IjoicGlwZWxpbmVfMiJ9"
}To get the next page, send the same request with page_token set to the nextPageToken from the previous response:
curl -q \
-d '{"page_size": 2, "filter": {"name": "pipeline", "enabled": true}, "page_token": "eyJwcmltYXJ5IjoicGlwZWxpbmVfMiJ9"}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/ListPipelinesThe response for the last page omits nextPageToken:
{
"pipelines": [
{
"name": "pipeline_3",
"contents": " ... pipeline contents ...",
"matchers": [
"team=\"team-b\""
],
"createdAt": "2024-09-03T08:15:02Z",
"updatedAt": "2024-09-03T08:15:02Z",
"enabled": true,
"id": "22237",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
}
]
}The CountPipelines request accepts the same filter as ListPipelines and returns the number of matching pipelines:
curl -q \
-d '{"filter": {"name": "pipeline", "enabled": true}}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/CountPipelinesThe response resembles the following:
{
"count": 3
}The GetMatchingPipelines request returns the pipelines that a collector with the given attributes receives.
Use it to check which pipelines match a collector before you change its attributes:
curl -q \
-d '{"collector_id": "my-collector", "local_attributes": {"collector.os": "darwin"}, "remote_attributes": {"team": "team-b"}, "enabled": true}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/GetMatchingPipelinesThe response resembles the following:
{
"pipelines": [
{
"name": "pipeline_2",
"contents": " ... pipeline contents ...",
"matchers": [
"collector.os=\"darwin\""
],
"createdAt": "2024-09-02T16:42:26Z",
"updatedAt": "2024-09-02T16:42:26Z",
"enabled": true,
"id": "22235",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
},
{
"name": "pipeline_3",
"contents": " ... pipeline contents ...",
"matchers": [
"team=\"team-b\""
],
"createdAt": "2024-09-03T08:15:02Z",
"updatedAt": "2024-09-03T08:15:02Z",
"enabled": true,
"id": "22237",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
}
]
}You can use a similar jq command to build an UpdatePipeline request redirected to update-pipeline.json, by adding the unique pipeline ID:
jq --arg contents "$(cat config.alloy)" \
--arg id "22234" \
--arg name "<PIPELINE_NAME>" \
--argjson matchers '["collector.os=linux", "team!=team-a"]' \
--argjson enabled true \
'.pipeline = {id: $id, name: $name, contents: $contents, matchers: $matchers, enabled: $enabled}' \
<<< '{}' > update-pipeline.jsonTo update the pipeline, send the payload in an UpdatePipeline request:
curl -q \
-d @update-pipeline.json \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/UpdatePipelineThe response shows what Fleet Management updated:
{
"name": "myname",
"contents": " ... new pipeline contents ...",
"matchers": [
"collector.os=\"linux\"",
"team!=\"team-a\""
],
"enabled": true,
"id": "22234",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
}The GetPipeline and DeletePipeline requests require only an ID for accessing and removing a configuration.
To get a pipeline, send a GetPipeline request with its ID:
curl -q \
-d '{"id": "22234"}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/GetPipelineThe response resembles the following:
{
"name": "myname",
"contents": "... pipeline contents ...",
"matchers": [
"collector.os=\"linux\"",
"team!=\"team-a\""
],
"createdAt": "2024-09-02T16:42:26Z",
"updatedAt": "2024-09-02T16:42:26Z",
"enabled": true,
"id": "22234",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
}To delete the pipeline, send a DeletePipeline request with its ID:
curl -q \
-d '{"id": "22234"}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/DeletePipelineThe response resembles the following:
{}The BulkDeletePipelines endpoint allows you to delete multiple pipelines based on their IDs in a single request.
This is useful when you need to clean up multiple pipelines at once.
The operation is atomic.
If any pipeline in the list doesn’t exist, the entire operation fails with a 404 NOT FOUND response and no pipelines are deleted.
To delete three pipelines, send their IDs in a BulkDeletePipelines request:
curl -q \
-d '{"ids": ["22231", "22235", "22237"]}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/BulkDeletePipelinesThe response is empty, and its 200 OK status means Fleet Management deleted all the pipelines:
{}The BulkDeletePipelinesByFilter endpoint lets you delete every pipeline matching a filter without listing their IDs first.
Before you delete, use ListPipelines with the same filter to review the matching pipelines, and CountPipelines to get the number of matches.
Set expected_count to that number minus the pipelines you exclude.
In this example, three disabled pipelines match the filter, and the request keeps one of them, 22240, by listing its ID in exclude_ids:
curl -q \
-d '{"filter": {"enabled": false}, "exclude_ids": ["22240"], "expected_count": 2}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/BulkDeletePipelinesByFilterThe response shows that Fleet Management deleted the two pipelines that weren’t excluded:
{
"deletedCount": 2
}If the number of matching pipelines changes before the request runs, the request fails and deletes nothing. In this example, a fourth pipeline matches the filter when the request runs:
curl -q \
-d '{"filter": {"enabled": false}, "expected_count": 3}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/BulkDeletePipelinesByFilterThe response is HTTP 400 with a failed_precondition error code.
The revision RPCs allow for revisiting the history of changes to pipeline objects for a user.
ListPipelinesRevisions lists all changes newest first alongside the operation that initiated them.
For brevity, the response omits the configuration contents of the pipeline in each snapshot.
You can filter the revisions by pipeline name or ID, operation, author, and creation time.
Similarly, ListPipelineRevisions allows for viewing the state of a single pipeline ID at every point in time it was changed, along with a snapshot that includes the pipeline contents.
In both RPCs, the snapshot metadata is always empty.
For details, refer to the PipelineRevision section.
In this example, the request asks for the two most recent revisions created by user_login:
curl -q \
-d '{"page_size": 2, "filter": {"author": "user_login"}}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/ListPipelinesRevisionsThe response resembles the following:
{
"pipelineRevisions": [
{
"revisionId": "4",
"snapshot": {
"name": "myname",
"matchers": [
"collector.os=\"linux\"",
"team=\"team-a\""
],
"enabled": true,
"id": "1",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
},
"createdAt": "2025-02-14T09:38:55Z",
"operation": "DELETE",
"author": "user_login"
},
{
"revisionId": "3",
"snapshot": {
"name": "myname",
"matchers": [
"collector.os=\"linux\"",
"team=\"team-a\""
],
"enabled": true,
"id": "1",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
},
"createdAt": "2025-02-14T09:37:49Z",
"operation": "UPDATE",
"author": "user_login"
}
],
"nextPageToken": "eyJwcmltYXJ5IjoiMyJ9"
}In this example, the request asks for the UPDATE revisions of the pipeline with ID 1:
curl -q \
-d '{"id": "1", "filter": {"operation": "UPDATE"}}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/ListPipelineRevisionsThe response resembles the following:
{
"pipelineRevisions": [
{
"revisionId": "3",
"snapshot": {
"name": "myname",
"contents": "prometheus.exporter.self \"alloy\" { }\n\nprometheus.scrape \"alloy\" {\n\ttargets = prometheus.exporter.self.alloy.targets\n\tforward_to = [prometheus.remote_write.grafanacloud.receiver]\n\n\tscrape_interval = \"60s\"\n}\n\nprometheus.remote_write \"grafanacloud\" {\n\t// Must match the uniquely-identifiable ID set up in the remotecfg block.\n\texternal_labels = {\"collector_id\" = constants.hostname}\n\n\tendpoint {\n\t\turl = \"http://localhost:8081\"\n\n\t\tbasic_auth {\n\t\t\tusername = \"user\"\n\t\t\tpassword_file = \"/path/to/my/pass\"\n\t\t}\n\t}\n}",
"matchers": [
"collector.os=\"linux\"",
"team=\"team-a\""
],
"enabled": true,
"id": "1",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
},
"createdAt": "2025-02-14T09:37:49Z",
"operation": "UPDATE",
"author": "user_login"
}
]
}The GetPipelineRevision request returns a single revision by its ID, including the contents of the pipeline at that point in time:
curl -q \
-d '{"revision_id": "4"}' \
-u "<INSTANCE_ID>:<ACCESS_POLICY_TOKEN>" \
--header "Content-Type: application/json" \
-X POST https://fleet-management-<CLUSTER_NAME>.grafana.net/pipeline.v2.PipelineService/GetPipelineRevisionThe response resembles the following:
{
"revisionId": "4",
"snapshot": {
"name": "myname",
"contents": "prometheus.exporter.self \"alloy\" { }\n\nprometheus.scrape \"alloy\" {\n\ttargets = prometheus.exporter.self.alloy.targets\n\tforward_to = [prometheus.remote_write.grafanacloud.receiver]\n\n\tscrape_interval = \"60s\"\n}\n\nprometheus.remote_write \"grafanacloud\" {\n\t// Must match the uniquely-identifiable ID set up in the remotecfg block.\n\texternal_labels = {\"collector_id\" = constants.hostname}\n\n\tendpoint {\n\t\turl = \"http://localhost:8081\"\n\n\t\tbasic_auth {\n\t\t\tusername = \"user\"\n\t\t\tpassword_file = \"/path/to/my/pass\"\n\t\t}\n\t}\n}",
"matchers": [
"collector.os=\"linux\"",
"team=\"team-a\""
],
"enabled": true,
"id": "1",
"metadata": {},
"configType": "CONFIG_TYPE_ALLOY"
},
"createdAt": "2025-02-14T09:38:55Z",
"operation": "DELETE",
"author": "user_login"
}

