Skip to main content

Bridge API

Send and receive messages through the agent bridge, a private message bus used for coordination between agents and operators. Messages are organized by channel and include unread tracking per reader.

Authentication

All bridge endpoints require the X-Bridge-Secret header for authentication in production environments.
HeaderTypeRequiredDescription
X-Bridge-SecretstringYesShared secret for authenticating bridge requests. Must match the server-configured BRIDGE_SECRET value.
When no BRIDGE_SECRET is configured on the server (e.g. in local development), authentication is bypassed and requests are allowed without the header.
If the header is missing or the value does not match, the endpoint returns:
{
  "error": "unauthorized"
}
CodeDescription
401Missing or invalid X-Bridge-Secret header

Send a message

POST /api/bridge/send
Sends a message to a bridge channel.

Request body

FieldTypeRequiredDescription
senderstringYesIdentity of the message sender. Must be one of: atlas-main, atlas-agentbot, eskyee.
contentstringYesMessage content
channelstringNoTarget channel. One of general, tasks, alerts. Defaults to general.
prioritystringNoMessage priority. Defaults to normal.

Response

{
  "ok": true,
  "message": {
    "id": "clxyz123",
    "sender": "atlas-main",
    "channel": "general",
    "priority": "normal",
    "created_at": "2026-03-29T22:00:00.000Z"
  }
}
FieldTypeDescription
okbooleantrue when the message was sent successfully
message.idstringUnique message identifier
message.senderstringSender identity
message.channelstringChannel the message was sent to
message.prioritystringMessage priority level
message.created_atstringISO 8601 timestamp when the message was created

Errors

CodeDescription
401Missing or invalid X-Bridge-Secret header
400sender and content are required — the sender or content field is missing from the request body
400invalid sender — the sender value is not one of the allowed identities
500Failed to send message

Example

curl -X POST /api/bridge/send \
  -H "Content-Type: application/json" \
  -H "X-Bridge-Secret: your-bridge-secret" \
  -d '{
    "sender": "atlas-main",
    "channel": "tasks",
    "content": "Deploy staging environment",
    "priority": "normal"
  }'

Get inbox messages

GET /api/bridge/inbox
Retrieves unread messages from a bridge channel. Messages are automatically marked as read for the specified reader after retrieval.

Query parameters

ParameterTypeRequiredDescription
channelstringNoChannel to read from. Defaults to general.
sincestringNoISO 8601 timestamp. Only return messages created after this time. Defaults to the last 24 hours.
readerstringNoIdentity of the reader. Used for unread tracking. Messages already read by this reader are excluded. Defaults to unknown.
limitnumberNoMaximum number of messages to return. Defaults to 50, maximum 100.

Response

{
  "ok": true,
  "channel": "general",
  "count": 2,
  "messages": [
    {
      "id": "clxyz123",
      "sender": "atlas-agentbot",
      "channel": "general",
      "content": "Deployment complete",
      "priority": "normal",
      "created_at": "2026-03-29T22:00:00.000Z"
    }
  ]
}
FieldTypeDescription
okbooleantrue when the request succeeded
channelstringChannel that was queried
countnumberNumber of messages returned
messagesarrayList of message objects, sorted by creation time ascending

Message object

FieldTypeDescription
idstringUnique message identifier
senderstringIdentity of the message sender
channelstringChannel the message belongs to
contentstringMessage content
prioritystringMessage priority level
created_atstringISO 8601 timestamp when the message was created
Messages are marked as read by the specified reader after retrieval. Subsequent requests with the same reader value will not return those messages again. When reader is set to unknown, messages are not marked as read.

Errors

CodeDescription
401Missing or invalid X-Bridge-Secret header
500Failed to fetch messages

Example

curl -H "X-Bridge-Secret: your-bridge-secret" \
  "/api/bridge/inbox?channel=tasks&reader=atlas-main&limit=10"

Bridge health

GET /api/bridge/health
Returns the current status of the bridge message bus, including total message count, last message metadata, and available channels.

Response

{
  "status": "ok",
  "total_messages": 42,
  "last_message": {
    "created_at": "2026-03-29T22:00:00.000Z",
    "sender": "atlas-agentbot",
    "channel": "general"
  },
  "channels": ["general", "tasks", "alerts"],
  "senders": ["atlas-main", "atlas-agentbot", "eskyee"],
  "timestamp": "2026-03-29T22:05:00.000Z"
}
FieldTypeDescription
statusstringok when the bridge is operational
total_messagesnumberTotal number of messages stored in the bridge
last_messageobject | nullMetadata for the most recent message, or null if no messages exist
last_message.created_atstringISO 8601 timestamp of the last message
last_message.senderstringSender of the last message
last_message.channelstringChannel of the last message
channelsarrayAvailable bridge channels
sendersarrayAllowed sender identities
timestampstringISO 8601 timestamp of the health check

Error response

{
  "status": "error",
  "error": "database unreachable"
}
CodeDescription
200Bridge health check succeeded
401Missing or invalid X-Bridge-Secret header
500Database is unreachable

Example

curl -H "X-Bridge-Secret: your-bridge-secret" \
  "/api/bridge/health"