- [HTTP request](https://firebase.google.com/docs/reference/fcm/fcmtopics/rest/v1/projects.registrations.topicSubscriptions/patch#body.HTTP_TEMPLATE)
- [Path parameters](https://firebase.google.com/docs/reference/fcm/fcmtopics/rest/v1/projects.registrations.topicSubscriptions/patch#body.PATH_PARAMETERS)
- [Query parameters](https://firebase.google.com/docs/reference/fcm/fcmtopics/rest/v1/projects.registrations.topicSubscriptions/patch#body.QUERY_PARAMETERS)
- [Request body](https://firebase.google.com/docs/reference/fcm/fcmtopics/rest/v1/projects.registrations.topicSubscriptions/patch#body.request_body)
- [Response body](https://firebase.google.com/docs/reference/fcm/fcmtopics/rest/v1/projects.registrations.topicSubscriptions/patch#body.response_body)
- [Authorization scopes](https://firebase.google.com/docs/reference/fcm/fcmtopics/rest/v1/projects.registrations.topicSubscriptions/patch#body.aspect)
- [IAM Permissions](https://firebase.google.com/docs/reference/fcm/fcmtopics/rest/v1/projects.registrations.topicSubscriptions/patch#body.aspect_1)
- [Try it!](https://firebase.google.com/docs/reference/fcm/fcmtopics/rest/v1/projects.registrations.topicSubscriptions/patch#try-it)

Updates a TopicSubscription. Subscribes an app installation instance by registration_id, either FID or FCM Token, to a topicSubscription. Returns an existing TopicSubscription or creates a new one if it does not exist.

### HTTP request

`PATCH https://fcm.googleapis.com/v1/{topicSubscription.name=projects/*/registrations/*/topicSubscriptions/*}`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `topicSubscription.name` | `string` Identifier. The resource name of the subscription. Format: projects/{project}/registrations/{registration}/topicSubscriptions/{topicSubscription} The {registration} part contains the registration ID (e.g., FID). |

### Query parameters

| Parameters ||
|---|---|
| `allowMissing` | `boolean` Optional. If set to true, and the topic subscription is not found, a new topic subscription will be created. |

### Request body

The request body contains an instance of `https://firebase.google.com/docs/reference/fcm/fcmtopics/rest/v1/projects.registrations.topicSubscriptions#TopicSubscription`.

### Response body

If successful, the response body contains an instance of `https://firebase.google.com/docs/reference/fcm/fcmtopics/rest/v1/projects.registrations.topicSubscriptions#TopicSubscription`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/firebase.messaging`
- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `name` resource:

- `cloudmessaging.topicSubscriptions.update`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).