- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
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
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
MaxResults | number | undefined | Maximum number of results to include in the response. Value range is 1 to 1000. You must set |
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
Parameter | Type | Description |
---|
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 |
QueueUrls | string[] | undefined | A list of queue URLs, up to 1,000 entries, or the value of |
Throws
Name | Fault | Details |
---|
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.
|
UnsupportedOperation | client | Error code 400. Unsupported operation. |
SQSServiceException | Base exception class for all service exceptions from SQS service. |