> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Enrich your records with Fetch

> Enrich your records with Fetch Helper Functions.

export const Application = () => <Tooltip tip="An Algolia application is a self-contained environment with its own indices, configuration, and API keys. Applications don't share data or settings with each other.">
    application
  </Tooltip>;

Fetch lets you enrich your Algolia data directly within a code transformation.
Using a JavaScript function within your transformation, you can retrieve information from third-party APIs to enhance the quality and relevance of your search results.

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.

<Callout icon="credit-card" color="#c084fc">
  This feature isn't available on every plan.
  Refer to your [pricing plan](https://www.algolia.com/pricing) to see if it's included.
</Callout>

## Create a code transformation

1. Go to the [Algolia dashboard](https://dashboard.algolia.com/explorer/browse) and select your Algolia <Application />.
2. On the left sidebar, select <Icon icon="database" /> **Data sources**.
3. Open the [**Connectors**](https://dashboard.algolia.com/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

{/* vale Google.WordList = NO */}

<Note>
  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.
</Note>

{/* vale Google.WordList = YES */}

1. Retrieve the secret from the third-party API.
2. In [your code transformation](#create-a-code-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.

```js JavaScript theme={"system"}
const mySecretValue = helper.secrets.get("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](https://openai.com/api/) API key to use this function. For more information, see the [OpenAI text generation documentation](https://platform.openai.com/docs/guides/text-generation). |
| 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](https://platform.openai.com/docs/guides/vision).                                  |
| Convert currency         | Convert a currency to another. You need a [CurrencyAPI](https://currencyapi.net/) API key to use this function. For more information, see the [CurrencyAPI documentation](https://currencyapi.net/documentation) .                          |
| Translate text           | Translate text from one language to another. You need a [DeepL](https://www.deepl.com/en/products/api) API key to use this function. For more information, see the [DeepL documentation](https://currencyapi.net/documentation).            |

### Generic 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](https://wikipedia.org/wiki/Basic_access_authentication). |

<Check>
  There's a [timeout and response size limit](/doc/guides/scaling/algolia-service-limits#data-transformation-and-fetch-limits) on all transformations that include Fetch requests.
</Check>
