midnight_apiVersions - Midnight

Example code for the midnight_apiVersions JSON-RPC method. Complete guide on how to use midnight_apiVersions JSON-RPC in GetBlock Web3 documentation.

This method lists the Midnight-specific RPC API versions supported by the connected node. Different Midnight node versions may support different feature sets — use this to detect capability.

Parameters

  • None

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "midnight_apiVersions",
    "params": [],
    "id": "getblock.io"
}'

Response Example

{
    "jsonrpc": "2.0",
    "result": [
        2
    ],
    "id": "getblock.io"
}

Response Parameters

Field
Type
Description

result

array of object

List of supported API versions

result[].api

string

Name of the API namespace (e.g. midnight, sidechain, chain, state)

result[].version

integer

Supported version number for the API

Use Cases

  • Capability detection in client libraries

  • Branching client logic by node version

  • Logging and debugging API version mismatches

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32601

Method not found

The method is not enabled on this node or has been deprecated

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?