Skip to main content

REST API Guide

← Back to Main Documentation

This guide provides comprehensive documentation for the OmniSS7 REST API and Swagger UI.

Table of Contents

  1. Overview
  2. HTTP Server Configuration
  3. Swagger UI
  4. API Endpoints
  5. Worked Examples
  6. Authentication
  7. Response Formats
  8. Error Handling
  9. Metrics (Prometheus)
  10. Example Requests

Overview

OmniSS7 exposes a REST API on port 8080 for driving MAP (Mobile Application Part) and CAP (CAMEL Application Part) operations over the SS7 network, plus raw SCCP/M3UA injection for testing. The API handler (APIhandler, lib/ss7_web/apihandler.ex) defines 47 POST /api/* operation endpoints alongside the metrics and Swagger endpoints. It allows you to:

  • Trigger MAP requests (mobility, SMS, authentication, subscriber data, supplementary services, location services, GPRS, equipment)
  • Drive CAP/CAMEL call-control dialogues
  • Inject raw SCCP/M3UA payloads
  • Monitor system metrics via Prometheus

For per-operation request/response schemas and MAP opcodes, this guide cross-references the MAP Client Guide, which documents every operation in detail.

Ports and Transports

OmniSS7 runs three distinct HTTP servers. This guide covers the first one (:8080). The others are documented in the Configuration Reference.

PortTransportServerScope of this guide
8080HTTP — Plug.CowboyAPIhandlerYes — MAP/CAP REST /api/*, /metrics, /swagger.
8087HTTPS — Bandit (Phoenix)ControlPanelWeb.EndpointNo — web control panel UI. See Web UI Guide.
8445HTTPS / TLS:api_ex REST controllersNo — status/routing/links REST. See Configuration Reference.

API Architecture


HTTP Server Configuration

Server Details

The /api/*, /metrics, and /swagger endpoints are served by a Plug.Cowboy HTTP listener (lib/application.ex).

ParameterValueConfigurable
ProtocolHTTPNo
IP Address0.0.0.0 (all interfaces)Via code only
Port8080Via code only
TransportPlug.CowboyNo

Access URL: http://[server-ip]:8080

The control panel (:8087, Bandit) and the :api_ex REST controllers (:8445, TLS) are separate servers — see Ports and Transports.

Enabling/Disabling the HTTP Server

Control whether the :8080 HTTP server starts:

config :omniss7,
start_http_server: true # Set to false to disable

Default: true (enabled)

When Disabled: The :8080 HTTP server will not start, and the REST API / Swagger UI / metrics endpoint will be unavailable. The control panel (:8087) and :api_ex (:8445) servers are unaffected (they are gated by start_web_interfaces).


Swagger UI

The API includes a Swagger UI for interactive API documentation and testing.

Accessing Swagger UI

URL: http://[server-ip]:8080/swagger

Features:

  • Interactive API documentation
  • Try-it-out functionality for testing endpoints
  • Request/response schemas
  • Example payloads

Swagger JSON

The OpenAPI specification is available at:

URL: http://[server-ip]:8080/swagger.json

Use Cases:

  • Import into Postman or other API clients
  • Generate client libraries
  • API documentation automation

API Endpoints

Every operation endpoint follows the pattern POST /api/{operation} and accepts a JSON request body. Requests are synchronous: the handler blocks until the SS7 response arrives or the operation times out (default 10 seconds for awaited MAP operations — see Error Handling).

The tables below list all 47 operation endpoints grouped by category. For each operation's request fields, response schema, and MAP opcode, see the corresponding section of the MAP Client Guide, which was refreshed alongside this guide and documents every operation in full.

Response codes (all endpoints): 200 = success, 400 = bad/invalid request (missing or wrong-typed fields), 504 = timeout (no SS7 response within the operation's timeout), 500 = operation error (non-timeout), 503 = feature not enabled (USSD), 404 = unknown path. See Error Handling.

Mobility Management

OperationEndpointDescription
Update LocationPOST /api/updateLocationRegister a subscriber's serving VLR with the HLR. In HLR mode this triggers the InsertSubscriberData (ISD) sequence.
Cancel LocationPOST /api/cancelLocationInstruct a VLR to delete a subscriber record.
Provide Roaming NumberPOST /api/prnObtain an MSRN from the serving MSC.
Purge MSPOST /api/purgeMSMark a subscriber as purged at the HLR.
Send IdentificationPOST /api/sendIdentificationRetrieve IMSI/auth data from the previous VLR (TMSI supplied as hex).
ResetPOST /api/resetHLR-initiated reset toward a VLR (unconfirmed — returns {"status":"sent"}).
Restore DataPOST /api/restoreDataVLR requests subscriber-data restoration from the HLR.

SMS

OperationEndpointDescription
Send Routing Info for SMPOST /api/sri-for-smQuery the HLR for the serving node for SMS delivery.
MT-Forward SMPOST /api/MT-forwardSMDeliver a mobile-terminated SM to the serving MSC/SGSN (smsPDU as hex).
MO-Forward SMPOST /api/forwardSMSubmit a mobile-originated SM (smsPDU as hex).
Send SMPOST /api/sendSMBuild and deliver an SMS-DELIVER from GSM-7 text.
Build Deliver PDUPOST /api/deliverPDUBuild an SMS-DELIVER PDU and return the hex (no SS7 send).
Report SM Delivery StatusPOST /api/reportSM-DeliveryStatusReport SM delivery outcome to the HLR.
Ready for SMPOST /api/readyForSMNotify the HLR that an MS is reachable for SMS.
Alert Service CentrePOST /api/alertServiceCentreAlert an SMSC that a subscriber is available.

Authentication

OperationEndpointDescription
Send Authentication InfoPOST /api/send-auth-infoRetrieve authentication vectors from the HLR.
Send IMSIPOST /api/sendIMSIResolve an MSISDN to its IMSI at the HLR.

Subscriber Data

OperationEndpointDescription
Send Routing InfoPOST /api/sriQuery the HLR for voice-call routing information.
Provide Subscriber InfoPOST /api/provideSubscriberInfoRequest subscriber state/location from the VLR.
Delete Subscriber DataPOST /api/deleteSubscriberDataRemove subscriber data at the VLR (optional withdraw flags).
Any-Time InterrogationPOST /api/anyTimeInterrogationgsmSCF queries subscriber info/location at the HLR.
Any-Time Subscription InterrogationPOST /api/anyTimeSubscriptionInterrogationQuery subscription data at the HLR.
Any-Time ModificationPOST /api/anyTimeModificationModify subscription data at the HLR.
Note Subscriber Data ModifiedPOST /api/noteSubscriberDataModifiedHLR notifies the gsmSCF of changed data.
Note MM-EventPOST /api/noteMM-EventReport a mobility-management event to the gsmSCF.

Supplementary Services

OperationEndpointDescription
Interrogate SSPOST /api/interrogateSSInterrogate the status of a supplementary service.
Register SSPOST /api/registerSSRegister a supplementary service (e.g. call forwarding / CFU).
Erase SSPOST /api/eraseSSErase a supplementary service.
Activate SSPOST /api/activateSSActivate a supplementary service.
Deactivate SSPOST /api/deactivateSSDeactivate a supplementary service.
Register PasswordPOST /api/registerPasswordRegister an SS password (ss_code integer).
Get PasswordPOST /api/getPasswordRetrieve/verify an SS password.
Forward Check SS IndicationPOST /api/forwardCheckSS-IndicationUnconfirmed check toward a VLR (returns {"status":"sent"}).

The five core SS operations (interrogateSS, registerSS, eraseSS, activateSS, deactivateSS) share a request shape: ss_code (integer) and hlr_gt, with optional forwarded_to, no_reply_time, and basic_service.

Location Services (LCS)

OperationEndpointDescription
Send Routing Info for LCSPOST /api/sendRoutingInfoForLCSGMLC queries the HLR for LCS routing.
Provide Subscriber LocationPOST /api/provideSubscriberLocationRequest a subscriber's location from the serving node.
Subscriber Location ReportPOST /api/subscriberLocationReportReport a subscriber's location to the GMLC.

GPRS

OperationEndpointDescription
Update GPRS LocationPOST /api/updateGprsLocationRegister a subscriber's serving SGSN with the HLR.
Send Routing Info for GPRSPOST /api/sendRoutingInfoForGprsQuery the HLR for GPRS routing (GGSN selection).

Equipment

OperationEndpointDescription
Check IMEIPOST /api/checkIMEIQuery equipment status at the EIR.

USSD

OperationEndpointDescription
USSD Send (network-originated)POST /api/ussd/sendPush a USSD message to a subscriber. Requires ussd_gateway_enabled: true (else 503). See the USSD Gateway Guide.

CAP / CAMEL

OperationEndpointDescription
CAP InitialDPPOST /api/cap/initialDPTrigger a CAMEL dialogue toward a gsmSCF. Returns an otid for follow-up ops.
CAP ConnectPOST /api/cap/connectRoute the call to a destination (destination_number + otid).
CAP ContinuePOST /api/cap/continueContinue call processing (otid).
CAP Release CallPOST /api/cap/releaseCallRelease the call with a cause (otid).
CAP Apply ChargingPOST /api/cap/applyChargingApply a charging window (duration + otid).

CAP follow-up operations carry the dialogue otid (hex, returned by initialDP) and respond with {"status":"sent","otid":"<hex>"}. See the CAMEL Gateway Guide.

Raw Injection (testing / diagnostics)

OperationEndpointDescription
Raw SCCPPOST /api/raw/sccpInject a hand-built SCCP payload (hex). Optional SCCP overrides (called/calling party, SSNs, OPC/DPC).
Raw M3UAPOST /api/raw/m3uaInject a hand-built M3UA payload (hex). Optional OPC/DPC/routing-context overrides.

Utility Endpoints

EndpointMethodPurpose
/metricsGETPrometheus metrics (text format).
/swaggerGETSwagger UI.
/swagger.jsonGETOpenAPI specification.

Worked Examples

The following examples illustrate the request/response shape for representative operations. For the full field reference of every operation, see the MAP Client Guide.

SendRoutingInfo (SRI)

Retrieve routing information for establishing a call to a mobile subscriber.

Endpoint: POST /api/sri

Request Body:

{
"msisdn": "1234567890",
"gmsc": "5551234567"
}
FieldTypeRequiredDescription
msisdnStringYesCalled party MSISDN
gmscStringYesGateway MSC Global Title

Response (200 OK):

{
"result": {
"imsi": "001001234567890",
"msrn": "5551234999",
"vlr_number": "5551234800"
}
}

cURL Example:

curl -X POST http://localhost:8080/api/sri \
-H "Content-Type: application/json" \
-d '{"msisdn": "1234567890", "gmsc": "5551234567"}'

SendRoutingInfoForSM (SRI-for-SM)

Retrieve routing information for delivering an SMS to a mobile subscriber.

Endpoint: POST /api/sri-for-sm

Request Body:

{
"msisdn": "1234567890",
"service_center": "5551234567"
}
FieldTypeRequiredDescription
msisdnStringYesDestination MSISDN
service_centerStringYesService Center Global Title

cURL Example:

curl -X POST http://localhost:8080/api/sri-for-sm \
-H "Content-Type: application/json" \
-d '{"msisdn": "1234567890", "service_center": "5551234567"}'

UpdateLocation

Notify the HLR of a subscriber location change (VLR registration). In HLR mode this triggers the InsertSubscriberData (ISD) sequence.

Endpoint: POST /api/updateLocation

Request Body:

{
"imsi": "001001234567890",
"vlr": "5551234800"
}
FieldTypeRequiredDescription
imsiStringYesSubscriber IMSI
vlrStringYesVLR Global Title address

USSD Send (Network-Originated)

Push a USSD message to a subscriber. Requires ussd_gateway_enabled: true. For the full callback protocol and session lifecycle, see the USSD Gateway Guide.

Endpoint: POST /api/ussd/send

Request Body:

{
"msisdn": "+254712345678",
"text": "You have a pending bill. Reply 1 to pay.",
"callback_url": "http://billing-app:9000/ussd"
}
FieldTypeRequiredDescription
msisdnStringYesDestination subscriber MSISDN
textStringYesUSSD text to display (GSM 7-bit)
callback_urlStringYesURL to receive subscriber replies via HTTP POST

Response (200 OK):

{
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "sent"
}

Error (503 — gateway disabled):

{
"error": "USSD gateway not enabled"
}

Authentication

Current Status: The API does not require authentication.

Security Considerations:

  • API is intended for internal/trusted network use
  • Consider using firewall rules to restrict access
  • For production deployments, consider implementing authentication middleware

Response Formats

All responses use JSON format.

Success Response

HTTP Status: 200 OK

Structure:

{
"result": {
// Operation-specific response data
}
}

Error Response

HTTP Status:

  • 400 Bad Request - Invalid or missing request fields
  • 500 Internal Server Error - Operation failed (non-timeout error returned by the SS7 stack)
  • 503 Service Unavailable - Feature not enabled (USSD gateway)
  • 504 Gateway Timeout - Operation timed out (default 10 seconds)
  • 404 Not Found - Invalid endpoint

Structure:

{
"error": "timeout"
}

or

{
"error": "invalid request"
}

Error Handling

Common Errors

ErrorHTTP CodeDescriptionSolution
Invalid JSON400Request body is not valid JSONCheck JSON syntax
Missing/invalid fields400Required fields missing or wrong type (responses often include a "required" list)Include all required parameters with correct types
Operation error500SS7 stack returned a non-timeout errorInspect the "error" message; check SS7 event logs
Feature disabled503USSD gateway not enabledSet ussd_gateway_enabled: true
Timeout504Operation exceeded its timeout (default 10s)Check M3UA connectivity, HLR/VLR availability
Not Found404Invalid endpointCheck endpoint URL

Timeout Behavior

Awaited operations use a 10-second timeout by default:

  1. Request sent to MapClient GenServer
  2. Waits for response up to 10 seconds
  3. If no response → returns 504 Gateway Timeout
  4. If response received → returns 200 OK with result

Troubleshooting Timeouts:

  • Check M3UA connection status (Web UI → M3UA page)
  • Verify network element (HLR/VLR/MSC) is reachable
  • Check routing configuration
  • Review SS7 event logs for errors

Metrics (Prometheus)

The API exposes Prometheus metrics for monitoring.

Metrics Endpoint

URL: http://[server-ip]:8080/metrics

Format: Prometheus text format

Example Output:

# HELP map_requests_total Total MAP requests
# TYPE map_requests_total counter
map_requests_total{operation="sri"} 42
map_requests_total{operation="sri_for_sm"} 158
map_requests_total{operation="updateLocation"} 23

# HELP cap_requests_total Total CAP requests
# TYPE cap_requests_total counter
cap_requests_total{operation="initialDP"} 87
cap_requests_total{operation="requestReportBCSMEvent"} 91

# HELP map_request_duration_milliseconds Duration of MAP request/responses in ms
# TYPE map_request_duration_milliseconds histogram
map_request_duration_milliseconds_bucket{operation="sri",le="10"} 5
map_request_duration_milliseconds_bucket{operation="sri",le="50"} 12
map_request_duration_milliseconds_bucket{operation="sri",le="100"} 35
...

# HELP map_pending_requests Number of pending MAP TID waiters
# TYPE map_pending_requests gauge
map_pending_requests 3

# HELP omniss7_license_status Current license status (1 = valid, 0 = invalid)
# TYPE omniss7_license_status gauge
omniss7_license_status 1

Available Metrics

MetricTypeLabelsDescription
map_requests_totalCounteroperationTotal number of MAP requests by operation type
cap_requests_totalCounteroperationTotal number of CAP requests by operation type
map_request_duration_millisecondsHistogramoperationRequest duration in milliseconds
map_pending_requestsGauge-Number of pending MAP transactions
ussd_requests_totalCounterdirectionTotal USSD requests (inbound/outbound)
ussd_active_sessionsGauge-Number of active USSD sessions
omniss7_license_statusGauge-Current license status (1 = valid, 0 = invalid)

Prometheus Configuration

Add to your prometheus.yml:

scrape_configs:
- job_name: 'omniss7'
static_configs:
- targets: ['server-ip:8080']
metrics_path: '/metrics'
scrape_interval: 15s

Example Requests

Python Example

import requests
import json

# SRI-for-SM Request
url = "http://localhost:8080/api/sri-for-sm"
payload = {
"msisdn": "1234567890",
"service_center": "5551234567"
}

response = requests.post(url, json=payload, timeout=15)

if response.status_code == 200:
result = response.json()
print(f"Success: {result}")
elif response.status_code == 504:
print("Timeout - no response from network")
else:
print(f"Error: {response.status_code} - {response.text}")

JavaScript Example

const axios = require('axios');

async function sendSRI() {
try {
const response = await axios.post('http://localhost:8080/api/sri', {
msisdn: '1234567890',
gmsc: '5551234567'
}, {
timeout: 15000
});

console.log('Success:', response.data);
} catch (error) {
if (error.code === 'ECONNABORTED') {
console.error('Timeout - no response from network');
} else {
console.error('Error:', error.response?.data || error.message);
}
}
}

sendSRI();

Bash/cURL Example

#!/bin/bash

# UpdateLocation Request
response=$(curl -s -w "\n%{http_code}" -X POST http://localhost:8080/api/updateLocation \
-H "Content-Type: application/json" \
-d '{
"imsi": "001001234567890",
"vlr": "5551234800"
}')

http_code=$(echo "$response" | tail -n 1)
body=$(echo "$response" | sed '$d')

if [ "$http_code" -eq 200 ]; then
echo "Success: $body"
elif [ "$http_code" -eq 504 ]; then
echo "Timeout - no response from network"
else
echo "Error $http_code: $body"
fi

Flow Diagrams

API Request Flow


Summary

The OmniSS7 REST API provides:

  • 47 operation endpoints across Mobility, SMS, Authentication, Subscriber Data, Supplementary Services, Location Services, GPRS, Equipment, USSD, CAP/CAMEL, and Raw injection.
  • Swagger UI at /swagger for interactive documentation and testing.
  • Prometheus metrics at /metrics for monitoring and observability.
  • 10-second default timeout for awaited operations (504 on timeout).
  • A Plug.Cowboy HTTP server on port 8080, toggled by start_http_server — separate from the control panel (:8087) and :api_ex REST controllers (:8445).

For per-operation request/response schemas and MAP opcodes, see the MAP Client Guide.

For Web UI access, see the Web UI Guide.

For configuration details, see the Configuration Reference.