curl
curl --request POST \
--url https://data.us.algolia.com/1/sources \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-algolia-api-key: ALGOLIA_API_KEY' \
--header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \
--data '
{
"type": "algoliaIndex",
"name": "lorem",
"input": {
"storeKeys": [
"lorem"
],
"locales": [
"fr-FR"
],
"url": "lorem",
"projectKey": "lorem",
"fallbackIsInStockValue": true,
"productQueryPredicate": "lorem",
"useImagesObjects": true,
"customFields": {
"inventory": [
"lorem"
],
"price": [
"lorem"
],
"category": [
"lorem"
]
}
},
"authenticationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
}
'// Initialize the client
var client = new IngestionClient(
new IngestionConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
);
// Call the API
var response = await client.CreateSourceAsync(
new SourceCreate
{
Type = Enum.Parse<SourceType>("Commercetools"),
Name = "sourceName",
Input = new SourceInput(
new SourceCommercetools
{
StoreKeys = new List<string> { "myStore" },
Locales = new List<string> { "de" },
Url = "http://commercetools.com",
ProjectKey = "keyID",
ProductQueryPredicate =
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
}
),
AuthenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
}
);
// print the response
Console.WriteLine(response);// Initialize the client
final client = IngestionClient(
appId: 'ALGOLIA_APPLICATION_ID',
apiKey: 'ALGOLIA_API_KEY',
region: 'ALGOLIA_APPLICATION_REGION');
// Call the API
final response = await client.createSource(
sourceCreate: SourceCreate(
type: SourceType.fromJson("commercetools"),
name: "sourceName",
input: SourceCommercetools(
storeKeys: [
"myStore",
],
locales: [
"de",
],
url: "http://commercetools.com",
projectKey: "keyID",
productQueryPredicate:
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
),
authenticationID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
),
);
// print the response
print(response);// Initialize the client with your application region, eg. ingestion.ALGOLIA_APPLICATION_REGION
client, err := ingestion.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", ingestion.US)
if err != nil {
// The client can fail to initialize if you pass an invalid parameter.
panic(err)
}
// Call the API
response, err := client.CreateSource(client.NewApiCreateSourceRequest(
ingestion.NewEmptySourceCreate().
SetType(ingestion.SourceType("commercetools")).
SetName("sourceName").
SetInput(ingestion.SourceCommercetoolsAsSourceInput(
ingestion.NewEmptySourceCommercetools().SetStoreKeys(
[]string{"myStore"}).SetLocales(
[]string{
"de",
}).
SetUrl("http://commercetools.com").
SetProjectKey("keyID").SetProductQueryPredicate("masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))"))).
SetAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f"),
))
if err != nil {
// handle the eventual error
panic(err)
}
// print the response
print(response)// Initialize the client
IngestionClient client = new IngestionClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");
// Call the API
SourceCreateResponse response = client.createSource(
new SourceCreate()
.setType(SourceType.COMMERCETOOLS)
.setName("sourceName")
.setInput(
new SourceCommercetools()
.setStoreKeys(Arrays.asList("myStore"))
.setLocales(Arrays.asList("de"))
.setUrl("http://commercetools.com")
.setProjectKey("keyID")
.setProductQueryPredicate("masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))")
)
.setAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
);
// print the response
System.out.println(response);// Initialize the client
// Replace 'us' with your Algolia Application Region
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initIngestion({ region: 'us' });
// Call the API
const response = await client.createSource({
type: 'commercetools',
name: 'sourceName',
input: {
storeKeys: ['myStore'],
locales: ['de'],
url: 'http://commercetools.com',
projectKey: 'keyID',
productQueryPredicate: 'masterVariant(attributes(name="Brand" and value="Algolia"))',
},
authenticationID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
});
// print the response
console.log(response);// Initialize the client
val client =
IngestionClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = "ALGOLIA_APPLICATION_REGION",
)
// Call the API
var response =
client.createSource(
sourceCreate =
SourceCreate(
type = SourceType.entries.first { it.value == "commercetools" },
name = "sourceName",
input =
SourceCommercetools(
storeKeys = listOf("myStore"),
locales = listOf("de"),
url = "http://commercetools.com",
projectKey = "keyID",
productQueryPredicate =
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
),
authenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
)
)
// print the response
println(response)// Initialize the client
$client = IngestionClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');
// Call the API
$response = $client->createSource(
['type' => 'commercetools',
'name' => 'sourceName',
'input' => ['storeKeys' => [
'myStore',
],
'locales' => [
'de',
],
'url' => 'http://commercetools.com',
'projectKey' => 'keyID',
'productQueryPredicate' => 'masterVariant(attributes(name="Brand" and value="Algolia"))',
],
'authenticationID' => '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
],
);
// print the response
var_dump($response);# Initialize the client
# In an asynchronous context, you can use IngestionClient instead, which exposes the exact same methods.
client = IngestionClientSync(
"ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"
)
# Call the API
response = client.create_source(
source_create={
"type": "commercetools",
"name": "sourceName",
"input": {
"storeKeys": [
"myStore",
],
"locales": [
"de",
],
"url": "http://commercetools.com",
"projectKey": "keyID",
"productQueryPredicate": 'masterVariant(attributes(name="Brand" and value="Algolia"))',
},
"authenticationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
},
)
# print the response
print(response)# Initialize the client
client = Algolia::IngestionClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
# Call the API
response = client.create_source(
Algolia::Ingestion::SourceCreate.new(
type: "commercetools",
name: "sourceName",
input: Algolia::Ingestion::SourceCommercetools.new(
store_keys: ["myStore"],
locales: ["de"],
url: "http://commercetools.com",
project_key: "keyID",
product_query_predicate: "masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))"
),
authentication_id: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
)
)
# print the response
puts(response)// Initialize the client
val client = IngestionClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = "ALGOLIA_APPLICATION_REGION"
)
// Call the API
val response = Await.result(
client.createSource(
sourceCreate = SourceCreate(
`type` = SourceType.withName("commercetools"),
name = "sourceName",
input = Some(
SourceCommercetools(
storeKeys = Some(Seq("myStore")),
locales = Some(Seq("de")),
url = "http://commercetools.com",
projectKey = "keyID",
productQueryPredicate = Some("masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))")
)
),
authenticationID = Some("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
)
),
Duration(100, "sec")
)
// print the response
println(response)// Initialize the client
let client = try IngestionClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)
// Call the API
let response = try await client.createSource(sourceCreate: SourceCreate(
type: SourceType.commercetools,
name: "sourceName",
input: SourceInput.sourceCommercetools(SourceCommercetools(
storeKeys: ["myStore"],
locales: ["de"],
url: "http://commercetools.com",
projectKey: "keyID",
productQueryPredicate: "masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))"
)),
authenticationID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
))
// print the response
print(response){
"createdAt": "<string>",
"name": "<string>",
"sourceID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
}{
"message": "Invalid Application-Id or API-Key"
}Sources
Create a source
Creates a new source.
POST
/
1
/
sources
curl
curl --request POST \
--url https://data.us.algolia.com/1/sources \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-algolia-api-key: ALGOLIA_API_KEY' \
--header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \
--data '
{
"type": "algoliaIndex",
"name": "lorem",
"input": {
"storeKeys": [
"lorem"
],
"locales": [
"fr-FR"
],
"url": "lorem",
"projectKey": "lorem",
"fallbackIsInStockValue": true,
"productQueryPredicate": "lorem",
"useImagesObjects": true,
"customFields": {
"inventory": [
"lorem"
],
"price": [
"lorem"
],
"category": [
"lorem"
]
}
},
"authenticationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
}
'// Initialize the client
var client = new IngestionClient(
new IngestionConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
);
// Call the API
var response = await client.CreateSourceAsync(
new SourceCreate
{
Type = Enum.Parse<SourceType>("Commercetools"),
Name = "sourceName",
Input = new SourceInput(
new SourceCommercetools
{
StoreKeys = new List<string> { "myStore" },
Locales = new List<string> { "de" },
Url = "http://commercetools.com",
ProjectKey = "keyID",
ProductQueryPredicate =
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
}
),
AuthenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
}
);
// print the response
Console.WriteLine(response);// Initialize the client
final client = IngestionClient(
appId: 'ALGOLIA_APPLICATION_ID',
apiKey: 'ALGOLIA_API_KEY',
region: 'ALGOLIA_APPLICATION_REGION');
// Call the API
final response = await client.createSource(
sourceCreate: SourceCreate(
type: SourceType.fromJson("commercetools"),
name: "sourceName",
input: SourceCommercetools(
storeKeys: [
"myStore",
],
locales: [
"de",
],
url: "http://commercetools.com",
projectKey: "keyID",
productQueryPredicate:
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
),
authenticationID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
),
);
// print the response
print(response);// Initialize the client with your application region, eg. ingestion.ALGOLIA_APPLICATION_REGION
client, err := ingestion.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", ingestion.US)
if err != nil {
// The client can fail to initialize if you pass an invalid parameter.
panic(err)
}
// Call the API
response, err := client.CreateSource(client.NewApiCreateSourceRequest(
ingestion.NewEmptySourceCreate().
SetType(ingestion.SourceType("commercetools")).
SetName("sourceName").
SetInput(ingestion.SourceCommercetoolsAsSourceInput(
ingestion.NewEmptySourceCommercetools().SetStoreKeys(
[]string{"myStore"}).SetLocales(
[]string{
"de",
}).
SetUrl("http://commercetools.com").
SetProjectKey("keyID").SetProductQueryPredicate("masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))"))).
SetAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f"),
))
if err != nil {
// handle the eventual error
panic(err)
}
// print the response
print(response)// Initialize the client
IngestionClient client = new IngestionClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");
// Call the API
SourceCreateResponse response = client.createSource(
new SourceCreate()
.setType(SourceType.COMMERCETOOLS)
.setName("sourceName")
.setInput(
new SourceCommercetools()
.setStoreKeys(Arrays.asList("myStore"))
.setLocales(Arrays.asList("de"))
.setUrl("http://commercetools.com")
.setProjectKey("keyID")
.setProductQueryPredicate("masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))")
)
.setAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
);
// print the response
System.out.println(response);// Initialize the client
// Replace 'us' with your Algolia Application Region
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initIngestion({ region: 'us' });
// Call the API
const response = await client.createSource({
type: 'commercetools',
name: 'sourceName',
input: {
storeKeys: ['myStore'],
locales: ['de'],
url: 'http://commercetools.com',
projectKey: 'keyID',
productQueryPredicate: 'masterVariant(attributes(name="Brand" and value="Algolia"))',
},
authenticationID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
});
// print the response
console.log(response);// Initialize the client
val client =
IngestionClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = "ALGOLIA_APPLICATION_REGION",
)
// Call the API
var response =
client.createSource(
sourceCreate =
SourceCreate(
type = SourceType.entries.first { it.value == "commercetools" },
name = "sourceName",
input =
SourceCommercetools(
storeKeys = listOf("myStore"),
locales = listOf("de"),
url = "http://commercetools.com",
projectKey = "keyID",
productQueryPredicate =
"masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))",
),
authenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
)
)
// print the response
println(response)// Initialize the client
$client = IngestionClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');
// Call the API
$response = $client->createSource(
['type' => 'commercetools',
'name' => 'sourceName',
'input' => ['storeKeys' => [
'myStore',
],
'locales' => [
'de',
],
'url' => 'http://commercetools.com',
'projectKey' => 'keyID',
'productQueryPredicate' => 'masterVariant(attributes(name="Brand" and value="Algolia"))',
],
'authenticationID' => '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
],
);
// print the response
var_dump($response);# Initialize the client
# In an asynchronous context, you can use IngestionClient instead, which exposes the exact same methods.
client = IngestionClientSync(
"ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"
)
# Call the API
response = client.create_source(
source_create={
"type": "commercetools",
"name": "sourceName",
"input": {
"storeKeys": [
"myStore",
],
"locales": [
"de",
],
"url": "http://commercetools.com",
"projectKey": "keyID",
"productQueryPredicate": 'masterVariant(attributes(name="Brand" and value="Algolia"))',
},
"authenticationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
},
)
# print the response
print(response)# Initialize the client
client = Algolia::IngestionClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
# Call the API
response = client.create_source(
Algolia::Ingestion::SourceCreate.new(
type: "commercetools",
name: "sourceName",
input: Algolia::Ingestion::SourceCommercetools.new(
store_keys: ["myStore"],
locales: ["de"],
url: "http://commercetools.com",
project_key: "keyID",
product_query_predicate: "masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))"
),
authentication_id: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
)
)
# print the response
puts(response)// Initialize the client
val client = IngestionClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = "ALGOLIA_APPLICATION_REGION"
)
// Call the API
val response = Await.result(
client.createSource(
sourceCreate = SourceCreate(
`type` = SourceType.withName("commercetools"),
name = "sourceName",
input = Some(
SourceCommercetools(
storeKeys = Some(Seq("myStore")),
locales = Some(Seq("de")),
url = "http://commercetools.com",
projectKey = "keyID",
productQueryPredicate = Some("masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))")
)
),
authenticationID = Some("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
)
),
Duration(100, "sec")
)
// print the response
println(response)// Initialize the client
let client = try IngestionClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)
// Call the API
let response = try await client.createSource(sourceCreate: SourceCreate(
type: SourceType.commercetools,
name: "sourceName",
input: SourceInput.sourceCommercetools(SourceCommercetools(
storeKeys: ["myStore"],
locales: ["de"],
url: "http://commercetools.com",
projectKey: "keyID",
productQueryPredicate: "masterVariant(attributes(name=\"Brand\" and value=\"Algolia\"))"
)),
authenticationID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
))
// print the response
print(response){
"createdAt": "<string>",
"name": "<string>",
"sourceID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
}{
"message": "Invalid Application-Id or API-Key"
}Required ACL:
addObject, deleteIndex, editSettingsAuthorizations
Your Algolia application ID.
Your Algolia API key with the necessary permissions to make the request. Permissions are controlled through access control lists (ACL) and access restrictions. The required ACL to make a request is listed in each endpoint's reference.
Body
application/json
Descriptive name of the source.
Available options:
algoliaIndex, bigcommerce, bigquery, commercetools, csv, docker, ga4BigqueryExport, json, shopify, push Universally unique identifier (UUID) of an authentication resource.
Example:
"6c02aeb1-775e-418e-870b-1faccd4b2c0f"
Specific configuration attributes of a commercetools source.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
Show child attributes
Show child attributes
Last modified on March 23, 2026
Was this page helpful?
āI