Skip to main content
Version: development

Use the REST API

View the REST API

View the REST API documentation for information about the available API methods.

Enable the REST API service

Enable the REST API service from the command line by setting the --rest-api-enabled command line option to true.

You can also interact with APIs using Swagger UI by enabling the API documentation endpoint.

warning

Only trusted parties should access the REST API. Do not directly expose these APIs publicly on production nodes.

Interact with Teku APIs using the web browser by setting the --rest-api-docs-enabled command line option to true.

Access the APIs at http:<interface>:<port>/swagger-ui where:

The default location is http://localhost:5051/swagger-ui.

You can also use tools such as Postman or cURL to interact with Teku APIs.

curl -X GET "http://localhost:5051/eth/v1/node/identity"

Enable the validator client API

The validator client API allows you to call the key manager API endpoints and is enabled separately from the REST API methods.

Enable the validator client API service from the command line by including the --validator-api-enabled command line option.

When enabling the validator client API, you must create a keystore. Set the keystore using --validator-api-keystore-file and the password file for the keystore using --validator-api-keystore-password-file.

Example
teku --validator-api-enabled --validator-api-keystore-file=validator_keystore.p12 --validator-api-keystore-password-file=validator_keystore_pass.txt

The OpenAPI specifications for the validator client API are available at /swagger-docs when the --validator-api-docs-enabled option is set to true. The /swagger-docs endpoint defines the API if code generators are in use.

When enabling the API documentation endpoint, specify: