Guides / Sending and managing data / Send and update your data

Enrich your records with Fetch

Fetch lets you enrich your Algolia data directly within your transformation pipeline. Using a JavaScript function within your transformation step, you can retrieve information from third-party APIs to enhance the quality and relevance of your search results. Algolia Fetch is only available on certain pricing plans.

Using Fetch affects your record ingestion rate. To avoid slowing down your indexing process, ensure you use third-party APIs that are fast and reliable. Use Fetch for operations that can be completed quickly.

Create a transformation

  1. Go to the Algolia dashboard and select your Algolia application.
  2. On the left sidebar, select Data sources.
  3. Open the Connectors page.
  4. Select a connector and click Connect to start creating your task.
  5. Create a new source or select an existing one.
  6. To create a transformation function, click Create transformation.

Retrieve and store secrets

To call an external API, you typically need an API key or other credential type (such as basic access authentication or OAuth 2.0). You can store these credentials as a secret and reference them in your transformation code.

  1. Retrieve the secret from the third-party API.
  2. In your transformation, click Secret.
  3. Paste in the third-party API key, give it name, then click Add.

You can now add the secret to your transformation code.

1
const mySecretValue = helper.getSecret("mySecretName");

How to use Fetch Helper Functions

  1. Click Helper Functions.
  2. Select Fetch / API
  3. Select a helper and click Add.

You can either use third-party APIs directly or use a generic Fetch function.

Third-party APIs

Helper Description
OpenAI - Text Generation Generate text based on a prompt. You need an OpenAI API key to use this function. For more information, see the OpenAI text generation documentation.
OpenAI - Vision Generate a description or tags for an image. You need an OpenAI API key to use this function. For more information, see the OpenAI vision documentation.
Convert currency Convert a currency to another. You need a CurrencyAPI API key to use this function. For more information, see the CurrencyAPI documentation .
Translate text Translate text from one language to another. You need a DeepL API key to use this function. For more information, see the DeepL documentation.

Generic Fetch function

This function lets you connect to any service with an API.

Helper type Description
Fetch with API key (in header) Connect to any service with an API key in the header.
Fetch with API key (in URL) Connect to any service with an API key in the query.
Fetch with Basic Auth Connect to any service with basic access authentication.

There’s a timeout and response size limit on all transformations that include Fetch requests.

Did you find this page helpful?