# APIs: Connect Robylon to Your Systems

Save HTTP requests to your own systems or third-party services, use them in tools, workflows, simple automations and macros, and set how failed requests are retried.

> Source: https://www.robylon.ai/docs/data-and-integrations/apis
> Section: Data and tools

An API in Robylon is a saved HTTP request to one of your systems or a third-party service, such as an order lookup or a ticket update. Save it once, then use it wherever Robylon needs to reach that system. See [where you can use an API](#where-can-i-use-an-api).

Open them from **Settings → Data & Developer → APIs**.

## What is an API in Robylon?

An API is a saved request: the method, URL, headers, parameters and body, plus which parts of the response to keep. Save it once and reuse it in tools and in the [API block](https://www.robylon.ai/docs/product/dev-notes) of any workflow.

The APIs list shows each API's name, endpoint, number of mock responses, number of calls, and when it was last updated.

## Where can I use an API?

Once saved, the same API can be used in four places:

| Where | How | Guide |
| --- | --- | --- |
| **AI agents** | Wrap the API in a tool, so the agent calls it during a conversation. | [Tools](https://www.robylon.ai/docs/data-and-integrations/api-tools-functions) |
| **Workflows** | Call it from the **API** block. | [Dev blocks](https://www.robylon.ai/docs/product/dev-notes#how-does-the-api-block-work) |
| **Simple automations** | Add a **Call API** step. | [Simple automation steps](https://www.robylon.ai/docs/simple-automations/create#which-steps-can-i-add) |
| **Macros** | Add a **Call API** action. Agents then run it from a conversation with **Run macro**, and the macro panel shows the APIs it called. | [Macros](https://www.robylon.ai/docs/inbox/macros) |

## How do I create an API?

<Steps>
  <Step title="Open APIs">
    Go to **Settings → Data & Developer → APIs** and click **Create API**.
  </Step>
  <Step title="Name the request">
    Enter the **Name of the API**, for example "Get order status".
  </Step>
  <Step title="Set the method and URL">
    Choose the **Request** method (**GET**, **POST**, **PUT**, **DELETE** or **PATCH**) and enter the URL. Put variable parts in curly braces, for example `https://yourstore.com/api/orders/{order_id}`.
  </Step>
  <Step title="Add headers, parameters and body">
    Fill in the **Headers**, **Parameters** and **Body** tabs. Insert [credentials](https://www.robylon.ai/docs/data-and-integrations/secrets-keys) such as API tokens as variables instead of pasting the value.
  </Step>
  <Step title="Map inputs and capture the response">
    Use **Map Variables** to connect the request's placeholders to variables, and **Capture Response** to save fields from the response into variables.
  </Step>
  <Step title="Test and save">
    Click **Test API** to send a real request and check the response, then click **Save**.
  </Step>
</Steps>

<Tip>
Add **Mock Responses** with example responses. They let you test agents and workflows that use the API without calling your live system.
</Tip>

## How do retries work?

**Enable automatic retries** is on for a new tool. You can set:

| Setting | What it does | New tool |
| --- | --- | --- |
| Request Timeout | How long one attempt can take. | 120 seconds |
| Retry on Status Codes | Which HTTP status codes trigger a retry. If you leave it empty, Robylon retries on 408, 429, 500, 502, 503 and 504. | Empty |
| Max Retries | How many times to retry, from 1 to 5. | 3 |
| Strategy | **Fixed Interval**, **Exponential Backoff** or **Exponential + Jitter**. | Exponential Backoff |
| Initial Delay, Multiplier, Max Delay | How long to wait before the first retry, how much longer each next wait is (1.5X to 4X), and the longest wait. | 1 second, 2X, 30 seconds |

Only retry requests that are safe to repeat. Retrying a "create refund" call can create two refunds.
