

# ListSpaces
<a name="API_ListSpaces"></a>

Lists the spaces in your account in the current Region.

## Request Syntax
<a name="API_ListSpaces_RequestSyntax"></a>

```
{
   "maxResults": {{number}},
   "nextToken": "{{string}}"
}
```

## Request Parameters
<a name="API_ListSpaces_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [maxResults](#API_ListSpaces_RequestSyntax) **   <a name="opensearchmemory-ListSpaces-request-maxResults"></a>
The maximum number of spaces to return, from 1 to 100. The default is 100.  
Type: Integer  
Valid Range: Minimum value of 1. Maximum value of 100.  
Required: No

 ** [nextToken](#API_ListSpaces_RequestSyntax) **   <a name="opensearchmemory-ListSpaces-request-nextToken"></a>
The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 4096.  
Required: No

## Response Syntax
<a name="API_ListSpaces_ResponseSyntax"></a>

```
{
   "nextToken": "string",
   "spaces": [ 
      { 
         "arn": "string",
         "createdAt": number,
         "name": "string",
         "spaceId": "string",
         "status": "string"
      }
   ]
}
```

## Response Elements
<a name="API_ListSpaces_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [nextToken](#API_ListSpaces_ResponseSyntax) **   <a name="opensearchmemory-ListSpaces-response-nextToken"></a>
The token for the next set of results. Absent when there are no more results.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 4096.

 ** [spaces](#API_ListSpaces_ResponseSyntax) **   <a name="opensearchmemory-ListSpaces-response-spaces"></a>
The spaces.  
Type: Array of [SpaceSummary](API_SpaceSummary.md) objects

## Errors
<a name="API_ListSpaces_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
You don't have sufficient access to perform this operation. To use this operation, you must have AWS Identity and Access Management (IAM) permissions for the operation, and on the resource it acts on. If the space uses a customer managed AWS Key Management Service (AWS KMS) key, you must also have permission to use the key.    
 ** message **   
A message that describes which access the request is missing.
HTTP Status Code: 403

 ** InternalServerException **   
The service couldn't process the request because of an internal error. Retry the request.    
 ** message **   
A message that describes the internal error.
HTTP Status Code: 500

 ** ThrottlingException **   
The service throttled the request. Retry the request with exponential backoff.    
 ** message **   
A message that describes the throttling.  
 ** retryAfterSeconds **   
The number of seconds to wait before you retry the request.
HTTP Status Code: 429

 ** ValidationException **   
The request isn't valid. The `reason`, `message`, and `fieldList` members describe the problem. Fix the request, and then try again.    
 ** fieldList **   
The fields that failed validation, if any.  
 ** message **   
A message that describes why the request failed validation, such as the field, key, or limit involved.  
 ** reason **   
The reason that the request failed validation.
HTTP Status Code: 400

## See Also
<a name="API_ListSpaces_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/opensearchmemory-2026-08-24/ListSpaces) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/opensearchmemory-2026-08-24/ListSpaces) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/opensearchmemory-2026-08-24/ListSpaces) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/opensearchmemory-2026-08-24/ListSpaces) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/opensearchmemory-2026-08-24/ListSpaces) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/opensearchmemory-2026-08-24/ListSpaces) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/opensearchmemory-2026-08-24/ListSpaces) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/opensearchmemory-2026-08-24/ListSpaces) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/opensearchmemory-2026-08-24/ListSpaces) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/opensearchmemory-2026-08-24/ListSpaces) 