Skip to main content
Version: 0.0.4

REST API

Flecto Manager provides a REST API for agents to sync configurations.

Base URL

https://your-manager.example.com/api

Endpoints

Get Project Version

Check if the project configuration has changed.

GET /api/namespace/:namespace/project/:project/version
Authorization: Bearer <token>

Response:

"1"

The version string changes whenever redirects or pages are published. Agents can use this to determine if they need to fetch updated configurations.


Get Redirects

Fetch all published redirects for a project.

GET /api/namespace/:namespace/project/:project/redirects
Authorization: Bearer <token>

Query Parameters:

ParameterTypeDefaultDescription
limitint500Maximum number of items to return
offsetint0Number of items to skip

Response:

{
"items": [
{
"type": "BASIC",
"source": "/old-page",
"target": "/new-page",
"status": "MOVED_PERMANENT"
},
{
"type": "BASIC_HOST",
"source": "example.com/shop",
"target": "https://shop.example.com",
"status": "FOUND"
},
{
"type": "REGEX",
"source": "^/blog/([0-9]+)/(.*)$",
"target": "/articles/$1/$2",
"status": "MOVED_PERMANENT"
}
],
"total": 3,
"limit": 500,
"offset": 0
}

Get Pages

Fetch all published pages for a project.

GET /api/namespace/:namespace/project/:project/pages
Authorization: Bearer <token>

Query Parameters:

ParameterTypeDefaultDescription
limitint500Maximum number of items to return
offsetint0Number of items to skip

Response:

{
"items": [
{
"type": "BASIC",
"path": "/robots.txt",
"content": "User-agent: *\nAllow: /",
"contentType": "TEXT_PLAIN"
},
{
"type": "BASIC_HOST",
"path": "shop.example.com/robots.txt",
"content": "User-agent: *\nDisallow: /checkout/",
"contentType": "TEXT_PLAIN"
}
],
"total": 2,
"limit": 500,
"offset": 0
}

Register/Update Agent

Register an agent or update its information.

POST /api/namespace/:namespace/project/:project/agents
Authorization: Bearer <token>
Content-Type: application/json

{
"name": "traefik-eu-1",
"type": "traefik",
"version": 1,
"status": "success",
"load_duration": 150000000,
"error": ""
}

Request Body:

FieldTypeRequiredDescription
namestringYesAgent name (alphanumeric, underscores, hyphens only)
typestringYesAgent type: default or traefik
versionintYesConfiguration version loaded by the agent
statusstringNoSync status: success or error
load_durationintNoTime to load configuration in nanoseconds
errorstringNoError message if status is error

Response:

HTTP/1.1 200 OK

Agent Heartbeat

Update the agent's last seen timestamp.

PATCH /api/namespace/:namespace/project/:project/agents/:name/hit
Authorization: Bearer <token>

Response:

HTTP/1.1 200 OK

Health Check

Check if the Manager is running.

GET /health/ping

Response:

HTTP/1.1 204 No Content

Data Types Reference

Redirect Types

TypeDescription
BASICExact path matching
BASIC_HOSTExact path matching with host (source includes host)
REGEXRegular expression matching on path
REGEX_HOSTRegular expression matching with host

Redirect Status

StatusHTTP Code
MOVED_PERMANENT301
FOUND302
TEMPORARY_REDIRECT307
PERMANENT_REDIRECT308

Page Types

TypeDescription
BASICExact path matching
BASIC_HOSTExact path matching with host (path includes host)

Page Content Types

Content TypeMIME Type
TEXT_PLAINtext/plain
XMLapplication/xml

Pagination

List endpoints support pagination:

GET /api/namespace/prod/project/website/redirects?limit=100&offset=200

Check the total field to determine if more items exist:

{
"items": [...],
"total": 350,
"limit": 100,
"offset": 200
}

If offset + items.length < total, more items are available.