Updates an existing topic by updating the fields specified in the update mask. Note that certain properties of a topic are not modifiable.
HTTP request
Path parameters
Parameters
topic.name
string
Required. Name of the topic. Format is projects/{project}/topics/{topic}.
Request body
The request body contains data with the following structure:
JSON representation
{"topic": {"name": string,"labels": {string: string,...},"messageStoragePolicy": {"allowedPersistenceRegions": [string],"enforceInTransit": boolean},"kmsKeyName": string,"schemaSettings": {"schema": string,"encoding": enum (Encoding),"firstRevisionId": string,"lastRevisionId": string},"satisfiesPzs": boolean,"messageRetentionDuration": string,"state": enum (State),"ingestionDataSourceSettings": {"platformLogsSettings": {object (PlatformLogsSettings)},// Union field source can be only one of the following:"awsKinesis": {object (AwsKinesis)},"cloudStorage": {object (CloudStorage)},"azureEventHubs": {object (AzureEventHubs)},"awsMsk": {object (AwsMsk)},"confluentCloud": {object (ConfluentCloud)}// End of list of possible types for union field source.},"messageTransforms": [{"enabled": boolean,"disabled": boolean,// Union field transform can be only one of the following:"javascriptUdf": {object (JavaScriptUDF)}// End of list of possible types for union field transform.}]},"updateMask": string}
Optional. Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect.
topic.kmsKeyName
string
Optional. The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic.
The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*.
Optional. Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. Cannot be more than 31 days or less than 10 minutes.
A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
Required. Indicates which fields in the provided topic to update. Must be specified and non-empty. Note that if updateMask contains "messageStoragePolicy" but the messageStoragePolicy is not set in the topic provided above, then the updated value is determined by the policy configured at the project or organization level.
This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo".
Response body
If successful, the response body contains an instance of Topic.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-22 UTC."],[],[],null,["# Method: projects.topics.patch\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION.topic.SCHEMA_REPRESENTATION)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION.topic.SCHEMA_REPRESENTATION_1)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION.topic.SCHEMA_REPRESENTATION_2)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION.topic.SCHEMA_REPRESENTATION_3)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nUpdates an existing topic by updating the fields specified in the update mask. Note that certain properties of a topic are not modifiable.\n\n### HTTP request\n\nChoose a location: \nglobal \n\n\u003cbr /\u003e\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nIf successful, the response body contains an instance of [Topic](/pubsub/docs/reference/rest/v1/projects.topics#Topic).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/pubsub`\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp)."]]