FTTH Docs API New in 7.2

Your fiber plant documentation through integration: a serviceability check ready for the "do you cover my address?" form on the ISP's website, the plant summary and project management. It is the same API connected servers use between themselves.

Overview

The ftth area of the public API exposes the FTTH Docs module (the fiber plant drawn on the map). The highest-leverage operation is serviceability: a sales portal asks "do you serve this address?" and receives the same three-state verdict as the screen — and every query feeds the pent-up demand map on its own, which is where the network decides to grow.

Prerequisites

  • An API key with the FTTH Docs access permission checked. Keys are created under Settings, Integrations tab, API Management card (only the Master account manages keys Master only). See Creating an API key.
  • FTTH Docs enabled in the plan Plan limit. Without the module in the plan, every operation answers {"status":"error","message":"FTTH module not enabled on this plan"}.
  • Without the permission on the key, the gateway answers HTTP 403 with {"status":"error","message":"Access denied for ftth"}. An invalid token answers HTTP 401.

Call and response format

Every operation uses the single API endpoint, via GET or POST:

Base URL
https://YOUR-SERVER/api/api.php?token=KEY&action=ftth&operation=OPERATION&...

The module answers with the envelope of the newer modules: success is {"status":"success","data":{...}} and business errors come as {"status":"error","message":"..."} with HTTP 200. Only gateway errors (token, permission, action) use HTTP codes 400/401/403.

The FTTH Docs boxes-per-plan ceiling applies to drawing the plant (Basic 500, Normal 1,500, Premium and up unlimited). The operations on this page do not create boxes, so they never consume the ceiling.


Serviceability

GET /api/api.php?action=ftth&operation=viabilidade

Answers "do you serve this address?" with the same three-state verdict as the Serviceability screen. Accepts a direct coordinate or a plain-text address, geocoded by the server with the same cache as the screen.

ParameterTypeRequiredDescription
lat, lngnumberOne of the two modesCoordinate of the queried address.
qstringOne of the two modesPlain-text address (e.g. 100 Main St, Springfield). Used when lat/lng are absent.

Response fields:

  • veredito: atende (a box with a free port exists within the radius), talvez (maybe) or nao (no).
  • atende: the same verdict as a boolean (true only for atende).
  • motivo: empty when served; sem_diagrama (a nearby box has no documented ports yet), sem_porta (boxes in the radius are full) or sem_caixa (nothing within the radius).
  • raio_m: the search radius used, in meters (set in the FTTH Docs settings).
  • caixas: the boxes found within the radius, each with distancia_m, portas_livres, portas_total and documentada.

The response was designed to sell without exposing the plant: boxes come as a distance and port counts, with no internal name or coordinate. And every query is recorded on the module's pent-up demand map — denied ones become the input of the "Where to expand first" panel.

curl
curl -s "https://ravi.yourisp.com/api/api.php?token=YOUR_KEY&action=ftth&operation=viabilidade&q=100+Main+St,+Springfield"
response
{
  "status": "success",
  "data": {
    "veredito": "atende",
    "atende": true,
    "motivo": "",
    "raio_m": 300,
    "caixas": [
      { "distancia_m": 74, "portas_livres": 5, "portas_total": 16, "documentada": true }
    ]
  }
}

An address the geocoder cannot find answers {"status":"error","message":"Address not found"}; a call without a coordinate and without q answers Provide lat/lng or q (address).


Plant queries

GET /api/api.php?action=ftth&operation=resumo

The plant aggregate, without geometry: how many projects exist and how port occupancy stands.

response
{
  "status": "success",
  "data": {
    "projetos": 4,
    "portas": 72,
    "ocupadas": 12,
    "livres": 60,
    "ocupacao_pct": 17,
    "take_rate_pct": null
  }
}

take_rate_pct is only calculated when projects have the homes passed field filled in.

GET /api/api.php?action=ftth&operation=projetos

The project list from the My Projects screen, with each project's numbers. Accepts q to filter by name.

Each project comes with id, nome, descricao, lat/lng/zoom (where the map opens), raio (box service radius, in meters), casas (homes passed), base (base project id, 0 = none), caixas, pops, cabos, metros, dutos, implantado (percentage of deployed or certified boxes; null with no boxes) and alterado.

curl
curl -s "https://ravi.yourisp.com/api/api.php?token=YOUR_KEY&action=ftth&operation=projetos"

Project management

The two write operations cover the project lifecycle itself. Drawing the plant (boxes, cables, diagrams) remains a job for the module's screens.

POST /api/api.php?action=ftth&operation=projeto_salvar

Creates (id=0 or absent) or edits a project, with the same validation as the screen.

ParameterTypeRequiredDescription
idnumberOnly when editingProject to edit; 0 or absent creates a new one.
nomestringYesProject name (up to 120 characters).
descricaostringNoFree description.
lat, lngnumberYes*Project center (where the map opens). *Not needed when area is sent.
zoomnumberNoInitial map zoom (default 15).
areaJSONNoProject territory: a list of points [[lat,lng],...] with 3 or more corners. Center and zoom are then derived from it.
raionumberNoBox service radius, in meters (default 200).
casasnumberNoHomes passed (enables the take rate on the panel).
projeto_basenumberNoId of another project whose drawing shows in this one read-only (shared backbone); 0 = none.
response
{ "status": "success", "data": { "id": 7, "areaOk": true } }

areaOk=false warns that the project was saved but the territory could not be stored (fewer than three valid corners, for instance). Validation errors come in message: nome (missing name) and coordenada (no center and no area).

POST /api/api.php?action=ftth&operation=projeto_excluir

Deletes project id and everything drawn in it — boxes, cables, connections and diagrams. There is no undo.

response
{ "status": "success", "data": { "id": 7 } }

Practical examples

"Do you cover my address?" on the ISP website

The site form sends the typed address and shows the verdict. The website backend calls the API (the key never reaches the browser):

PHP (website backend)
$r = json_decode(file_get_contents(
    'https://ravi.yourisp.com/api/api.php?token=' . $KEY .
    '&action=ftth&operation=viabilidade&q=' . urlencode($_POST['address'])
), true);

if (($r['data']['veredito'] ?? '') === 'atende') {
    // show "We cover your address!" and open the signup
} elseif (($r['data']['veredito'] ?? '') === 'talvez') {
    // "We are getting to your area" + capture the contact
} else {
    // capture the contact: the query already entered the module's demand map
}

Creating a project through integration

curl
curl -s -X POST "https://ravi.yourisp.com/api/api.php" \
  -d "token=YOUR_KEY" -d "action=ftth" -d "operation=projeto_salvar" \
  -d "nome=New District" -d "lat=-23.4210" -d "lng=-51.9331" -d "raio=200"

Troubleshooting

SymptomLikely cause
HTTP 403 Access denied for ftthThe key exists, but the FTTH Docs access permission is not checked. The Master account adjusts the key under Settings, Integrations tab.
FTTH module not enabled on this planThe server's plan does not include the module (or the server has no active plan).
Address not found on serviceabilityThe geocoder could not locate the address. Try including city and state, or send lat/lng directly.
Serviceability answers talvez with sem_diagramaThere is a box nearby, but it has no ports documented in the diagrams yet. Document the box and the verdict starts counting its ports.
projeto_salvar answers coordenadaThe call brought neither lat/lng nor a valid area with 3+ corners.

Best practices: use HTTPS and POST for mutations (the key travels in the request); create a dedicated key for the website with only FTTH Docs access checked; and call serviceability from your backend, never from the visitor's browser.