# gcp_pubsub

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [connect-full.txt](https://docs.redpanda.com/connect-full.txt)

---
title: gcp_pubsub
latest-connect-version: 4.93.0
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-redpanda-tag: v26.1.9
docname: inputs/gcp_pubsub
page-component-name: connect
page-version: master
page-component-version: master
page-component-title: Connect
page-relative-src-path: inputs/gcp_pubsub.adoc
page-edit-url: https://github.com/redpanda-data/rp-connect-docs/edit/main/modules/components/pages/inputs/gcp_pubsub.adoc
page-git-created-date: "2024-05-24"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/connect/components/inputs/gcp_pubsub.md -->

**Type:** Input ▼

[Input](https://docs.redpanda.com/connect/components/inputs/gcp_pubsub/)[Output](https://docs.redpanda.com/connect/components/outputs/gcp_pubsub/)

**Available in:** [Cloud](https://docs.redpanda.com/cloud-data-platform/develop/connect/components/inputs/gcp_pubsub/%20%22View%20the%20Cloud%20version%20of%20this%20component%22), Self-Managed

Consumes messages from a GCP Cloud Pub/Sub subscription.

#### Common

```yml
inputs:
  label: ""
  gcp_pubsub:
    project: "" # No default (required)
    credentials_json: ""
    subscription: "" # No default (required)
    endpoint: ""
    sync: false
    max_outstanding_messages: 1000
    max_outstanding_bytes: 1000000000
```

#### Advanced

```yml
inputs:
  label: ""
  gcp_pubsub:
    project: "" # No default (required)
    credentials_json: ""
    subscription: "" # No default (required)
    endpoint: ""
    sync: false
    max_outstanding_messages: 1000
    max_outstanding_bytes: 1000000000
    create_subscription:
      enabled: false
      topic: ""
```

For information on how to set up credentials see [this guide](https://cloud.google.com/docs/authentication/production).

## [](#metadata)Metadata

This input adds the following metadata fields to each message:

-   gcp\_pubsub\_publish\_time\_unix - The time at which the message was published to the topic.

-   gcp\_pubsub\_delivery\_attempt - When dead lettering is enabled, this is set to the number of times PubSub has attempted to deliver a message.

-   All message attributes


You can access these metadata fields using [function interpolation](https://docs.redpanda.com/connect/configuration/interpolation/#bloblang-queries).

## [](#fields)Fields

### [](#create_subscription)`create_subscription`

Allows you to configure the input subscription and creates if it doesn’t exist.

**Type**: `object`

### [](#create_subscription-enabled)`create_subscription.enabled`

Whether to configure subscription or not.

**Type**: `bool`

**Default**: `false`

### [](#create_subscription-topic)`create_subscription.topic`

Defines the topic that the subscription should be vinculated to.

**Type**: `string`

**Default**: `""`

### [](#credentials_json)`credentials_json`

Base64-encoded Google Service Account credentials in JSON format (optional). Use this field to authenticate with Google Cloud services. For more information about creating service account credentials, see [Google’s service account documentation](https://developers.google.com/workspace/guides/create-credentials#create_credentials_for_a_service_account).

> ⚠️ **CAUTION**
>
> This field contains sensitive information that usually shouldn’t be added to a configuration directly. For more information, see [Secrets](https://docs.redpanda.com/connect/configuration/secrets/).

**Type**: `string`

**Default**: `""`

### [](#endpoint)`endpoint`

An optional endpoint to override the default of `pubsub.googleapis.com:443`. This can be used to connect to a region specific pubsub endpoint. For a list of valid values, see [this document](https://cloud.google.com/pubsub/docs/reference/service_apis_overview#list_of_regional_endpoints).

**Type**: `string`

**Default**: `""`

```yaml
# Examples:
endpoint: us-central1-pubsub.googleapis.com:443

# ---

endpoint: us-west3-pubsub.googleapis.com:443
```

### [](#max_outstanding_bytes)`max_outstanding_bytes`

The maximum number of outstanding pending messages to be consumed measured in bytes.

**Type**: `int`

**Default**: `1000000000`

### [](#max_outstanding_messages)`max_outstanding_messages`

The maximum number of outstanding pending messages to be consumed at a given time.

**Type**: `int`

**Default**: `1000`

### [](#project)`project`

The project ID of the target subscription.

**Type**: `string`

### [](#subscription)`subscription`

The target subscription ID.

**Type**: `string`

### [](#sync)`sync`

Enable synchronous pull mode.

**Type**: `bool`

**Default**: `false`