# 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, for example an order lookup. Save it once, then use it wherever Robylon needs to reach that system. See [where you can use an API](#where-apis-are-used).

Open them from [**Settings → Data & Developer → APIs**](https://app.robylon.ai/settings/apis).

## APIs 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.

## APIs from connected integrations

Connecting Shopify, Shiprocket, ClickPost, GoKwik or Return Prime adds ready-made APIs to this list, named after the app and the action, for example "Shopify - Cancel order". Edit, test and use them like any API you create yourself. Robylon never overwrites an API that already exists. See [Shopify](https://www.robylon.ai/docs/integrations/shopify#apis-and-variables-from-shopify) and [ClickPost, Shiprocket, GoKwik and Return Prime](https://www.robylon.ai/docs/integrations/shipping-returns-checkout#what-connecting-creates).

## Where APIs are used

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-the-api-block-works) |
| **Simple automations** | Add a **Call API** step. | [Simple automation steps](https://www.robylon.ai/docs/simple-automations/create#steps) |
| **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) |

## Create an API

<Steps>
  <Step title="Open APIs">
    Go to [**Settings → Data & Developer → APIs**](https://app.robylon.ai/settings/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) 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. When a capture path does not match the response, Robylon saves an empty value to that variable and carries on, so the step does not fail.
  </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 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.
