Service APIs Overview

Pub/Sub has both traditional REST/HTTP and gRPC interfaces. If you don't want to use our client libraries to access the Pub/Sub API, you have the option of writing your own client libraries that use its REST/HTTP or gRPC API surface. We recommend this approach only if your programming language or other needs are not met by the provided client libraries.

gRPC API

You can generate your own gRPC client libraries in any gRPC-supported language for the Pub/Sub API from its .proto service definition using these resources:

REST/HTTP API

There are a number of options for interacting with a service's REST interface. To create your own clients, use the following resources:

Service Endpoints

Pub/Sub has global and regional service endpoints. The global REST/HTTP endpoint is https://pubsub.googleapis.com and the global gRPC endpoint is pubsub.googleapis.com. If you send a request to a global endpoint, Pub/Sub automatically routes the request to a nearby region.

If you have additional quota in particular regions, you can route requests to these regions using regional Pub/Sub endpoints. When you publish messages to a global endpoint, the Pub/Sub service might route traffic to a region that does not have sufficient quota.

To send requests directly to a region, use the following regional Pub/Sub endpoints:

Region REST/HTTP endpoint gRPC Service
us-east1 https://us-east1-pubsub.googleapis.com us-east1-pubsub.googleapis.com
us-east4 https://us-east4-pubsub.googleapis.com us-east4-pubsub.googleapis.com
us-central1 https://us-central1-pubsub.googleapis.com us-central1-pubsub.googleapis.com
us-central2 https://us-central2-pubsub.googleapis.com us-central2-pubsub.googleapis.com
us-west1 https://us-west1-pubsub.googleapis.com us-west1-pubsub.googleapis.com
us-west2 https://us-west2-pubsub.googleapis.com us-west2-pubsub.googleapis.com
us-west3 https://us-west3-pubsub.googleapis.com us-west3-pubsub.googleapis.com
southamerica-east1 https://southamerica-east1-pubsub.googleapis.com southamerica-east1-pubsub.googleapis.com
northamerica-northeast1 https://northamerica-northeast1-pubsub.googleapis.com northamerica-northeast1-pubsub.googleapis.com
europe-west6 https://europe-west6-pubsub.googleapis.com europe-west6-pubsub.googleapis.com
europe-west4 https://europe-west4-pubsub.googleapis.com europe-west4-pubsub.googleapis.com
europe-west3 https://europe-west3-pubsub.googleapis.com europe-west3-pubsub.googleapis.com
europe-west2 https://europe-west2-pubsub.googleapis.com europe-west2-pubsub.googleapis.com
europe-west1 https://europe-west1-pubsub.googleapis.com europe-west1-pubsub.googleapis.com
europe-north1 https://europe-north1-pubsub.googleapis.com europe-north1-pubsub.googleapis.com
australia-southeast1 https://australia-southeast1-pubsub.googleapis.com australia-southeast1-pubsub.googleapis.com
asia-southeast1 https://asia-southeast1-pubsub.googleapis.com asia-southeast1-pubsub.googleapis.com
asia-south1 https://asia-south1-pubsub.googleapis.com asia-south1-pubsub.googleapis.com
asia-northeast3 https://asia-northeast3-pubsub.googleapis.com asia-northeast3-pubsub.googleapis.com
asia-northeast2 https://asia-northeast2-pubsub.googleapis.com asia-northeast2-pubsub.googleapis.com
asia-northeast1 https://asia-northeast1-pubsub.googleapis.com asia-northeast1-pubsub.googleapis.com
asia-east2 https://asia-east2-pubsub.googleapis.com asia-east2-pubsub.googleapis.com
asia-east1 https://asia-east1-pubsub.googleapis.com asia-east1-pubsub.googleapis.com