Optional. If this field set to true, the system will respond immediately even if it there are no messages available to return in thesubscriptions.pullresponse. Otherwise, the system may wait (for a bounded amount of time) until at least one message is available, rather than returning no messages. Warning: setting this field totrueis discouraged because it adversely impacts the performance ofsubscriptions.pulloperations. We recommend that users do not set this field.
maxMessages
integer
Required. The maximum number of messages to return for this request. Must be a positive integer. The Pub/Sub system may return fewer than the number specified.
Response body
Response for thesubscriptions.pullmethod.
If successful, the response body contains data with the following structure:
Optional. Received Pub/Sub messages. The list will be empty if there are no more messages available in the backlog, or if no messages could be returned before the request timeout. For JSON, the response can be entirely empty. The Pub/Sub system may return fewer than themaxMessagesrequested even if there are more messages available in the backlog.
Optional. The approximate number of times that Pub/Sub has attempted to deliver the associated message to a subscriber.
More precisely, this is 1 + (number of NACKs) + (number of ack_deadline exceeds) for this message.
A NACK is any call to subscriptions.modifyAckDeadline with a 0 deadline. An ack_deadline exceeds event is whenever a message is not acknowledged within ack_deadline. Note that ack_deadline is initially Subscription.ackDeadlineSeconds, but may get extended automatically by the client library.
Upon the first delivery of a given message,deliveryAttemptwill have a value of 1. The value is calculated at best effort and is approximate.
If a DeadLetterPolicy is not set on the subscription, this will be 0.
[[["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-22 UTC."],[],[],null,["# Method: projects.subscriptions.pull\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.PullResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [ReceivedMessage](#ReceivedMessage)\n - [JSON representation](#ReceivedMessage.SCHEMA_REPRESENTATION)\n- [Try it!](#try-it)\n\nPulls messages from the server.\n\n### HTTP request\n\nChoose a location: \nglobal \n\n\u003cbr /\u003e\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nResponse for the `subscriptions.pull` method.\n\nIf successful, the response body contains data with the following structure:\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/pubsub`\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp).\n\nReceivedMessage\n---------------\n\nA message and its corresponding acknowledgment ID."]]