Skip to main content

SomaTech Stats API

SomaTech Stats API

Base URL: https://somatechapi.nexgate.co


1. Overall Stats

Returns total counts with no date filtering.

Endpoint:

GET /api/v1/stats

Auth: None — public endpoint

Request:

curl https://somatechapi.nexgate.co/api/v1/stats

Response:

{
  "status": "success",
  "message": "Stats fetched successfully",
  "data": {
    "totalUsers": 1500,
    "totalMessages": 12400,
    "totalResponses": 11800,
    "trend": null
  }
}

2. Trend Stats

Returns overall counts plus daily breakdown for a date range.

Endpoint:

GET /api/v1/stats/trend

Auth: None — public endpoint

Query Params:

Param Type Required Description
from yyyy-MM-dd No Start date. Defaults to 30 days ago
to yyyy-MM-dd No End date. Defaults to today

Request:

# With date range
curl "https://somatechapi.nexgate.co/api/v1/stats/trend?from=2024-01-01&to=2024-03-01"

# Default last 30 days
curl "https://somatechapi.nexgate.co/api/v1/stats/trend"

Response:

{
  "status": "success",
  "message": "Stats fetched successfully",
  "data": {
    "totalUsers": 1500,
    "totalMessages": 12400,
    "totalResponses": 11800,
    "trend": [
      {
        "date": "2024-01-01",
        "messages": 120,
        "responses": 115,
        "newUsers": 30
      },
      {
        "date": "2024-01-02",
        "messages": 98,
        "responses": 95,
        "newUsers": 12
      }
    ]
  }
}

Notes

  • All dates must be in yyyy-MM-dd format
  • If from is provided without to, to defaults to today
  • If neither is provided, trend defaults to last 30 days
  • trend is null on the overall stats endpoint