Skip to content

Overview

Public JSON API of the Necter testnet (https://testnet-rpc.necter.network).

The public /v1 API of the Necter Hub on the testnet. Conventions:

  • Every response is application/json; charset=utf-8 except two binary downloads (GET /v1/modules/{address}/hbc, GET /v1/assets/{sha256}). Unknown paths answer a JSON 404.
  • Field names are snake_case. Timestamps are unix seconds (*_at). Token amounts are decimal strings in base units (wei). Hashes, ids and addresses are lowercase 0x hex.
  • Lists use cursor pagination: ?limit=1..200 (default 50) and ?cursor=…; responses are {"items": [...], "next_cursor": "…" | null}.
  • Errors: {"error": "<code>", "message": "…", "details": {…}, "request_id": "…"}. error codes are stable.
  • Rate limits: RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset on every response; 429 adds Retry-After.
  • Auth: session = bearer token from Sign-In with Ethereum (/v1/auth/*, 12 h); apiKey = developer API key nk_test_… as a bearer token, scoped; nodeSig = node request signing (miners and validators).

Browser access (CORS)

These rules apply on the RPC host, which answers CORS preflights (OPTIONS) itself with 204. Every API response carries Vary: Origin.

  • Open to any origin (Access-Control-Allow-Origin: *):
    • anonymous GETs (no Authorization header): allowed header Content-Type; exposed RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset;
    • POST /v1/execute and POST /v1/projects/{project_id}/tasks: methods POST, GET, OPTIONS; allowed headers Authorization, Content-Type, X-Request-Id (an API key may be sent as a bearer token); exposed RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset, Retry-After, X-Request-Id. Anonymous task submission still requires the project’s scheduling.public_tasks = true (else 401 unauthorized).
  • Allow-listed origins (the store https://testnet.necter.network, the desktop app tauri://localhost, https://tauri.localhost, and its local dev server http://127.0.0.1:7878, http://localhost:7878) get their origin reflected on every /v1 route, methods GET, POST, PUT, PATCH, DELETE, OPTIONS, the same allowed and exposed headers. Any other origin gets no CORS headers on session- or key-authenticated routes, so a browser cannot read the response.
  • Credentials are never allowed: no response carries Access-Control-Allow-Credentials, and the RPC host strips Set-Cookie. Authenticate with a bearer token in Authorization, never a cookie.
  • Access-Control-Max-Age: 600 (preflights are cached for 10 minutes).
  • Anonymous budgets on the browser-open POSTs, per client IP and across all anonymous callers together (a refused call never spends the shared budget): POST /v1/execute 60/min per IP and 600/min in total; anonymous POST /v1/projects/{project_id}/tasks 30/min per IP and 300/min in total. Calls with an API key use the key’s budget (1200/min) instead. Other anonymous calls: 600/min per IP.
  • Over a budget the response is 429 with {"error": "rate_limited"}, Retry-After (seconds) and the RateLimit-* headers of the budget that refused it, and it carries the same CORS headers, so the page can read it and back off.

Information

  • License: MIT
  • OpenAPI version: 3.1.0

SIWE session token (POST /v1/auth/siwe), 12 h, revocable.

Security scheme type: http

Bearer format: nsess_<43 char base64url>

Developer API key; scopes in ApiScope. Stored as SHA-256 on the Hub.

Security scheme type: http

Bearer format: nk_test_<8>_<43>

Node request signing; also requires X-Ndsr-Node, X-Ndsr-Public-Key, X-Ndsr-Timestamp, X-Ndsr-Nonce.

Security scheme type: apiKey

Header parameter name: X-Ndsr-Signature