ListQueuesCommand

Returns a list of your queues in the current region. The response includes a maximum of 1,000 results. If you specify a value for the optional QueueNamePrefix parameter, only queues with a name that begins with the specified value are returned.

The listQueues methods supports pagination. Set parameter MaxResults in the request to specify the maximum number of results to be returned in the response. If you do not set MaxResults, the response includes a maximum of 1,000 results. If you set MaxResults and there are additional results to display, the response includes a value for NextToken. Use NextToken as a parameter in your next request to listQueues to receive the next page of results.

Cross-account permissions don't apply to this action. For more information, see Grant cross-account permissions to a role and a username  in the Amazon SQS Developer Guide.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { SQSClient, ListQueuesCommand } from "@aws-sdk/client-sqs"; // ES Modules import
// const { SQSClient, ListQueuesCommand } = require("@aws-sdk/client-sqs"); // CommonJS import
const client = new SQSClient(config);
const input = { // ListQueuesRequest
  QueueNamePrefix: "STRING_VALUE",
  NextToken: "STRING_VALUE",
  MaxResults: Number("int"),
};
const command = new ListQueuesCommand(input);
const response = await client.send(command);
// { // ListQueuesResult
//   QueueUrls: [ // QueueUrlList
//     "STRING_VALUE",
//   ],
//   NextToken: "STRING_VALUE",
// };

ListQueuesCommand Input

See ListQueuesCommandInput for more details

Parameter
Type
Description
MaxResults
number | undefined

Maximum number of results to include in the response. Value range is 1 to 1000. You must set MaxResults to receive a value for NextToken in the response.

NextToken
string | undefined

Pagination token to request the next set of results.

QueueNamePrefix
string | undefined

A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.

Queue URLs and names are case-sensitive.

ListQueuesCommand Output

See ListQueuesCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
NextToken
string | undefined

Pagination token to include in the next request. Token value is null if there are no additional results to request, or if you did not set MaxResults in the request.

QueueUrls
string[] | undefined

A list of queue URLs, up to 1,000 entries, or the value of MaxResults that you sent in the request.

Throws

Name
Fault
Details
InvalidAddress
client

The specified ID is invalid.

InvalidSecurity
client

The request was not made over HTTPS or did not use SigV4 for signing.

RequestThrottled
client

The request was denied due to request throttling.

  • Exceeds the permitted request rate for the queue or for the recipient of the request.

  • Ensure that the request rate is within the Amazon SQS limits for sending messages. For more information, see Amazon SQS quotas  in the Amazon SQS Developer Guide.

UnsupportedOperation
client

Error code 400. Unsupported operation.

SQSServiceException
Base exception class for all service exceptions from SQS service.