Amazon Simple Queue Service
API Reference (API Version 2012-11-05)


Changes the visibility timeout of a specified message in a queue to a new value. The maximum allowed timeout value is 12 hours. Thus, you can't extend the timeout of a message in an existing queue to more than a total visibility timeout of 12 hours. For more information, see Visibility Timeout in the Amazon SQS Developer Guide.

For example, you have a message with a visibility timeout of 5 minutes. After 3 minutes, you call ChangeMessageVisiblity with a timeout of 10 minutes. At that time, the timeout for the message is extended by 10 minutes beyond the time of the ChangeMessageVisibility action. This results in a total visibility timeout of 13 minutes. You can continue to call the ChangeMessageVisibility to extend the visibility timeout to a maximum of 12 hours. If you try to extend the visibility timeout beyond 12 hours, your request is rejected.

A message is considered to be in flight after it's received from a queue by a consumer, but not yet deleted from the queue.

For standard queues, there can be a maximum of 120,000 inflight messages per queue. If you reach this limit, Amazon SQS returns the OverLimit error message. To avoid reaching the limit, you should delete messages from the queue after they're processed. You can also increase the number of queues you use to process your messages.

For FIFO queues, there can be a maximum of 20,000 inflight messages per queue. If you reach this limit, Amazon SQS returns no error messages.


If you attempt to set the VisibilityTimeout to a value greater than the maximum time left, Amazon SQS returns an error. Amazon SQS doesn't automatically recalculate and increase the timeout to the maximum remaining time.

Unlike with a queue, when you change the visibility timeout for a specific message the timeout value is applied immediately but isn't saved in memory for that message. If you don't delete a message after it is received, the visibility timeout for the message reverts to the original timeout value (not to the value you set using the ChangeMessageVisibility action) the next time the message is received.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.


The URL of the Amazon SQS queue whose message's visibility is changed.

Queue URLs are case-sensitive.

Type: String

Required: Yes


The receipt handle associated with the message whose visibility timeout is changed. This parameter is returned by the ReceiveMessage action.

Type: String

Required: Yes


The new value for the message's visibility timeout (in seconds). Values values: 0 to 43200. Maximum: 12 hours.

Type: Integer

Required: Yes


For information about the errors that are common to all actions, see Common Errors.


The message referred to isn't in flight.

HTTP Status Code: 400


The receipt handle provided isn't valid.

HTTP Status Code: 400


The following example query request changes the visibility timeout for a message to 60 seconds. How you structure the AUTHPARAMS depends on how you are signing your API request. For information about AUTHPARAMS in Signature Version 4, see Examples of Signed Signature Version 4 Requests in the Amazon Web Services General Reference.

Sample Request

Copy ?Action=ChangeMessageVisibility &VisibilityTimeout=60 &ReceiptHandle=MbZj6wDWli%2BJvwwJaBV%2B3dcjk2YW2vA3%2BSTFFljT M8tJJg6HRG6PYSasuWXPJB%2BCwLj1FjgXUv1uSj1gUPAWV66FU/WeR4mq2OKpEGY WbnLmpRCJVAyeMjeU5ZBdtcQ%2BQEauMZc8ZRv37sIW2iJKq3M9MFx1YvV11A2x/K SbkJ0= &Version=2012-11-05 &Expires=2012-04-18T22%3A52%3A43PST &AUTHPARAMS

Sample Response

<ChangeMessageVisibilityResponse> <ResponseMetadata> <RequestId> 6a7a282a-d013-4a59-aba9-335b0fa48bed </RequestId> </ResponseMetadata> </ChangeMessageVisibilityResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: