canonical: https://jentic.com/apis/googleapis.com/cloud-pubsub

# Google Cloud Pub/Sub API

Google Cloud Pub/Sub is a globally distributed, fully managed messaging service for asynchronous service-to-service communication, event ingestion, and streaming analytics pipelines. The REST API exposes topics, subscriptions, snapshots, schemas, and IAM controls so producers can publish messages, subscribers can pull or acknowledge them, and operators can manage retention, ordering, and dead-letter behavior. Pub/Sub backs many Google Cloud event flows, including Cloud Storage notifications, Dataflow pipelines, and Cloud Run event triggers.

## For AI agents

Publish messages, manage topics and subscriptions, and pull or acknowledge messages on Google Cloud Pub/Sub for event-driven and streaming workloads.

## Scope

Does not handle long-running task scheduling, durable workflow orchestration, or stream processing transformations - use for asynchronous topic and subscription messaging only.

## Capabilities

- Create topics and configure message retention, schema, and ordering settings
- Create push or pull subscriptions on a topic with custom ack deadlines and dead-letter policies
- Publish batches of messages to a topic with attribute-based filtering metadata
- Pull messages from a subscription and acknowledge them after processing
- Manage Pub/Sub schemas and validate messages against Avro or Protocol Buffer definitions
- Create snapshots of subscription state and seek subscriptions to a prior point in time

## Use cases

### Event-Driven Microservices

Decouple producers and consumers across services using Pub/Sub as the asynchronous transport. Producers publish events to topics; consumers attach pull or push subscriptions, process messages, and acknowledge them. Pub/Sub handles delivery, retry, ordering, and dead-letter routing automatically across regions.

Example prompt: Create topic order-events with 7-day retention, create push subscription order-events-fulfillment to https://fulfillment.example.com/events, and publish a JSON message with attribute event_type=order.created.

### Streaming Analytics Ingestion

Ingest high-volume application or device telemetry into Pub/Sub topics so downstream Dataflow or BigQuery pipelines can consume them in near real time. Schema validation can be enforced at the topic level so malformed events are rejected before they enter the pipeline.

Example prompt: Create a Pub/Sub schema in Avro, attach it to topic telemetry, then publish a batch of validated telemetry events from edge devices.

### Disaster Recovery and Replay

Use Pub/Sub snapshots and seek-to-time to replay a subscription after a downstream consumer fails or after a bad deploy. Snapshots capture the unacked-message state, and seek operations rewind a subscription to a snapshot or wall-clock timestamp without affecting other subscriptions on the same topic.

Example prompt: Create a snapshot of subscription orders-fulfillment-sub, deploy the fix, then call seek with the snapshot name to redeliver messages from before the bad deploy.

### Agent-Driven Event Publishing

An AI agent integrating with Google Cloud uses Jentic to publish events to Pub/Sub topics in response to user requests or upstream signals, so other workloads (workflows, analytics jobs, alerting) can react asynchronously without point-to-point integration.

Example prompt: Search Jentic for publish a message to a pubsub topic, load the schema for projects.topics.publish, and execute it with the topic and a base64-encoded message body.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /v1/{+project}/topics | List topics in a project |
| GET | /v1/{+project}/subscriptions | List subscriptions in a project |
| GET | /v1/{+project}/snapshots | List snapshots in a project |
| POST | /v1/{+name}:commit | Commit a schema revision |
| POST | /v1/{+name}:rollback | Rollback a schema to a prior revision |
| POST | /v1/{+parent}/schemas:validate | Validate a schema definition |
| POST | /v1/{+parent}/schemas:validateMessage | Validate a message against a schema |

## Key resources

- **topics** — Named channels that producers publish messages to
- **subscriptions** — Pull or push consumers attached to a topic with their own delivery settings
- **snapshots** — Point-in-time captures of a subscription's unacked-message state for replay
- **schemas** — Avro or Protocol Buffer schemas attached to topics for message validation
- **subscriptions revisions** — Schema revisions and rollback operations for evolving message contracts

## Why Jentic

- **Setup:** Wiring the Cloud Pub/Sub API by hand means configuring Google OAuth 2.0 with the cloud-platform or pubsub scope, refreshing access tokens, and tracking topic, subscription, and snapshot resource names across every call to pubsub.googleapis.com. Through Jentic you install once, import the Cloud Pub/Sub API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** This API puts the topic and subscription in the URL path (/v1/{+name} and /v1/{+project}/topics), so a rule can pin your agent to one topic or subscription: it can publish or pull there and nothing else. You choose the operations it may call, so state-changing ones like committing or rolling back a schema are not included unless you add them.
- **Credential handling:** Your Google OAuth credential is stored once, encrypted, by your own Jentic One instance and a scoped access token is injected at execution time. The credential never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'publish a message' or 'pull messages from a subscription', and Jentic returns the matching Pub/Sub operation with its input schema so the agent calls the right endpoint without reading Google's discovery doc.

## Related APIs

- **Pub/Sub Lite API** — Lower-cost zonal messaging for partitioned, high-throughput workloads
- **Cloud Tasks API** — Distributed task queue for guaranteed task execution rather than fan-out messaging
- **Cloud Dataflow API** — Stream processing engine that consumes Pub/Sub topics into BigQuery and other sinks
- **Cloud Scheduler API** — Cron-style scheduler that can publish Pub/Sub messages on a schedule

## FAQ

### What authentication does the Cloud Pub/Sub API use?

The API uses Google OAuth 2.0 with the cloud-platform or pubsub scopes, sent as a Bearer token in the Authorization header. Through Jentic the OAuth credentials are stored in the vault and short-lived access tokens are minted per call so the refresh token never enters the agent.

### Can I publish messages with attributes for filtering?

Yes, every message body can include a map of string attributes. Subscriptions can declare a filter expression that matches on those attributes, so the same topic can fan out to multiple consumers each receiving only the events relevant to them.

### What are the rate limits for the Cloud Pub/Sub API?

Pub/Sub publisher and subscriber quotas are large by default and are documented on Google Cloud's Pub/Sub quotas page in MB/s and ops/s. For very high-throughput workloads consider using the gRPC client libraries instead of REST and request quota increases up front.

### How do I publish a message through Jentic?

Search Jentic for publish a message to a pubsub topic, load the schema for the projects.topics.publish operation which maps to POST /v1/{+topic}:publish, then execute it with messages encoded as base64 in the request body.

### Is the Cloud Pub/Sub API free?

Pub/Sub has a free tier of 10 GB of message data per month; beyond that, throughput is billed per GB ingested, delivered, and stored. Snapshots and seek operations also incur storage charges. Pricing is identical whether the API is called directly or through Jentic.

### How do I replay messages after a bad deploy?

Take a snapshot of the subscription before the deploy with POST /v1/{+name}:createSnapshot semantics on snapshots, then call POST /v1/{+subscription}:seek with the snapshot name after the fix is deployed to redeliver messages that were acked during the broken window.

### Can I limit what my agent is allowed to do with the Cloud Pub/Sub API?

Yes. Jentic One is self-hosted by you, so your own rules decide which Pub/Sub operations and credentials the agent may use. Because this API puts the topic and subscription in the URL path (for example /v1/{+project}/topics and /v1/{+name}), you can pin the agent to a single topic or subscription and let it only publish or pull messages there. You also choose which operations it can call, so state-changing ones like committing or rolling back a schema stay excluded unless you explicitly add them.
