Skip to main content
This page documents an earlier version of the API client. For the latest version, see Check if index exists.
Required ACL: settings You can initialize an index with any name. The index is created on Algolia’s servers when you add objects or set settings. To prevent accidentally creating new indices, or changing existing indices, you can use the exists method. The exists method returns a boolean that indicates whether an initialized index has been created.
Be careful when using this method to execute code conditionally. Because index operations are asynchronous, an index might not yet exist when you call the exist method, but it might exist when the conditional code runs. Be mindful of the surrounding code, and of any process that might change your indices.

Examples

Check if an index exists

// Use an API key with `settings` ACL
var client = new SearchClient("YourApplicationID", "YourAPIKey");
var index = client.InitIndex("indexName");

index.Exists();

// Asynchronous
await index.ExistsAsync();

Parameters

This method doesn’t accept any input parameters.

Response

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. This method returns true if the index exists, and false otherwise.
I