Skip to main content
Required ACL: addObject You can copy the entire index (records, settings, synonyms, and rules) or one or more of the following scopes:
  • Settings
  • Synonyms
  • Rules
This method doesn’t copy the enableReRanking and mode settings.

Rate limiting

Copying an index is rate-limited:
  • If you have more than 100 pending requests, your requests are throttled.
  • If you have more than 5,000 pending requests, further requests are ignored.

Source indices

Copying a source index that doesn’t exist creates a new index with 0 records. If the source index has replicas, the replicas won’t be copied.

Destination indices

When copying indices within the same Algolia application, the destination index is replaced if it exists. You can’t copy an index between two Algolia applications, if the destination index exists. Everything apart from the analytics data is replaced. You can’t copy to a destination index that already has replicas.

Analytics

Copying an index has no impact on Analytics. You can’t copy an index’s analytics data.

Scopes

To copy parts of your source index, use the scope parameter. If you omit the scope parameter, everything is copied. For example, to copy an index’s settings and synonyms, but not records and rules, set the scope parameter to: ["settings", "synonyms"].
  • The scope is replaced completely. Different items belonging to the same scope aren’t merged. For example, with scope: "settings", all settings of the destination index are replaced with the settings of the source index.
  • Items in different scopes are preserved.
  • If you set the scope parameter, records aren’t copied.

Examples

Copy an index

// Use an API key with `addObject` ACL
var client = new SearchClient("YourApplicationID", "YourAPIKey");

// Copy `indexNameSrc` to `indexNameDest`
client.CopyIndex("indexNameSrc", "indexNameDest");

// Asynchronous
await client.CopyIndexAsync("indexNameSrc", "indexNameDest");
// Use an API key with `addObject` ACL
client := search.NewClient("YourApplicationID", "YourAPIKey")

// Copy `indexNameSrc` to `indexNameDest`
res, err := client.CopyIndex("indexNameSrc", "indexNameDest")
// Use an API key with `addObject` ACL
SearchClient client = DefaultSearchClient.create("YourApplicationID", "YourAPIKey");

// Copy `indexNameSrc` to `indexNameDest`
client.copyIndex("indexNameSrc", "indexNameDest");

// Asynchronous
client.copyIndexAsync("indexNameSrc", "indexNameDest");
const algoliasearch = require('algoliasearch');

// Use an API key with `addObject` ACL
const client = algoliasearch('YourApplicationID', 'YourAPIKey');

// Copy `indexNameSrc` to `indexNameDest`
client.copyIndex('indexNameSrc', 'indexNameDest');
// Use an API key with `addObject` ACL
val client = ClientSearch(
  ApplicationID("YourApplicationID")
  APIKey("YourAPIKey")
)
// Copy `indexNameSrc` to `indexNameDest`
val index = client.initIndex(IndexName("indexNameSrc"))
index.copyIndex(IndexName("indexNameDest"))
<?php
require_once __DIR__."/vendor/autoload.php";
use Algolia\AlgoliaSearch\SearchClient;

// Use an API key with `addObject` ACL
$client = SearchClient::create(
  'YourApplicationID', 'YourAPIKey'
);

// Copy `indexNameSrc` to `indexNameDest`
$client->copyIndex('indexNameSrc', 'indexNameDest');
from algoliasearch.search_client import SearchClient

# Use an API key with `addObject` ACL
client = SearchClient.create("YourApplicationID", "YourAPIKey")

# Copy `indexNameSrc` to `indexNameDest`
client.copy_index("indexNameSrc", "indexNameDest")
require 'algolia'

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

# Copy `indexNameSrc` to `indexNameDest`
client.copy_index('indexNameSrc', 'indexNameDest')
// Use an API key with `addObject` ACL
val client = new AlgoliaClient("YourApplicationID", "YourAPIKey")

// Copy `indexNameSrc` to `indexNameDest`
client.execute { copy index "indexNameSrc" to "indexNameDest" }
import AlgoliaSearchClient

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

// Copy `indexNameSrc` to `indexNameDest`
client.copyIndex(from: "indexNameSrc", to: "indexNameDest") { result in
  if case .success(let response) = result {
    print("Response: \(response)")
  }
}

Copy parts of an index with scopes

// Use an API key with `addObject` ACL
var client = new SearchClient("YourApplicationID", "YourAPIKey");

// Copy only settings and synonyms from `indexNameSrc` to `indexNameDest`
List<string> scopes = new List<string>() {
    CopyScope.Settings,
    CopyScope.Synonyms
};

client.CopyIndex("indexNameSrc","indexNameDest",scope: scopes);

