> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pidgeon.health/llms.txt
> Use this file to discover all available pages before exploring further.

# Loft Interfaces

> CRUD operations and metrics for monitored healthcare integration interfaces.

Manage monitored interfaces. All endpoints are **public**.

## GET /api/loft/interfaces

List all interfaces.

```bash curl theme={null}
curl http://localhost:5100/api/loft/interfaces
```

## POST /api/loft/interfaces

Create a new interface.

| Field           | Type   | Default   | Description                    |
| --------------- | ------ | --------- | ------------------------------ |
| `name`          | string | Required  | Display name                   |
| `directoryPath` | string | Required  | Filesystem path to watch       |
| `profileName`   | string | —         | Vendor profile for validation  |
| `filePattern`   | string | `"*.hl7"` | Glob pattern for message files |

```bash curl theme={null}
curl -X POST http://localhost:5100/api/loft/interfaces \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ER Interface",
    "directoryPath": "/var/loft/er",
    "profileName": "epic_er",
    "filePattern": "*.hl7"
  }'
```

## GET /api/loft/interfaces/{id}

Get interface by ID.

```bash curl theme={null}
curl http://localhost:5100/api/loft/interfaces/intf-001
```

## PUT /api/loft/interfaces/{id}

Update an interface. All fields optional.

| Field         | Type    | Description               |
| ------------- | ------- | ------------------------- |
| `name`        | string  | Updated display name      |
| `profileName` | string  | Updated vendor profile    |
| `filePattern` | string  | Updated file pattern      |
| `enabled`     | boolean | Enable/disable monitoring |

```bash curl theme={null}
curl -X PUT http://localhost:5100/api/loft/interfaces/intf-001 \
  -H "Content-Type: application/json" \
  -d '{"enabled": false}'
```

## DELETE /api/loft/interfaces/{id}

Delete an interface.

```bash curl theme={null}
curl -X DELETE http://localhost:5100/api/loft/interfaces/intf-001
```

## GET /api/loft/interfaces/{id}/metrics

Get interface metrics.

| Query Param  | Type | Default | Description      |
| ------------ | ---- | ------- | ---------------- |
| `sinceHours` | int  | `24`    | Hours of history |

```bash curl theme={null}
curl "http://localhost:5100/api/loft/interfaces/intf-001/metrics?sinceHours=12"
```

Response includes `messagesTotal`, `messagesSuccessful`, `messagesFailed`, `successRate`, `averageLatencyMs`, `p99LatencyMs`.
