> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.fabricgateway.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.fabricgateway.ai/_mcp/server.

# Connect a REST API

> Import an OpenAPI spec to connect a REST API as a service and generate its routes.

**Services** connects plain HTTP APIs the same way you connect LLM providers and MCP servers. You add a connection, and then import an OpenAPI spec to generate its routes automatically. This topic shows you how to add a connection, import a spec, review the plan, publish it, and update the routes later.

## Prerequisites

Before you begin, make sure you have the following:

* Access to a Fabric AI Gateway organization, with permission to create connections.
* An OpenAPI document for the API, in JSON or YAML.

## Add a connection

You start from **Create connection**. To add a REST API connection, do the following:

1. In the sidebar, select **Services**.
2. Select **Create connection**. The **Add connection** page opens.
3. Under the connection type, select the HTTP type that matches your API.
4. To generate the connection and its routes from an OpenAPI document, select **Import an OpenAPI spec**, and then follow [Import an OpenAPI spec](#import-an-openapi-spec).
5. To add the connection yourself, enter a **Name** and the **Target URL** of your API, optionally set the **Upstream auth requirement**, and then select **Add Connection**.

## Import an OpenAPI spec

**Import an OpenAPI spec** is a three-step wizard. It opens when you select **Import an OpenAPI spec** on the **Add connection** page.

### Step 1: Provide the spec

Paste or upload a JSON or YAML OpenAPI document. Under **Import mode**, select one of the following:

| Import mode   | Behavior                                                                                    |
| ------------- | ------------------------------------------------------------------------------------------- |
| **Merge**     | Adds and updates routes from the spec, and leaves routes that aren't in the spec untouched. |
| **Overwrite** | Matches the spec exactly, and removes any routes that aren't in it.                         |

Optionally, expand **Advanced settings** to set the following:

* **Import ID** — A stable identifier, so re-imports keep updating the same API instead of creating a new one.
* **Route prefix** — Mounts every route from the spec under a path prefix. Fabric strips the prefix before it forwards the request upstream, so multiple imported APIs don't collide.
* **Upstream URL override** — Overrides the base URL for the upstream service.

### Step 2: Review the plan

Review the plan before you publish anything. The plan shows which service Fabric creates or updates, how many routes are new, changed, or unchanged, and the exact route paths and methods.

Imported services don't get gateway-managed authentication by default. Callers pass their own credentials through to the upstream unless you add an upstream credential on the **Credentials** page after you publish. For the steps, see [Manage credentials and vaults](/fabric/administration/credentials).

### Step 3: Publish

Click **Publish** to apply the plan.

## Re-import to update routes

Re-importing an updated spec in **Merge** mode applies incremental updates. For example, adding a `PUT` operation to an existing path and adding a new path produces a plan that shows 1 new, 1 changed, and 3 unchanged routes, with an option to expand and view the unchanged ones.

Routes from multiple imports appear together under **Services** > **Routes**. For example, two services imported from the same spec at different times can contribute a combined 10 routes across `albums`, `comments`, `posts` (with both `GET` and `PUT`), `todos`, and `users`.

## Next steps

* To add authentication, rate limiting, or transforms to the imported routes, see [Control traffic with plugins](/fabric/plugins).
* To monitor traffic on the imported routes, see [Monitor gateway traffic](/fabric/observability).