// Asynchronous
client.CopyIndexAsync("indexNameSrc","indexNameDest",scope: scopes);
// Use an API key with `addObject` ACL
client := search.NewClient("YourApplicationID", "YourAPIKey")

// Copy only settings and synonyms from `indexNameSrc` to `indexNameDest`
res, err := client.CopyIndex(
  "indexNameSrc",
  "indexNameDest",
  opt.Scopes("settings", "synonyms"),
)
// Use an API key with `addObject` ACL
SearchClient client = DefaultSearchClient.create("YourApplicationID", "YourAPIKey");

// Copy only settings and synonyms from `indexNameSrc` to `indexNameDest`
client.copyIndex(
  "indexNameSrc", "indexNameDest",
  Arrays.asList("settings", "synonyms")
);
// Copy only settings and synonyms from `indexNameSrc` to `indexNameDest`
client.copyIndex('indexNameSrc', 'indexNameDest', {
  scope: ['settings', 'synonyms']
});
// Use an API key with `addObject` ACL
val client = ClientSearch(
  ApplicationID("YourApplicationID"),
  APIKey("YourAPIKey")
)

// Copy only synonyms and settings from `indexNameSrc` to `indexNameDest`
val index = client.initIndex(IndexName("indexNameSrc"))
val scopes = listOf(
    Scope.Settings,
    Scope.Synonyms
)
index.copyIndex(IndexName("indexNameDest"), scopes)

```php PHP
<?php
require_once __DIR__."/vendor/autoload.php";
use Algolia\AlgoliaSearch\SearchClient;

// Use an API key with `addObject` ACL
$client = SearchClient::create(
  'YourApplicationID', 'YourAPIKey'
);

// Copy only settings and synonyms from `indexNameSrc` to `indexNameDest`
$client->copyIndex('indexNameSrc', 'indexNameDest', [
  'scope' => ['settings', 'synonyms']
]);
from algoliasearch.search_client import SearchClient

# Use an API key with `addObject` ACL
client = SearchClient.create("YourApplicationID", "YourAPIKey")

# Copy only settings and synonyms from `indexNameSrc` to `indexNameDest`
client.copy_index("indexNameSrc", "indexNameDest", {
    "scope": ["settings", "synonyms"]
})
require 'algolia'

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

# Copy only settings and synonyms from `indexNameSrc` to `indexNameDest`
client.copy_index('indexNameSrc', 'indexNameDest', {
  scope: ['settings', 'synonyms']
})
// Use an API key with `addObject` ACL
val client = new AlgoliaClient("YourApplicationID", "YourAPIKey")

// Copy only settings and synonyms from `indexNameSrc` to `indexNameDest`
client.execute {
  copy index "indexNameSrc" to "indexNameDest" scopes Seq("settings", "synonyms")
}
import AlgoliaSearchClient

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

// Copy only settings and synonyms from `indexNameSrc` to `indexNameDest`
client.copyIndex(
  from: "indexNameSrc",
  to: "indexNameDest",
  scope: [Scope.settings, Scope.synonyms]
)

Copy index between apps

// Copy `indexNameSrc` from app `SOURCE_APP_ID` to app `TARGET_APP_ID`
SearchClient sourceClient = new SearchClient("SOURCE_APP_ID", "SOURCE_API_KEY");
SearchClient targetClient = new SearchClient("TARGET_APP_ID", "TARGET_API_KEY");

SearchIndex sourceIndex = sourceClient.InitIndex("indexNameSrc");
SearchIndex targetIndex = targetClient.InitIndex("indexNameDest");

AccountClient accountClient = new AccountClient();

// Provide your 'Record' class for serializing the records during copying
// This method throws an exception if `targetIndex` exists
accountClient.CopyIndex<Record>(sourceIndex, targetIndex);

// Asynchronous
await accountClient.CopyIndexAsync<Record>(sourceIndex, targetIndex);
// Copy `indexNameSrc` from app `SOURCE_APP_ID` to app `TARGET_APP_ID`
sourceIndex = search.NewClient("SOURCE_APP_ID", "SOURCE_API_KEY").InitIndex("indexNameSrc")
targetIndex = search.NewClient("TARGET_APP_ID", "TARGET_API_KEY").InitIndex("indexNameDest")

res, err := search.NewAccount().CopyIndex(sourceIndex, targetIndex)
// Copy `indexNameSrc` from app `SOURCE_APP_ID` to app `TARGET_APP_ID`
SearchClient sourceClient =
  DefaultSearchClient.create("SOURCE_APP_ID", "SOURCE_API_KEY");

SearchIndex<Record> sourceIndex =
  sourceClient.initIndex("indexNameSrc", Record.class);

SearchClient targetClient =
DefaultSearchClient.create("TARGET_APP_ID", "TARGET_API_KEY");

SearchIndex<Record> targetIndex =
  targetClient.initIndex("indexNameDest", Record.class);

AccountClient accountClient = new AccountClient();

// This method throws an exception, if `targetIndex` exists
accountClient.copyIndex(sourceIndex, targetIndex);

// Asynchronous
accountClient.copyIndexAsync(sourceIndex, destinationIndex);
const algoliasearch = require('algoliasearch');
// Extra package: `npm install @algolia/client-account`
const accountCopyIndex = require('@algolia/client-account').accountCopyIndex;

// Copy `indexNameSrc` from app `SOURCE_APP_ID` to app `TARGET_APP_ID`
const sourceIndex = algoliasearch('SOURCE_APP_ID', 'SOURCE_API_KEY').initIndex('indexNameSrc');
const targetIndex = algoliasearch('TARGET_APP_ID', 'TARGET_API_KEY').initIndex('indexNameDest');

// This method returns an error if `targetIndex` exists
accountCopyIndex(sourceIndex, targetIndex);
// Copy `indexNameSrc` from app `SOURCE_APP_ID` to app `TARGET_APP_ID`
val sourceIndex = ClientSearch(
    ApplicationID("SOURCE_APP_ID"),
    APIKey("SOURCE_API_KEY")
).initIndex(IndexName("indexNameSrc"))

val targetIndex = ClientSearch(
    ApplicationID("TARGET_APP_ID"),
    APIKey("TARGET_API_KEY")
).initIndex(IndexName("indexNameDest"))

// This method throws an exception if `targetIndex` exists
ClientAccount.copyIndex(sourceIndex, targetIndex)
use \Algolia\AlgoliaSearch\SearchClient;
use \Algolia\AlgoliaSearch\AccountClient;

// Copy `indexNameSrc` from app `SOURCE_APP_ID` to app `TARGET_APP_ID`
$sourceIndex = SearchClient::create('SOURCE_APP_ID', 'SOURCE_API_KEY')->initIndex('indexNameSrc');
$targetIndex = SearchClient::create('TARGET_APP_ID', 'TARGET_API_KEY')->initIndex('indexNameDest');

// This method returns an error if `$targetIndex` exists
AccountClient::copyIndex($sourceIndex, $targetIndex);
from algoliasearch.search_client import SearchClient
from algoliasearch.account_client import AccountClient

# Copy `indexNameSrc` from app `SOURCE_APP_ID` to app `TARGET_APP_ID`
source_index = SearchClient.create(
    "SOURCE_APP_ID", "SOURCE_API_KEY"
).init_index("indexNameSrc")

target_index = SearchClient.create(
    "TARGET_APP_ID", "TARGET_API_KEY"
).init_index("indexNameDest")

# This method throws an exception if `target_index` exists
AccountClient.copy_index(source_index, target_index)
require 'algolia'

# Copy `indexNameSrc` from app `SOURCE_APP_ID` to app `TARGET_APP_ID`
source_index = Algolia::Search::Client.create(
  'SOURCE_APP_ID', 'SOURCE_API_KEY'
).init_index('indexNameSrc')
target_index = Algolia::Search::Client.create(
  'TARGET_APP_ID', 'TARGET_API_KEY'
).init_index('indexNameDest')

# This method returns an error if `target_index` exists
Algolia::Account::Client.copy_index(source_index, target_index)
import AlgoliaSearchClient

// Copy `indexNameSrc` from app `SOURCE_APP_ID` to app `TARGET_APP_ID`
let sourceIndex = SearchClient(appID: "SOURCE_APP_ID", apiKey: "SOURCE_API_KEY").index(withName: "indexNameSrc")
let targetIndex = SearchClient(appID: "TARGET_APP_ID", apiKey: "TARGET_API_KEY").index(withName: "indexNameDest")

try AccountClient.copyIndex(source: sourceIndex, destination: targetIndex) { result in
  if case .success(let response) = result {
    print("Response: \(response)")
  }
}

Parameters

indexDest
object
required
Destination index object.
indexNameDest
string
required
Name of the destination index.
indexNameSrc
string
required
Name of the source index to copy.
indexSrc
object
required
Source index object.
scope
list
An array containing any combination of the following strings:
  • settings
  • synonyms
  • rules
See more on how this parameter works.

Response

taskID
integer
This is the taskID which is used with the waitTask method.Note: You can use either the source or destination index to wait on the resulting taskID. In either case, the wait will include the full copy process.
updatedAt
date string
Date at which the job to copy the index has been created.

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.
JSON
{
  "updatedAt": "2017-12-18T21:22:40.761Z",
  "taskID": 19541511530
}
Last modified on March 23, 2026