# Method: topicStats.projects.locations.topics.computeHeadCursor

- [HTTP request](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/topicStats.projects.locations.topics/computeHeadCursor#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/topicStats.projects.locations.topics/computeHeadCursor#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/topicStats.projects.locations.topics/computeHeadCursor#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/topicStats.projects.locations.topics/computeHeadCursor#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/topicStats.projects.locations.topics/computeHeadCursor#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/topicStats.projects.locations.topics/computeHeadCursor#body.ComputeHeadCursorResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/topicStats.projects.locations.topics/computeHeadCursor#body.aspect)

Compute the head cursor for the partition. The head cursor's offset is guaranteed to be less than or equal to all messages which have not yet been acknowledged as published, and greater than the offset of any message whose publish has already been acknowledged. It is zero if there have never been messages in the partition.

### HTTP request

`POST https://{endpoint}/v1/topicStats/{topic=projects/*/locations/*/topics/*}:computeHeadCursor`

Where `{endpoint}` is one of the [supported service endpoints](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest#rest_endpoints).

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

### Path parameters

| Parameters ||
|---|---|
| `topic` | `string` Required. The topic for which we should compute the head cursor. Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `topic`: - `pubsublite.topics.computeHeadCursor` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "partition": string } ``` |

| Fields ||
|---|---|
| `partition` | `string (https://developers.google.com/discovery/v1/type-format format)` Required. The partition for which we should compute the head cursor. |

### Response body

If successful, the response body contains data with the following structure:
Response containing the head cursor for the requested topic and partition.

| JSON representation |
|---|
| ``` { "headCursor": { object (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/Cursor`) } } ``` |

| Fields ||
|---|---|
| `headCursor` | ``object (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/Cursor`)`` The head cursor. |

### Authorization scopes

Requires the following OAuth scope:

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

For more information, see the [Authentication Overview](https://cloud.google.com/docs/authentication/).