Skip to content

API Documentation

Base URL

  • Production: https://stats.api.datagram.network
  • Staging: https://stats-staging.api.datagram.network

General Information

  • All endpoints are versioned under /api/v1.
  • Requests and responses use JSON format unless otherwise specified.

Endpoints

1. Uptime

GET /api/v1/uptime

Retrieves uptime details for a specific identifier.

Parameters:

  • Query Parameters:
    • secret (string): Unique identifier of partner.
    • partner_node_id (string): Identifier of the partner node (external ID).
    • started_at (integer, optional): Start time in Unix timestamp (milliseconds).
    • ended_at (integer, optional): End time in Unix timestamp (milliseconds).

NOTE

If started_at or ended_at are not provided, the API will return the total uptime of the specified partner_node_id.
If started_at and ended_at are provided, the time range is limited to a maximum of the last 2 weeks.
All timestamps will be rounded down to the nearest hour. For example, 1752727252516 (2025-07-17T04:40:52.516Z) will be rounded to 1752724800000 (2025-07-17T04:00:00Z).

Response:

  • Response Code:
    • 200 OK: Uptime duration in milliseconds.
    • 400 Bad request: Invalid parameters.
    • 401 Unauthorized: Invalid token.
  • Response Value:
    • uptime (integer): Uptime unix timestamp in millisecond.
    • partner_node_id (string): Identifier of the partner node (external ID).

Authentication:

  • Use a valid organization token in the Authorization header.
  • Example: Authorization: <token, optional>.

Example Request:

http
GET /api/v1/uptime?secret=<partner-secret>&partner_node_id=dg-node-12&started_at=1752727252516&ended_at=1752736456421 HTTP/1.1
Host: stats.api.datagram.network
Authorization: <organization token>

Example Response:

json
{
  "data": {
    "uptime": 866222,
    "partner_node_id": "dg-node-12"
  }
}

2. Uptimes

GET /api/v1/uptimes

Retrieves uptime details for a specific identifier.

Parameters:

  • Query Parameters:
    • secret (string): Unique identifier of partner.
    • partner_node_id[] (string): Multiple identifiers for partner nodes (external IDs).
    • started_at (integer, optional): Start time in Unix timestamp (milliseconds).
    • ended_at (integer, optional): End time in Unix timestamp (milliseconds).

NOTE

If started_at or ended_at are not provided, the API will return the total uptime of the specified partner_node_id.
If started_at and ended_at are provided, the time range is limited to a maximum of the last 2 weeks.
All timestamps will be rounded down to the nearest hour. For example, 1752727252516 (2025-07-17T04:40:52.516Z) will be rounded to 1752724800000 (2025-07-17T04:00:00Z).

Response:

  • Response Code:
    • 200 OK: Uptime duration in milliseconds.
    • 400 Bad request: Invalid parameters.
    • 401 Unauthorized: Invalid token.
  • Response Value:
    • uptime (integer): Uptime unix timestamp in millisecond.
    • partner_node_id (string): Identifier of the partner node (external ID).

Authentication:

  • Use a valid organization token in the Authorization header.
  • Example: Authorization: <token, optional>.

Example Request:

http
GET /api/v1/uptimes?secret=<partner-secret>&partner_node_id[]=dg-node-1&partner_node_id[]=dg-node-2 HTTP/1.1
Host: stats.api.datagram.network
Authorization: <organization token>

Example Response:

json
{
  "data": [
    {
      "uptime": 1888888,
      "partner_node_id": "dg-node-1"
    },
      {
      "uptime": 1999999,
      "partner_node_id": "dg-node-2"
    }
  ]
}

3. Partner detail

GET /api/v1/partner/detail

Retrieves partner detail for a specific identifier.

Parameters:

  • Query Parameters:
    • secret (string): Unique identifier of partner.
    • partner_node_id (string): Identifier of the partner node (external ID).

Response:

  • Response Code:
    • 200 OK: partner detail.
    • 400 Bad request: Invalid parameters.
    • 401 Unauthorized: Invalid token.
  • Response Value:
    • connection_status (string): Connection status (connected / disconnected).
    • total_uptime (integer): Total uptime in milliseconds.
    • partner_node_id (string): Identifier of the partner node (external ID).

Authentication:

  • Use a valid organization token in the Authorization header.
  • Example: Authorization: <token, optional>.

Example Request:

http
GET /api/v1/partner/detail?secret=<partner-secret>&partner_node_id=dg-node-1 HTTP/1.1
Host: stats.api.datagram.network
Authorization: <organization token>

Example Response:

json
{
  "data": {
    "connection_status": "connected",
    "total_uptime": 99999,
    "partner_node_id": "dg-node-1"
  }
}

4. Partner details

GET /api/v1/partner/details

Retrieves partner details for a specific identifier.

Parameters:

  • Query Parameters:
    • secret (string): Unique identifier of partner.
    • partner_node_id[] (string): Multiple identifiers for partner nodes (external IDs).

Response:

  • Response Code:
    • 200 OK: partner detail.
    • 400 Bad request: Invalid parameters.
    • 401 Unauthorized: Invalid token.
  • Response Value:
    • connection_status (string): Connection status (connected / disconnected).
    • total_uptime (integer): Total uptime in milliseconds.
    • partner_node_id (string): Identifier of the partner node (external ID).

Authentication:

  • Use a valid organization token in the Authorization header.
  • Example: Authorization: <token, optional>.

Example Request:

http
GET /api/v1/partner/details?secret=<partner-secret>&partner_node_id[]=dg-node-1&partner_node_id[]=dg-node-2 HTTP/1.1
Host: stats.api.datagram.network
Authorization: <organization token>

Example Response:

json
{
  "data": [
    {
      "connection_status": "connected",
      "total_uptime": 99999,
      "partner_node_id": "dg-node-1"
    },
    {
      "connection_status": "disconnected",
      "total_uptime": 99998,
      "partner_node_id": "dg-node-2"
    }
  ]
}