# REST Resource: admin.projects.locations.subscriptions

- [Resource: Subscription](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#Subscription)
  - [JSON representation](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#Subscription.SCHEMA_REPRESENTATION)
- [DeliveryConfig](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#DeliveryConfig)
  - [JSON representation](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#DeliveryConfig.SCHEMA_REPRESENTATION)
- [DeliveryRequirement](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#DeliveryRequirement)
- [ExportConfig](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#ExportConfig)
  - [JSON representation](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#ExportConfig.SCHEMA_REPRESENTATION)
- [State](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#State)
- [PubSubConfig](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#PubSubConfig)
  - [JSON representation](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#PubSubConfig.SCHEMA_REPRESENTATION)
- [Methods](https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#METHODS_SUMMARY)

## Resource: Subscription

Metadata about a subscription resource.

| JSON representation |
|---|
| ``` { "name": string, "topic": string, "deliveryConfig": { object (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#DeliveryConfig`) }, "exportConfig": { object (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#ExportConfig`) } } ``` |

| Fields ||
|---|---|
| `name` | `string` The name of the subscription. Structured like: projects/{project_number}/locations/{location}/subscriptions/{subscriptionId} |
| `topic` | `string` The name of the topic this subscription is attached to. Structured like: projects/{project_number}/locations/{location}/topics/{topicId} |
| `deliveryConfig` | ``object (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#DeliveryConfig`)`` The settings for this subscription's message delivery. |
| `exportConfig` | ``object (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#ExportConfig`)`` If present, messages are automatically written from the Pub/Sub Lite topic associated with this subscription to a destination. |

## DeliveryConfig

The settings for a subscription's message delivery.

| JSON representation |
|---|
| ``` { "deliveryRequirement": enum (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#DeliveryRequirement`) } ``` |

| Fields ||
|---|---|
| `deliveryRequirement` | ``enum (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#DeliveryRequirement`)`` The DeliveryRequirement for this subscription. |

## DeliveryRequirement

When this subscription should send messages to subscribers relative to messages persistence in storage. For details, see [Creating Lite subscriptions](https://cloud.google.com/pubsub/lite/docs/subscriptions#creating_lite_subscriptions).

| Enums ||
|---|---|
| `DELIVERY_REQUIREMENT_UNSPECIFIED` | Default value. This value is unused. |
| `DELIVER_IMMEDIATELY` | The server does not wait for a published message to be successfully written to storage before delivering it to subscribers. |
| `DELIVER_AFTER_STORED` | The server will not deliver a published message to subscribers until the message has been successfully written to storage. This will result in higher end-to-end latency, but consistent delivery. |

## ExportConfig

Configuration for a Pub/Sub Lite subscription that writes messages to a destination. User subscriber clients must not connect to this subscription.

| JSON representation |
|---|
| ``` { "desiredState": enum (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#State`), "currentState": enum (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#State`), "deadLetterTopic": string, // Union field `destination` can be only one of the following: "pubsubConfig": { object (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#PubSubConfig`) } // End of list of possible types for union field `destination`. } ``` |

| Fields ||
|---|---|
| `desiredState` | ``enum (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#State`)`` The desired state of this export. Setting this to values other than `ACTIVE` and `PAUSED` will result in an error. |
| `currentState` | ``enum (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#State`)`` Output only. The current state of the export, which may be different to the desired state due to errors. This field is output only. |
| `deadLetterTopic` | `string` Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not be exported to the destination. For example, the message can not be published to the Pub/Sub service because it does not satisfy the constraints documented at <https://cloud.google.com/pubsub/docs/publisher>. Structured like: projects/{project_number}/locations/{location}/topics/{topicId}. Must be within the same project and location as the subscription. The topic may be changed or removed. |
| Union field `destination`. The destination to export to. Required. `destination` can be only one of the following: ||
| `pubsubConfig` | ``object (`https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions#PubSubConfig`)`` Messages are automatically written from the Pub/Sub Lite topic associated with this subscription to a Pub/Sub topic. |

## State

The desired export state.

| Enums ||
|---|---|
| `STATE_UNSPECIFIED` | Default value. This value is unused. |
| `ACTIVE` | Messages are being exported. |
| `PAUSED` | Exporting messages is suspended. |
| `PERMISSION_DENIED` | Messages cannot be exported due to permission denied errors. Output only. |
| `NOT_FOUND` | Messages cannot be exported due to missing resources. Output only. |

## PubSubConfig

Configuration for exporting to a Pub/Sub topic.

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

| Fields ||
|---|---|
| `topic` | `string` The name of the Pub/Sub topic. Structured like: projects/{project_number}/topics/{topicId}. The topic may be changed. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions/create` | Creates a new subscription. |
| ### `https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions/delete` | Deletes the specified subscription. |
| ### `https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions/get` | Returns the subscription configuration. |
| ### `https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions/list` | Returns the list of subscriptions for the given project. |
| ### `https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions/patch` | Updates properties of the specified subscription. |
| ### `https://docs.cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions/seek` | Performs an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog. |