Lunar Flows API
Manage Lunar Flows (streams-based traffic shaping rules)
Manage Lunar Flows (streams-based traffic shaping rules)
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/lunar-flows-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Lunar Flows API
version: 1.0.0
description: 'Operations tagged Flows across 2 of this provider''s published API definitions: lunar-api-consumption-gateway-openapi.yml, lunar-gateway-admin-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: http://localhost:{adminPort}
description: Lunar Engine Admin API (local)
variables:
adminPort:
default: '8081'
description: Admin port set via ENGINE_ADMIN_PORT environment variable
- url: http://localhost:8040
description: Gateway Admin Health Server
- url: http://localhost:8081
description: Gateway Admin Engine Server
tags:
- name: Flows
description: Manage Lunar Flows (streams-based traffic shaping rules)
paths:
/load_flows:
post:
operationId: loadFlows
summary: Reload flows configuration from disk
description: Triggers an in-process reload of the Flows configuration from the file system. Used after flows YAML files have been updated on disk. Requires the gateway to be running in streams (flows) mode.
tags:
- Flows
responses:
'200':
description: Flows loaded successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
example:
msg: Successfully loaded flows
'400':
description: Failed to reload flows
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'405':
description: Method not allowed
servers:
- url: http://localhost:{adminPort}
description: Lunar Engine Admin API (local)
variables:
adminPort:
default: '8081'
description: Admin port set via ENGINE_ADMIN_PORT environment variable
/validate_flows:
post:
operationId: validateFlows
summary: Validate flows configuration
description: Performs a dry-run validation of the current flows YAML configuration without applying changes. Returns validation errors if the configuration is invalid.
tags:
- Flows
responses:
'200':
description: Flows validation succeeded
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
example:
msg: Validation succeeded
'422':
description: Validation failed with details
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'405':
description: Method not allowed
servers:
- url: http://localhost:{adminPort}
description: Lunar Engine Admin API (local)
variables:
adminPort:
default: '8081'
description: Admin port set via ENGINE_ADMIN_PORT environment variable
/apply_flows:
put:
operationId: applyFlows
summary: Apply flows configuration payload
description: Applies a new flows configuration payload sent in the request body. The payload is parsed, saved to disk, and the flows engine is reloaded. On failure, the previous configuration is restored. Only one apply operation may run at a time (returns 423 if already processing).
tags:
- Flows
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/FlowsConfigurationPayload'
responses:
'200':
description: Flows configuration update initiated
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
example:
msg: Lunar Gateway config is being updated...
'400':
description: Failed to decode or parse incoming data
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'422':
description: Failed to apply or reload flows
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'423':
description: Another apply flows request is already in progress
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal error saving or backing up configuration
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
operationId: applyFlows
summary: Lunar.dev Apply flows
description: Applies the current flow configuration files to the running Lunar Gateway instance. Flows define traffic management rules including rate limiting, caching, retry mechanisms, quota enforcement, and request prioritization.
tags:
- Flows
responses:
'200':
description: Flows applied successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/OperationResult'
'400':
description: Invalid flow configuration.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
servers:
- url: http://localhost:{adminPort}
description: Lunar Engine Admin API (local)
variables:
adminPort:
default: '8081'
description: Admin port set via ENGINE_ADMIN_PORT environment variable
/on_haproxy_error:
put:
operationId: reportHAProxyError
summary: Report HAProxy transaction errors
description: Called by HAProxy to notify the engine of failed transactions. The engine uses this to trigger error-handling logic within the active flows/streams.
tags:
- Flows
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/OnErrorPayload'
responses:
'200':
description: Error logged successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
example:
msg: Error logged successfully
'400':
description: Failed to decode incoming error data
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'405':
description: Method not allowed
servers:
- url: http://localhost:{adminPort}
description: Lunar Engine Admin API (local)
variables:
adminPort:
default: '8081'
description: Admin port set via ENGINE_ADMIN_PORT environment variable
components:
schemas:
FlowsConfigurationPayload:
type: object
description: Configuration payload for the /apply_flows endpoint. Contains flow definitions to be applied to the gateway. The exact structure is defined by the Lunar Flows YAML schema.
additionalProperties: true
OnErrorPayload:
type: object
description: Payload from HAProxy reporting failed transactions
properties:
failedTransactions:
type: object
description: Map of failed transaction IDs to error details
additionalProperties:
type: object
additionalProperties: true
required:
- failedTransactions
SuccessResponse:
type: object
description: Generic success message response
properties:
msg:
type: string
description: Human-readable success message
required:
- msg
ErrorResponse:
type: object
description: Error response with message and optional error detail
properties:
msg:
type: string
description: Human-readable error message
error:
type: string
description: Underlying error string
required:
- msg
OperationResult:
type: object
properties:
status:
type: string
description: Result status of the operation.
examples:
- ok
message:
type: string
description: Human-readable message about the operation result.
ValidationResult:
type: object
properties:
valid:
type: boolean
description: Whether the configuration is valid.
errors:
type: array
description: List of validation errors found, if any.
items:
type: string
Error:
type: object
properties:
error:
type: string
description: Error message describing what went wrong.
details:
type: string
description: Additional details about the error.
x-refined-from:
- lunar-api-consumption-gateway-openapi.yml
- lunar-gateway-admin-openapi.yml