---
title: "Middleware API"
description: "Reference for the Middleware public API: where to find the OpenAPI spec, the base URL and how to authenticate."
section: "API"
breadcrumb: "API > Middleware API"
canonical: "https://docs.middleware.io/public-api/api"
---
# Middleware API

Every public API endpoint, with its parameters and responses, is defined in the spec:

**https://app.middleware.io/swagger.json** (Swagger 2.0, JSON)

The spec is large, so read only the operations you need:

```bash
# List all endpoints
curl -s https://app.middleware.io/swagger.json | jq -r '.paths | keys[]'

# Read one endpoint
curl -s https://app.middleware.io/swagger.json | jq '.paths["/agent/hosts"]'
```

## Base URL

```text
https://<project_domain>/api/v1
```

## Authentication

Create an API key under **Settings → API Keys**, then send it in either header:

```text
ApiKey: <api_key>
Authorization: ApiKey <api_key>
```

Don't use the project API key from agent installation. That key is for sending data to Middleware.
