Skip to main content
WAX allows you to extend the base API with custom endpoints, override existing methods, or add entirely new API namespaces. This is useful for working with custom Hive nodes or adding application-specific functionality.

Understanding API structure

Hive uses a JSON-RPC API organized into namespaces:
  • database_api - Read blockchain data
  • block_api - Get block information
  • network_broadcast_api - Broadcast transactions
  • account_by_key_api - Look up accounts by public key
  • Custom APIs - Your own endpoints
WAX generates TypeScript types and Python classes for all standard Hive API methods automatically.

Extending existing APIs

Add new methods to existing API namespaces.
The @endpoint_jsonrpc decorator automatically handles JSON-RPC communication. You only need to define the method signature.

Creating new API namespaces

Define entirely new API namespaces for custom endpoints.
The class name must match the API namespace exactly. For example, BlockApi maps to the block_api JSON-RPC namespace.

Combining multiple extensions

You can extend multiple API namespaces in a single collection.

Working with REST APIs

You can also extend WAX to work with REST APIs instead of JSON-RPC.

Type-safe API definitions

Define interfaces for type safety.

Complete example

Here’s a complete example showing API extension in practice:

Best practices

Define TypeScript interfaces or Python TypedDicts for request and response types.
Group related API extensions together and use meaningful names.
API class names must match the exact JSON-RPC namespace with snake_case converted to PascalCase.
Ensure your custom endpoints work correctly with different parameters.

Next steps

Formatters

Learn how to format API responses for display

API reference

Explore available Hive API endpoints

Custom operations

Create custom complex operations

TypeScript SDK

Full guide to making API calls