Algolia

Algolia Composition API

Client libraries Use Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps. For more information, see [Algolia's…

Developer tools#openapi

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

Client libraries

Use Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps.

For more information, see Algolia's ecosystem.

Base URLs

Base URLs for the Composition API:

  • https://{APPLICATION_ID}.algolia.net
  • https://{APPLICATION_ID}-dsn.algolia.net.

If your subscription includes a Distributed Search Network,
this ensures that requests are sent to servers closest to users.

Both URLs provide high availability by distributing requests with load balancing.

All requests must use HTTPS.

Retry strategy

To guarantee high availability, implement a retry strategy for all API requests using the URLs of your servers as fallbacks:

  • https://{APPLICATION_ID}-1.algolianet.com
  • https://{APPLICATION_ID}-2.algolianet.com
  • https://{APPLICATION_ID}-3.algolianet.com

These URLs use a different DNS provider than the primary URLs.
Randomize this list to ensure an even load across the three servers.

All Algolia API clients implement this retry strategy.

Authentication

Add these headers to authenticate requests:

  • x-algolia-application-id. Your Algolia application ID.
  • x-algolia-api-key. An API key with the necessary permissions to make the request.

The required access control list (ACL) to make a request is listed in each endpoint's reference.

You can find your application ID and API key in the Algolia dashboard.

Request format

Depending on the endpoint, request bodies are either JSON objects or arrays of JSON objects.

Parameters

Parameters are passed in the request body for POST and PUT requests.

Response status and errors

The Composition API returns JSON responses.
Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API response.

Successful responses return 2xx statuses. Client errors return 4xx statuses. Server errors return 5xx statuses.
Error responses have a message property with more information.

Version

The current version of the Composition API is version 1, indicated by the /1/ in each endpoint's URL.

Endpoints 20

composition

  • GETSend requests to the Algolia REST API/:pathThis method lets you send requests to the Algolia REST API.
  • PUTSend requests to the Algolia REST API/:pathThis method lets you send requests to the Algolia REST API.
  • POSTSend requests to the Algolia REST API/:pathThis method lets you send requests to the Algolia REST API.
  • DELETESend requests to the Algolia REST API/:pathThis method lets you send requests to the Algolia REST API.
  • POSTRun a Composition/1/compositions/:compositionID/runRuns a query on a single composition and returns matching results.
  • POSTSearch for facet values/1/compositions/:compositionID/facets/:facetName/querySearches for values of a specified facet attribute on the composition's main source's index. By default, facet values are sorted by decreasing count. You can…
  • GETList compositions/1/compositionsLists all compositions in the current Algolia application.
  • GETRetrieve a composition/1/compositions/:compositionIDRetrieve a single composition in the current Algolia application.
  • PUTUpdate and insert (upsert) a composition/1/compositions/:compositionIDUpdate and insert a composition in the current Algolia application.
  • DELETEDelete a composition/1/compositions/:compositionIDDelete a composition from the current Algolia application.
  • POSTBatch action to multiple compositions/1/compositions/*/batchAdds, updates, or deletes compositions with a single API request.
  • POSTSet or update the "sortingStrategy" configuration for an existing composition/1/compositions/:compositionID/sortingStrategyUpdates the "sortingStrategy" field of an existing composition. This endpoint lets you create a new sorting strategy mapping or replace the configured one.…
  • GETRetrieve a rule/1/compositions/:compositionID/rules/:objectIDRetrieves a rule by its ID. To find the object ID of a rule, use the search operation.
  • PUTAdd or update a composition rule/1/compositions/:compositionID/rules/:objectIDIf a composition rule with the provided ID already exists, it's replaced. Otherwise, a new one is added.
  • DELETEDelete a Composition Rule/1/compositions/:compositionID/rules/:objectIDDelete a Composition Rule from the specified Composition ID.
  • POSTCreate or update or delete composition rules/1/compositions/:compositionID/rules/batchCreate or update or delete multiple composition rules.
  • POSTSearch for composition rules/1/compositions/:compositionID/rules/searchSearches for composition rules in your index.
  • GETCheck task status/1/compositions/:compositionID/task/:taskIDChecks the status of a given task.
  • GETSwitch the API key used to authenticate requests/setClientApiKey?apiKey=stringSwitch the API key used to authenticate requests.
  • GETWait for operation to complete/waitForCompositionTask?compositionID=string&taskID=0Wait for a task to complete to ensure synchronized composition updates. All Algolia write operations are asynchronous. When you make a request for a write…

API details

Base URL
https://{appId}.algolia.net
https://{appId}-1.algolianet.com
https://{appId}-2.algolianet.com
https://{appId}-3.algolianet.com
https://{appId}-dsn.algolia.net
Authentication
An API key in the x-algolia-application-id header
An API key in the x-algolia-api-key header
Operations
20 operations on 13 pathsGET 7POST 7PUT 3DELETE 3
Main resources
composition 20
Response formats
application/json
Description format
OpenAPI 3.0.2, API version 1.0.0

How to test the Algolia Composition API in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the Algolia Composition API collection, without the publisher's secrets.
  3. Add your credentialsThis API uses an API key in the x-algolia-application-id header. Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “Send requests to the Algolia REST API” (GET /:path), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the Algolia Composition API?

Client libraries Use Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps. For more information, see [Algolia's… It is listed under Developer tools and has 20 endpoints.

Who publishes the Algolia Composition API?

It is listed from Algolia's public API description (an OpenAPI document), not published by Algolia on Swastik Codes. Anyone who controls algolia.com can claim the profile by adding a DNS TXT record.

What is the base URL of the Algolia Composition API?

Its description lists 5 base URLs: https://{appId}.algolia.net, https://{appId}-1.algolianet.com, https://{appId}-2.algolianet.com, https://{appId}-3.algolianet.com, https://{appId}-dsn.algolia.net. The first is the usual one; the others are typically sandbox or regional servers.

How do I authenticate with the Algolia Composition API?

It accepts 2 methods: an API key in the x-algolia-application-id header; an API key in the x-algolia-api-key header.

How many endpoints does the Algolia Composition API have?

20 operations on 13 paths (7 GET, 7 POST, 3 PUT, 3 DELETE). The largest groups are composition.

Is forking the Algolia Composition API free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.