# REST APIs (OpenAPI)

Many internal and SaaS APIs have no MCP server but do publish an OpenAPI document. Godelgate turns each operation into a tool.

## Add one

On Cloud, open **Servers → Add server → REST API** and enter:

- **OpenAPI document URL:** JSON or YAML, OpenAPI 3 or Swagger 2.
- **API base URL** (optional): where calls go. By default, the first `servers` entry in the document.
- **Token in a header** (optional): sent with every request, for example `Authorization: Bearer …`.

Self-hosted:

```yaml
servers:
  - name: billing
    openapi:
      spec: https://api.example.com/openapi.json
      baseUrl: https://api.example.com/v1
    headers: { Authorization: "Bearer ${BILLING_TOKEN}" }
    labels:
      "get*": [private]
      "create*": [egress]
```

## How operations become tools

| OpenAPI | Tool |
| --- | --- |
| `operationId` | Tool name (otherwise `method_path`) |
| `summary`, `description` | Description, with the method and path |
| Path, query and header parameters | Input properties; path parameters are required |
| JSON request body | A `body` property with the body's schema |
| `GET` / `DELETE` | Marked read-only / destructive |

Local `$ref`s are resolved. Responses are returned as text, up to 100 KB; a non-2xx status is returned as an error with the status code. Up to 300 operations per document.
