FreePBX Middleware API Documentation

Welcome to the API documentation for the FreePBX Middleware system. This API facilitates data ingestion from FreePBX and data consumption for PowerBI.

Authentication

This API acts as a secure middleware and requires a Bearer Token for all requests. This ensures that only authorized services (FreePBX, PowerBI) can access the data.

How to Authenticate

You must include the Authorization header in every HTTP request with your secret token.

Authorization: Bearer YOUR_SECURE_TOKEN

Note: The token is generated securely by the system administrator and is not publicly available. If you lose your token, please contact the administrator to generate a new one from the server environment.

Rate Limiting & Usage Guidelines

To ensure system stability, the API enforces the following limits:

PowerBI Best Practices

Endpoints

1. Ingest Data SECURE

POST /api/v1/ingest

Uploads call data from FreePBX. Rejects duplicates based on call_id.

Request Body

[
  {
    "call_id": "1769504531.76688",
    "caller_id": "0946955993",
    "timestamp": "2026-01-27 11:02:29",
    "selections": [
      {
        "sequence": 1,
        "stage": "City-Tripoli",
        "dtmf": "1",
        "timestamp": "2026-01-27 11:02:29"
      }
    ]
  }
]

2. Consumption Data (PowerBI) SECURE

GET /api/v1/data

Fetches flattened call data suitable for PowerBI ingestion.

Query Parameters

Response Format (Flat JSON)

[
  {
    "call_id": "1769504531.76688",
    "caller_id": "0946955993",
    "call_timestamp": "2026-01-27T11:02:29.000Z",
    "selection_sequence": 1,
    "selection_stage": "City-Tripoli",
    "selection_dtmf": "1",
    "selection_timestamp": "2026-01-27T11:02:29.000Z"
  }
]

3. Application Settings SECURE

Manage global application settings dynamically without restarting.

GET /api/v1/settings

Retrieve current status of ingestion and consumption APIs.

{
  "ingestion_enabled": true,
  "consumption_enabled": true
}

PUT /api/v1/settings

Enable or disable specific APIs. Useful for maintenance or pausing data flow.

Request Example (Disable Ingestion)
{
  "ingestion_enabled": false
}
Request Example (Enable everything)
{
  "ingestion_enabled": true,
  "consumption_enabled": true
}

Try it out: Update Settings