# gcp_pubsub

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

---
title: gcp_pubsub
latest-operator-version: v26.2.5
latest-console-tag: v3.14.0
latest-connect-version: 4.117.0
latest-redpanda-tag: v26.2.6
docname: connect/components/inputs/gcp_pubsub
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: connect/components/inputs/gcp_pubsub.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/develop/pages/connect/components/inputs/gcp_pubsub.adoc
description: Consumes messages from a GCP Cloud Pub/Sub subscription.
page-git-created-date: "2024-09-09"
page-git-modified-date: "2026-10-30"
page-generated-sources:
  - include: connect:components:partial$descriptions/inputs/gcp_pubsub.adoc
    generator: null
    version: null
    source: the component specs in https://github.com/redpanda-data/connect
page-generated-content: partial
---

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

Consumes messages from a GCP Cloud Pub/Sub subscription.

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 Pub/Sub has attempted to deliver a message.

-   `gcp_pubsub_message_id` - The unique identifier of the message.

-   `gcp_pubsub_ordering_key` - The ordering key of the message.

-   All message attributes


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

### Common

```yml
input:
  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
input:
  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: ""
```

## [](#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`

The Google Service Account credentials in JSON format (optional). Provide the contents of the credentials file as plain JSON, not Base64-encoded. Use this field to authenticate with Google Cloud services. If this field is empty, the component uses [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials). 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 [Manage Secrets](https://docs.redpanda.com/cloud-data-platform/develop/connect/configuration/secret-management/) before adding it to your configuration.

**Type**: `string`

**Default**: `""`

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

An optional endpoint that overrides the default of `pubsub.googleapis.com:443`. Use this field to connect to a region-specific Pub/Sub endpoint. For a list of valid values, see [Pub/Sub regional endpoints](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`