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

Creates a TopicSubscription. Subscribes an app installation instance (by registration_id, either FID or FCM Token) to a topicSubscription. Returns a TopicSubscription if it is created successfully. If the subscription already exists, returns error of ALREADY_EXISTS.

### HTTP request

`POST https://fcm.googleapis.com/v1/{parent=projects/*/registrations/*}/topicSubscriptions`

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The parent resource where this subscription will be created. Format: projects/{project}/registrations/{registration} The {registration} part can be an FID or an FCM Token. |

### Query parameters

| Parameters ||
|---|---|
| `topicName` | `string` Required. The ID to use for the subscription, which is the topic name. This will become the last segment of the TopicSubscription's resource name. Topic names match the pattern of "\[a-zA-Z0-9-_.\~%\]{1,900}". |

### 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 a newly created 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 `parent` resource:

- `cloudmessaging.topicSubscriptions.create`

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