Stay organized with collections
Save and categorize content based on your preferences.
Creates a snapshot from the requested subscription. Snapshots are used
in Seek
operations, which allow you to manage message acknowledgments in bulk.
That is, you can set the acknowledgment state of messages in an existing
subscription to the state captured by a snapshot. If the snapshot
already exists, returns ALREADY_EXISTS. If the requested subscription
doesn't exist, returns NOT_FOUND. If the backlog in the subscription
is too old -- and the resulting snapshot would expire in less than 1
hour -- then FAILED_PRECONDITION is returned. See also the
Snapshot.expire_time field. If the name is not provided in the
request, the server will assign a random name for this snapshot on the
same project as the subscription, conforming to the resource name
format. The
generated name is populated in the returned Snapshot object. Note that
for REST API requests, you must specify a name in the request.
Arguments
Parameters
name
string
Required. User-provided name for this snapshot. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription. Note that for REST API requests, you must specify a name. See the resource name rules. Format is projects/{project}/snapshots/{snap}.
[[["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-29 UTC."],[],[],null,["# Method: googleapis.pubsub.v1.projects.snapshots.create\n\nCreates a snapshot from the requested subscription. Snapshots are used\nin [Seek](https://cloud.google.com/pubsub/docs/replay-overview)\noperations, which allow you to manage message acknowledgments in bulk.\nThat is, you can set the acknowledgment state of messages in an existing\nsubscription to the state captured by a snapshot. If the snapshot\nalready exists, returns `ALREADY_EXISTS`. If the requested subscription\ndoesn't exist, returns `NOT_FOUND`. If the backlog in the subscription\nis too old -- and the resulting snapshot would expire in less than 1\nhour -- then `FAILED_PRECONDITION` is returned. See also the\n`Snapshot.expire_time` field. If the name is not provided in the\nrequest, the server will assign a random name for this snapshot on the\nsame project as the subscription, conforming to the [resource name\nformat](https://cloud.google.com/pubsub/docs/admin#resource_names). The\ngenerated name is populated in the returned Snapshot object. Note that\nfor REST API requests, you must specify a name in the request.\n\nArguments\n---------\n\nRaised exceptions\n-----------------\n\nResponse\n--------\n\nIf successful, the response contains an instance of [`Snapshot`](/workflows/docs/reference/googleapis/pubsub/v1/Overview#Snapshot).\n\nSubworkflow snippet\n-------------------\n\nSome fields might be optional or required.\nTo identify required fields, refer to the [API documentation](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.snapshots/create). \n\n### YAML\n\n```yaml\n- create:\n call: googleapis.pubsub.v1.projects.snapshots.create\n args:\n name: ...\n body:\n labels: ...\n subscription: ...\n result: createResult\n```\n\n### JSON\n\n```json\n[\n {\n \"create\": {\n \"call\": \"googleapis.pubsub.v1.projects.snapshots.create\",\n \"args\": {\n \"name\": \"...\",\n \"body\": {\n \"labels\": \"...\",\n \"subscription\": \"...\"\n }\n },\n \"result\": \"createResult\"\n }\n }\n]\n```"]]