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

# Use Workbook Agents in the API

> Create an agent in a workbook, enable it for API use, and manage versions

## Overview

This guide walks through creating a workbook agent called **Attraction Rating** (rates attractions on a 1-10 scale), enabling it for API use, and managing versions.

## 1) Create the agent in a workbook

Open the agent pane and create a new agent.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image1.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=f5a0ecc61878bb7df7779242b631e0a5" alt="Create a new agent from the agent pane" width="2636" height="1494" data-path="images/api_agents/image1.png" />

Add the prompt, then scroll down and click **Add column**.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image2.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=7e816b5a5f7d68f12eb3eff235964f82" alt="Enter the prompt and click Add column" width="2628" height="1488" data-path="images/api_agents/image2.png" />

## 2) Edit the agent settings

After the column is added to the table, click the column header and select **Edit agent**.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image3.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=cb27905330af22c71da46082f9d719a4" alt="Open the column menu and choose Edit agent" width="2634" height="1490" data-path="images/api_agents/image3.png" />

## 3) Enable API usage

In the agent editor, click **Advanced** and then click **Use in API**.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image4.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=cdafcdd921b3a28f9973e9c9fe6b9cc7" alt="Advanced settings with the Use in API button" width="2648" height="1492" data-path="images/api_agents/image4.png" />

This opens the API enablement panel. You can add a description and optionally rename the API attribute. This is a preview of the agent you are adding.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image5.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=98f1e549e48c88847e966c69c50c9efe" alt="Enable API usage panel with name and description" width="2644" height="1488" data-path="images/api_agents/image5.png" />

Scroll down and click **Enable API usage**.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image6.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=d861e475d1a46bc26607905549499d7c" alt="Enable API usage button" width="2642" height="1482" data-path="images/api_agents/image6.png" />

Once enabled, you will see a confirmation that it is ready to use.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image7.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=dfad1be2de5d71e2777a7a4258747a45" alt="API usage enabled confirmation" width="2640" height="1490" data-path="images/api_agents/image7.png" />

## 4) Call the agent from the API

Use the `attribute_key` shown in the UI with the `/enrich` endpoint.

<CodeGroup>
  ```bash cURL theme={null}
  # Use the default version (no version param)
  curl --request POST \
    --url https://api.reprompt.io/v2/enrich \
    --header 'Authorization: Bearer {YOUR_API_KEY}' \
    --header 'Content-Type: application/json' \
    --data '{
      "attribute_key": "attraction_rating",
      "inputs": {
        "name": "Golden Gate Bridge",
        "full_address": "Golden Gate Bridge, San Francisco, CA"
      }
    }'
  ```

  ```bash cURL theme={null}
  # Call a specific version
  curl --request POST \
    --url 'https://api.reprompt.io/v2/enrich?version=1' \
    --header 'Authorization: Bearer {YOUR_API_KEY}' \
    --header 'Content-Type: application/json' \
    --data '{
      "attribute_key": "attraction_rating",
      "inputs": {
        "name": "Golden Gate Bridge",
        "full_address": "Golden Gate Bridge, San Francisco, CA"
      }
    }'
  ```
</CodeGroup>

## 5) Edit the agent and create a new version

To make changes, return to the agent editor, update the prompt, and click **Use in API** again. The text below will show which version you are about to create (for example, “will save as version 2 of Attraction Rating”).

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image8.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=2d9bc83dd5b366b6e599272d6c4e6016" alt="Edit agent prompt and see the next version number" width="2642" height="1492" data-path="images/api_agents/image8.png" />

Click **Save**. The confirmation will show which version will be saved.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image9.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=7dce850c7c663f8855f48d259f8f6a97" alt="Save new version confirmation" width="2638" height="1486" data-path="images/api_agents/image9.png" />

After saving, the agent is ready to use. Any API callers **without** a version parameter will now use the **default** version.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image10.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=c9c2a8154181815d3f33296ff40cd5f3" alt="Agent ready to use with default version behavior" width="2638" height="1488" data-path="images/api_agents/image10.png" />

## 6) Manage default versions

Click **Saved enrichments** to view all versions. The default version is labeled and shows **API enabled**.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image11.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=b033d58c39c128d31b87e540689091d3" alt="Saved enrichments showing default version and API enabled status" width="2644" height="1490" data-path="images/api_agents/image11.png" />

To change the default, find the version you want and click **Set as default**.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image12.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=a714d644977f206f2ca7c34b2063afa4" alt="Set a different version as default" width="2644" height="1498" data-path="images/api_agents/image12.png" />

The header updates to show the new default. Calls without a version parameter will now use this version.

<img src="https://mintcdn.com/syncupai/NfNgkLrYOpmC9sPP/images/api_agents/image13.png?fit=max&auto=format&n=NfNgkLrYOpmC9sPP&q=85&s=c21a14659cd906279070947c5b6fb3aa" alt="Default version updated in the header" width="2642" height="1494" data-path="images/api_agents/image13.png" />
