Google Cloud Pub/Sub
List subscriptions attached to a Pub/Sub topic
Call the Pub/Sub REST method when a service needs a machine-readable list. Use gcloud for an operator’s filtered list from the terminal.
Documentation reviewed · 2 methods with sources
Ways to do it
API
GET /v1/{topic}/subscriptions
List subscription names attached to a topic and follow nextPageToken for more results.
Read source: Pub/Sub topics subscriptions.list reference- Requirements
- The full topic resource name and OAuth credentials with pubsub.topics.get permission on the topic and a pubsub or cloud-platform scope.
- Limitations
- The response contains subscription names. To read settings such as retention or delivery, look up each subscription by name.
Example shell
curl --fail -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" "https://pubsub.googleapis.com/v1/projects/$PROJECT/topics/$TOPIC/subscriptions?pageSize=100"CLI
gcloud pubsub topics list-subscriptions
List all subscriptions attached to a topic and optionally filter or limit the result.
Read source: gcloud Pub/Sub list-subscriptions reference- Requirements
- An authenticated gcloud CLI, pubsub.topics.get permission on the topic, and a full topic name or a configured project.
- Limitations
- This listing is scoped to one topic. Use --limit to cap the total results or --page-size to adjust the number requested per page.
Example shell
gcloud pubsub topics list-subscriptions "projects/$PROJECT/topics/$TOPIC" --format=json