Algolia Composition API
Composes multiple search sources into one curated result set - smart groups, curated queries and composition rules - so a single request returns a merchandised, multi-source response.
Composes multiple search sources into one curated result set - smart groups, curated queries and composition rules - so a single request returns a merchandised, multi-source response.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/algolia-composition-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
openapi: 3.2.0
info:
title: Composition API
summary: The Algolia Composition API lets you run composed search requests on your Compositions
description: "## Client libraries\n\nUse Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps.\n\nFor more information, see [Algolia's ecosystem](https://www.algolia.com/doc/libraries).\n\n## Base URLs\n\nBase URLs for the Composition API:\n\n- `https://{APPLICATION_ID}.algolia.net`\n- `https://{APPLICATION_ID}-dsn.algolia.net`.\n If your subscription includes a [Distributed Search Network](https://dashboard.algolia.com/infra),\n this ensures that requests are sent to servers closest to users.\n\nBoth URLs provide high availability by distributing requests with load balancing.\n\n**All requests must use HTTPS.**\n\n## Retry strategy\n\nTo guarantee high availability, implement a retry strategy for all API requests using the URLs of your servers as fallbacks:\n\n- `https://{APPLICATION_ID}-1.algolianet.com`\n- `https://{APPLICATION_ID}-2.algolianet.com`\n- `https://{APPLICATION_ID}-3.algolianet.com`\n\nThese URLs use a different DNS provider than the primary URLs.\nRandomize this list to ensure an even load across the three servers.\n\nAll Algolia API clients implement this retry strategy.\n\n## Authentication\n\nAdd these headers to authenticate requests:\n\n- `x-algolia-application-id`. Your Algolia application ID.\n- `x-algolia-api-key`. An API key with the necessary permissions to make the request.\n The required access control list (ACL) to make a request is listed in each endpoint's reference.\n\nYou can find your application ID and API key in the [Algolia dashboard](https://dashboard.algolia.com/account/api-keys).\n\n## Request format\n\nDepending on the endpoint, request bodies are either JSON objects or arrays of JSON objects.\n\n## Parameters\n\nParameters are passed in the request body for POST and PUT requests.\n\n## Response status and errors\n\nThe Composition API returns JSON responses.\nSince JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API response.\n\nSuccessful responses return `2xx` statuses. Client errors return `4xx` statuses. Server errors return `5xx` statuses.\nError responses have a `message` property with more information.\n\n## Version\n\nThe current version of the Composition API is version 1, indicated by the `/1/` in each endpoint's URL.\n"
version: 1.0.0
servers:
- url: https://{appId}.algolia.net
variables:
appId:
default: ALGOLIA_APPLICATION_ID
- url: https://{appId}-1.algolianet.com
variables:
appId:
default: ALGOLIA_APPLICATION_ID
- url: https://{appId}-2.algolianet.com
variables:
appId:
default: ALGOLIA_APPLICATION_ID
- url: https://{appId}-3.algolianet.com
variables:
appId:
default: ALGOLIA_APPLICATION_ID
- url: https://{appId}-dsn.algolia.net
variables:
appId:
default: ALGOLIA_APPLICATION_ID
security:
- appId: []
apiKey: []
tags:
- name: composition
paths:
/{path}:
get:
operationId: customGet
summary: Send requests to the Algolia REST API
description: This method lets you send requests to the Algolia REST API.
parameters:
- $ref: '#/components/parameters/PathInPath'
- $ref: '#/components/parameters/Parameters'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/IndexNotFound'
tags:
- composition
post:
operationId: customPost
requestBody:
description: Parameters to send with the custom request.
content:
application/json:
schema:
type: object
summary: Send requests to the Algolia REST API
description: This method lets you send requests to the Algolia REST API.
parameters:
- $ref: '#/components/parameters/PathInPath'
- $ref: '#/components/parameters/Parameters'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/IndexNotFound'
tags:
- composition
put:
operationId: customPut
requestBody:
description: Parameters to send with the custom request.
content:
application/json:
schema:
type: object
summary: Send requests to the Algolia REST API
description: This method lets you send requests to the Algolia REST API.
parameters:
- $ref: '#/components/parameters/PathInPath'
- $ref: '#/components/parameters/Parameters'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/IndexNotFound'
tags:
- composition
delete:
operationId: customDelete
summary: Send requests to the Algolia REST API
description: This method lets you send requests to the Algolia REST API.
parameters:
- $ref: '#/components/parameters/PathInPath'
- $ref: '#/components/parameters/Parameters'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/IndexNotFound'
tags:
- composition
/1/compositions/{compositionID}/run:
post:
tags:
- composition
operationId: search
x-use-read-transporter: true
x-cacheable: true
x-acl:
- search
summary: Run a Composition
description: Runs a query on a single composition and returns matching results.
parameters:
- $ref: '#/components/parameters/compositionID'
requestBody:
required: true
content:
application/json:
schema:
title: requestBody
type: object
additionalProperties: false
properties:
params:
$ref: '#/components/schemas/params'
feedsOrder:
$ref: '#/components/schemas/feedsOrder'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/searchResponse'
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/IndexNotFound'
/1/compositions/{compositionID}/facets/{facetName}/query:
post:
tags:
- composition
operationId: searchForFacetValues
x-use-read-transporter: true
x-cacheable: true
x-acl:
- search
summary: Search for facet values
description: "Searches for values of a specified facet attribute on the composition's main source's index.\n\n- By default, facet values are sorted by decreasing count.\n You can adjust this with the `sortFacetValueBy` parameter.\n- Searching for facet values doesn't work if you have **more than 65 searchable facets and searchable attributes combined**.\n"
parameters:
- $ref: '#/components/parameters/compositionID'
- name: facetName
description: 'Facet attribute in which to search for values.
This attribute must be included in the `attributesForFaceting` index setting with the `searchable()` modifier.
'
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
title: searchForFacetValuesRequest
type: object
additionalProperties: false
properties:
params:
title: searchForFacetValuesParams
type: object
properties:
query:
$ref: '#/components/schemas/query'
maxFacetHits:
$ref: '#/components/schemas/maxFacetHits'
searchQuery:
$ref: '#/components/schemas/params'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/searchForFacetValuesResponse'
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/IndexNotFound'
/1/compositions:
get:
tags:
- composition
operationId: listCompositions
x-acl:
- editSettings
- settings
summary: List compositions
description: 'Lists all compositions in the current Algolia application.
'
parameters:
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/HitsPerPage'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/listCompositionsResponse'
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/CompositionNotFound'
/1/compositions/{compositionID}:
get:
tags:
- composition
operationId: getComposition
x-acl:
- editSettings
- settings
summary: Retrieve a composition
description: 'Retrieve a single composition in the current Algolia application.
'
parameters:
- $ref: '#/components/parameters/compositionID'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/composition'
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/CompositionNotFound'
put:
tags:
- composition
operationId: putComposition
x-acl:
- editSettings
summary: Update and insert (upsert) a composition
description: 'Update and insert a composition in the current Algolia application.
'
parameters:
- $ref: '#/components/parameters/compositionID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/composition'
responses:
'200':
description: OK
content:
application/json:
schema:
title: taskIDResponse
type: object
additionalProperties: false
properties:
taskID:
$ref: '#/components/schemas/taskID'
required:
- taskID
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'422':
$ref: '#/components/responses/UnprocessableEntity'
delete:
tags:
- composition
operationId: deleteComposition
x-acl:
- editSettings
summary: Delete a composition
description: 'Delete a composition from the current Algolia application.
'
parameters:
- $ref: '#/components/parameters/compositionID'
responses:
'200':
description: OK
content:
application/json:
schema:
title: taskIDResponse
type: object
additionalProperties: false
properties:
taskID:
$ref: '#/components/schemas/taskID'
required:
- taskID
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
/1/compositions/*/batch:
post:
tags:
- composition
operationId: multipleBatch
description: 'Adds, updates, or deletes compositions with a single API request.
'
x-acl:
- editSettings
summary: Batch action to multiple compositions
requestBody:
required: true
content:
application/json:
schema:
title: batchParams
description: Batch parameters.
type: object
additionalProperties: false
properties:
requests:
type: array
items:
title: multipleBatchRequest
type: object
additionalProperties: false
properties:
action:
$ref: '#/components/schemas/action'
body:
$ref: '#/components/schemas/batchCompositionAction'
required:
- action
- body
required:
- requests
responses:
'200':
description: OK
content:
application/json:
schema:
title: multipleBatchResponse
type: object
additionalProperties: false
properties:
taskID:
type: object
description: Task IDs. One for each index.
additionalProperties:
$ref: '#/components/schemas/taskID'
required:
- taskID
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/IndexNotFound'
/1/compositions/{compositionID}/sortingStrategy:
post:
tags:
- composition
operationId: updateSortingStrategyComposition
x-acl:
- editSettings
summary: Set or update the "sortingStrategy" configuration for an existing composition
description: 'Updates the "sortingStrategy" field of an existing composition.
This endpoint lets you create a new sorting strategy mapping or replace the configured one.
The provided sorting indices must be associated indices or replicas of the main targeted index.
This endpoint can''t validate whether the sort index is related to the composition''s main index.
Validation fails at runtime if the index you updated isn''t related.
The update is applied to the specified composition within the current Algolia application and returns a taskID that can be used to track the operation’s completion.
'
parameters:
- $ref: '#/components/parameters/compositionID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/sortingStrategy'
responses:
'200':
description: OK
content:
application/json:
schema:
title: taskIDResponse
type: object
additionalProperties: false
properties:
taskID:
$ref: '#/components/schemas/taskID'
required:
- taskID
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/CompositionNotFound'
/1/compositions/{compositionID}/rules/{objectID}:
get:
tags:
- composition
operationId: getRule
x-acl:
- editSettings
- settings
summary: Retrieve a rule
description: 'Retrieves a rule by its ID.
To find the object ID of a rule, use the [`search` operation](https://www.algolia.com/doc/rest-api/composition/search-composition-rules).
'
parameters:
- $ref: '#/components/parameters/compositionID'
- $ref: '#/components/parameters/ObjectIDRule'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/compositionRule'
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/IndexNotFound'
put:
tags:
- composition
operationId: putCompositionRule
x-acl:
- editSettings
summary: Add or update a composition rule
description: 'If a composition rule with the provided ID already exists,
it''s replaced. Otherwise, a new one is added.
'
parameters:
- $ref: '#/components/parameters/compositionID'
- $ref: '#/components/parameters/ObjectIDRule'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/compositionRule'
responses:
'200':
description: OK
content:
application/json:
schema:
title: taskIDResponse
type: object
additionalProperties: false
properties:
taskID:
$ref: '#/components/schemas/taskID'
required:
- taskID
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/CompositionNotFound'
'422':
$ref: '#/components/responses/UnprocessableEntity'
delete:
tags:
- composition
operationId: deleteCompositionRule
x-acl:
- editSettings
summary: Delete a Composition Rule
description: 'Delete a Composition Rule from the specified Composition ID.
'
parameters:
- $ref: '#/components/parameters/compositionID'
- $ref: '#/components/parameters/ObjectIDRule'
responses:
'200':
description: OK
content:
application/json:
schema:
title: taskIDResponse
type: object
additionalProperties: false
properties:
taskID:
$ref: '#/components/schemas/taskID'
required:
- taskID
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/CompositionNotFound'
/1/compositions/{compositionID}/rules/batch:
post:
tags:
- composition
operationId: saveRules
x-acl:
- editSettings
summary: Create or update or delete composition rules
description: 'Create or update or delete multiple composition rules.
'
x-codegen-request-body-name: rules
parameters:
- $ref: '#/components/parameters/compositionID'
requestBody:
required: true
content:
application/json:
schema:
title: compositionRulesBatchParams
description: Composition rules batch parameters.
type: object
additionalProperties: false
properties:
requests:
type: array
items:
title: rulesMultipleBatchRequest
type: object
additionalProperties: false
properties:
action:
$ref: '#/components/schemas/action'
body:
$ref: '#/components/schemas/rulesBatchCompositionAction'
required:
- action
- body
responses:
'200':
description: OK
content:
application/json:
schema:
title: rulesMultipleBatchResponse
type: object
additionalProperties: false
properties:
taskID:
$ref: '#/components/schemas/taskID'
required:
- taskID
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/IndexNotFound'
/1/compositions/{compositionID}/rules/search:
post:
tags:
- composition
operationId: searchCompositionRules
x-acl:
- settings
summary: Search for composition rules
description: Searches for composition rules in your index.
parameters:
- $ref: '#/components/parameters/compositionID'
requestBody:
content:
application/json:
schema:
title: searchCompositionRulesParams
type: object
description: Composition Rules search parameters.
additionalProperties: false
properties:
query:
$ref: '#/components/schemas/parameters_query'
anchoring:
$ref: '#/components/schemas/anchoring'
context:
type: string
description: Only return composition rules that match the context (exact match).
example: mobile
page:
$ref: '#/components/schemas/parameters_page'
hitsPerPage:
$ref: '#/components/schemas/parameters_hitsPerPage'
enabled:
oneOf:
- type: boolean
description: 'If `true`, return only enabled composition rules.
If `false`, return only inactive composition rules.
By default, _all_ composition rules are returned.
'
- type: 'null'
default: null
responses:
'200':
description: OK
content:
application/json:
schema:
title: searchCompositionRulesResponse
type: object
additionalProperties: false
required:
- hits
- nbHits
- page
- nbPages
properties:
hits:
type: array
description: Composition rules that matched the search criteria.
items:
$ref: '#/components/schemas/compositionRule'
nbHits:
type: integer
description: Number of composition rules that matched the search criteria.
page:
type: integer
description: Current page.
nbPages:
type: integer
description: Number of pages.
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/IndexNotFound'
/1/compositions/{compositionID}/task/{taskID}:
get:
tags:
- composition
operationId: getTask
x-acl:
- editSettings
- settings
- addObject
- deleteObject
- deleteIndex
description: 'Checks the status of a given task.
'
summary: Check task status
parameters:
- $ref: '#/components/parameters/compositionID'
- name: taskID
in: path
description: Unique task identifier.
required: true
schema:
type: integer
format: int64
example: 1506303845001
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GetTaskResponse'
'400':
$ref: '#/components/responses/BadRequest'
'402':
$ref: '#/components/responses/FeatureNotEnabled'
'403':
$ref: '#/components/responses/MethodNotAllowed'
'404':
$ref: '#/components/responses/IndexNotFound'
/setClientApiKey:
get:
x-helper: true
x-asynchronous-helper: false
x-acl: []
tags:
- composition
operationId: setClientApiKey
summary: Switch the API key used to authenticate requests
description: 'Switch the API key used to authenticate requests.
'
parameters:
- in: query
name: apiKey
description: API key to use for subsequent requests.
required: true
schema:
type: string
responses:
'204':
description: No content.
/waitForCompositionTask:
get:
x-helper: true
tags:
- composition
operationId: waitForCompositionTask
x-acl:
- editSettings
- settings
- addObject
- deleteObject
- deleteIndex
summary: Wait for operation to complete
description: 'Wait for a task to complete to ensure synchronized composition updates.
All Algolia write operations are asynchronous. When you make a request for a write operation, for example, to upsert or delete a composition, Algolia creates a task on a queue and returns a taskID. The task itself runs separately, depending on the server load.
'
parameters:
- in: query
name: compositionID
description: The ID of the composition on which the operation was performed.
required: true
schema:
type: string
- in: query
name: taskID
description: The taskID returned by the operation.
required: true
schema:
type: integer
format: int64
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GetTaskResponse'
'400':
$ref: '#/components/responses/CompositionNotFound'
components:
schemas:
filters:
type: string
description: "Filter expression to only include items that match the filter criteria in the response.\n\nYou can use these filter expressions:\n\n- **Numeric filters.** `<facet> <op> <number>`, where `<op>` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`.\n- **Ranges.** `<facet>:<lower> TO <upper>`, where `<lower>` and `<upper>` are the lower and upper limits of the range (inclusive).\n- **Facet filters.** `<facet>:<value>`, where `<facet>` is a facet attribute (case-sensitive) and `<value>` a facet value.\n- **Tag filters.** `_tags:<value>` or just `<value>` (case-sensitive).\n- **Boolean filters.** `<facet>: true | false`.\n\nYou can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions:\n\n- You can only combine filters of the same type with `OR`.\n **Not supported:** `facet:value OR num > 3`.\n- You can't use `NOT` with combinations of filters.\n **Not supported:** `NOT(facet:value OR facet:value)`\n- You can't combine conjunctions (`AND`) with `OR`.\n **Not supported:** `facet:value OR (facet:value AND facet:value)`\n\nUse quotes if the facet attribute name or facet value contains spaces, keywords (`OR`, `AND`, `NOT`), or quotes.\nIf a facet attribute is an array, the filter matches if it matches at least one element of the array.\n\nFor more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering).\n"
example: (category:Book OR category:Ebook) AND _tags:published
x-categories:
- Filtering
feedID:
type: string
description: The ID of the feed.
example: products-feed
facetOrdering:
description: Order of facet names and facet values in your UI.
type: object
additionalProperties: false
properties:
facets:
$ref: '#/components/schemas/IndexSettings_facets'
values:
$ref: '#/components/schemas/values'
externalInjectedItem:
type: object
description: 'Contains a list of objects to inject from an external source.
'
properties:
items:
type: array
items:
title: externalInjection
type: object
additionalProperties: false
properties:
objectID:
type: string
description: An objectID injected from an external source and also present in the targeted index.
metadata:
type: object
additionalProperties: true
description: 'User-defined key-values that will be added to the injected item in the response.
This is identical to Hits metadata defined in Composition or Composition Rule,
with the benefit of being set at runtime.
'
example:
my-field: my-value
required:
- objectID
example:
objectID: my-object-1
metadata':
my-field: my-value
required:
- items
aroundLatLngViaIP:
type: boolean
description: Whether to obtain the coordinates from the request's IP address.
default: false
x-categories:
- Geo-Search
anchoring:
type: string
description: 'Which part of the search query the pattern should match:
- `startsWith`. The pattern must match the beginning of the query.
- `endsWith`. The pattern must match the end of the query.
- `is`. The pattern must match the query exactly.
- `contains`. The pattern must match anywhere in the query.
Empty queries are only allowed as patterns with `anchoring: is`.
'
enum:
- is
- startsWith
- endsWith
- contains
externalOrdering:
description: Ordering to apply on the injected items coming from the external source. 'default' means the items will be ordered
# --- truncated at 32 KB (130 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/algolia/refs/heads/main/openapi/algolia-composition-api-openapi.yml