> ## Documentation Index
> Fetch the complete documentation index at: https://www.algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List indices

> Get a list of indices with their associated metadata.

> [!NOTE]
>
> This page documents an earlier version of the API client.
> For the latest version, see [List indices](https://www.algolia.com/doc/libraries/sdk/methods/search/list-indices.md).

**Required ACL:** `listIndexes`

This method **retrieves a list of all indices** associated with a given application ID.

The returned list includes the names of the indices as well as their associated metadata, such as the number of records, size, and last build time.

The list of indices follows any ACL restrictions of the API key used to retrieve it.
For example, if you call this method with an API key that can only access some indices, you will only retrieve records from those.

## Examples

```cs C# theme={"system"}
// Use an API key with `listIndexes` ACL
var client = new SearchClient("YourApplicationID", "YourAPIKey");
var indices = client.ListIndices().Items;

// Asynchronous
await client.ListIndicesAsync();
```

```go Go theme={"system"}
// Use an API key with `listIndexes` ACL
client := search.NewClient("YourApplicationID", "YourAPIKey")
response, err := client.ListIndices()
indices := response.Items
```

```java Java theme={"system"}
// Use an API key with `listIndexes` ACL
SearchClient client = DefaultSearchClient.create("YourApplicationID", "YourAPIKey");
List<IndicesResponse> indices = client.listIndices();

// Asynchronous
client.listIndicesAsync();
```

```js JavaScript theme={"system"}
const algoliasearch = require('algoliasearch');

// Use an API key with `listIndexes` ACL
const client = algoliasearch('YourApplicationID', 'YourAPIKey');
client.listIndices().then(({ items }) => {
  console.log(items);
});
```

```kotlin Kotlin theme={"system"}
// Use an API key with `listIndexes` ACL
val client = ClientSearch(
  ApplicationID("YourApplicationID"),
  APIKey("YourAPIKey")
)
val indices = client.listIndices().items
```

```php PHP theme={"system"}
<?php
require_once __DIR__."/vendor/autoload.php";
use Algolia\AlgoliaSearch\SearchClient;

// Use an API key with `listIndexes` ACL
$client = SearchClient::create(
  'YourApplicationID', 'YourAPIKey'
);
$indices = $client->listIndices()['items'];
```

```python Python theme={"system"}
from algoliasearch.search_client import SearchClient

# Use an API key with `listIndexes` ACL
client = SearchClient.create("YourApplicationID", "YourAPIKey")
indices = client.list_indices()["items"]
```

```ruby Ruby theme={"system"}
require 'algolia'

# Use an API key with `listIndexes` ACL
client = Algolia::Search::Client.create(
  'YourApplicationID', 'YourAPIKey'
)

indices = client.list_indexes[:items]
```

```scala Scala theme={"system"}
// Use an API key with `listIndexes` ACL
val client = new AlgoliaClient("YourApplicationID", "YourAPIKey")
val indices: Indices = Await.result(
  client.execute(list indices), Duration.Inf
)
```

```swift Swift theme={"system"}
import AlgoliaSearchClient

// Use an API key with `listIndexes` ACL
let client = SearchClient(
  appID: "YourApplicationID",
  apiKey: "YourAPIKey"
)

client.listIndices { result in
  if case .success(let response) = result {
    print("Response: \(response)")
  }
}
```

## Parameters

This method doesn't accept any input parameters.

## Response

**items** `object[]`

**createdAt** `string`

Index creation date.
An empty string means that the index doesn't have any records.

**dataSize** `integer`

Number of bytes of the index in minified format.

**entries** `integer`

The number of records  in the index.

**fileSize** `integer`

Number of bytes of the index binary file.

**lastBuildTimeS** `integer`

Last build time in seconds.

**name** `string`

Index name.

**numberOfPendingTasks** `integer` *deprecated*

The number of pending indexing operations.

**pendingTask** `boolean` *deprecated*

A boolean which is `true` if the index has pending tasks.

**primary** `string`

If the index is a replica, this field has the name of the related primary index.
This field is absent for primary indices.

**Go only:** `primary` is an empty string for primary indices.

**replicas** `string[]`

If the index is a primary index, this field has the names of all related replica indices.
This field is absent for replica indices.

**updatedAt** `string`

Date of the last update.
An empty string means that the index doesn't have any records.

**nbPages** `integer`

The value is always 1.
This method doesn't support pagination.
All indices are returned on the first call.

### Response as JSON

This section shows the JSON response returned by the API.
Each API client wraps this response in language-specific objects, so the structure may vary.
To view the response, use the `getLogs` method.
Don't rely on the order of properties—JSON objects don't preserve key order.

```jsonc JSON icon=braces theme={"system"}
{
  "items": [
    {
      "name": "movies",
      "createdAt": "2022-09-19T16:36:44.471Z",
      "updatedAt": "2022-09-19T18:02:30.996Z",
      "entries": 100,
      "dataSize": 48450,
      "fileSize": 112927,
      "lastBuildTimeS": 3,
      "numberOfPendingTasks": 0,
      "pendingTask": false
    }
  ],
  "nbPages": 1
}
```
