---
title: "How to Configure and Test an API Action"
description: "Summary This article explains how to configure, test, and save an API action after it has been defined. It covers adding input fields, setting up the API request URL, testing the API connection, and verifying the entire action with a test agent."
canonical_url: "https://help.brainfi.sh/articles/how-to-configure-and-test-an-api-action-ffnFYvcTkY"
md_url: "https://help.brainfi.sh/articles/how-to-configure-and-test-an-api-action-ffnFYvcTkY.md"
---
# How to Configure and Test an API Action

**Summary** This article explains how to configure, test, and save an API action after it has been defined. It covers adding input fields, setting up the API request URL, testing the API connection, and verifying the entire action with a test agent.

**When to Use This** Follow this guide after you have already created and defined your API action. These steps are necessary to connect the action to a live API endpoint and ensure it retrieves the correct information based on user input.

**Step-by-Step Instructions**


1. After defining your action, proceed to the **Configure API** screen.
2. Click **Add Inputs** to create fields for the information you need to collect from the user (e.g., a first name or phone number).
3. Configure the input by providing an **Input Name** and a **Label**.
4. Paste the API endpoint into the **URL** field.
5. Select the appropriate **Method** (e.g., GET) and **Content Type** (e.g., JSON).
6. Insert the input variable you created into the URL by typing `@` and selecting the variable name. This will pass the user's input to the API.
7. Click **Test API** to verify the configuration. Enter a sample value to ensure the API returns a successful response (e.g., a 200 OK status).
8. Once the test is successful, click **Save**.
9. Use the **Test Agent Action** panel to test the complete flow. Type a question that matches the action's intent. The agent should prompt you to fill in the input field you configured.

**Common Questions (FAQs)** **Q: How do I pass user information to the API?** A: First, create an input field. Then, in the URL field, type the `@` symbol and select the name of your input variable to insert it as a parameter in the API request.

**Q: What is the 'Test API' button for?** A: It allows you to check if your API configuration is correct by sending a request with a test value. This helps you confirm that the endpoint is reachable and the response is what you expect before saving the action.

**Troubleshooting Tips**

* **API Test Fails:** If the API test fails, double-check that the URL is correct and that the input variable is properly placed. Verify that your API method (GET, POST, etc.) is correct.
* **Agent Doesn't Ask for Input:** If the test agent doesn't prompt for the required input, ensure the action's description accurately describes the user's intent and that the input field is correctly configured and saved.
