Skip to content

API Reference

The N-Hub REST API provides programmatic access to all platform functionality — devices, readings, sites, parsers, and more.

Interactive Documentation

Explore the API

The fastest way to understand the API is to use the interactive documentation:

  • Swagger UI — try API calls directly in the browser
  • ReDoc — clean, searchable reference documentation

Both are auto-generated from the OpenAPI 3.0 schema and always reflect the current API.

Base URL

https://api.dev-au-03.nnnco.io/api/

Authentication

All API endpoints require authentication. Include your credentials in the Authorization header.

curl -H "Authorization: Bearer <your-token>" \
  https://api.dev-au-03.nnnco.io/api/devices/

Token Authentication

curl -H "Authorization: Token <your-token>" \
  https://api.dev-au-03.nnnco.io/api/devices/

See Authentication for details on obtaining tokens.

Request Format

  • All request bodies must be JSON (Content-Type: application/json)
  • All responses are JSON
  • Timestamps are in ISO 8601 format (UTC)

Pagination

List endpoints return paginated results:

{
  "count": 150,
  "next": "https://api.dev-au-03.nnnco.io/api/devices/?page=2",
  "previous": null,
  "results": [...]
}

Default page size is 100 items. Use the page query parameter to navigate.

Common Response Codes

Code Meaning
200 OK Request succeeded
201 Created Resource created successfully
400 Bad Request Invalid request body or parameters
401 Unauthorized Missing or invalid authentication
403 Forbidden Authenticated but lacking permissions
404 Not Found Resource does not exist or is not in your enterprise
429 Too Many Requests Rate limit exceeded — retry after the indicated period

MQTT Data Streaming

For real-time device data, connect via MQTT using X.509 client certificates or username/password authentication. See the MQTT guide for setup instructions.

Example: Fetch Device Readings

# Get the latest 10 readings for a specific device
curl -H "Authorization: Bearer <token>" \
  "https://api.dev-au-03.nnnco.io/api/readings/?device=<device-id>&page_size=10&ordering=-timestamp"

Response:

{
  "count": 1523,
  "next": "https://api.dev-au-03.nnnco.io/api/readings/?device=<device-id>&page=2",
  "previous": null,
  "results": [
    {
      "id": "a1b2c3d4-...",
      "device": "e5f6g7h8-...",
      "timestamp": "2026-02-17T10:30:00Z",
      "data": {
        "temperature": 23.5,
        "humidity": 65,
        "battery": 3.6
      }
    }
  ]
}

For the complete endpoint list with request/response schemas, see the Swagger UI or ReDoc.

Rate Limits

API requests are rate-limited to ensure fair usage. If you receive a 429 response, wait for the period indicated in the Retry-After header before retrying.

Versioning

The API is currently at v1.0.0. Breaking changes will be communicated in advance and versioned appropriately.