Admin
This page describes administrative APIs and methods.

admin_auth

Create an RPC session token to be used as the authorization token for request to private JSON-RPC API endpoints.
Parameters
Argument
Type
Description
username
String
The RPC username.
password
String
The RPC password.
Curl Example:
1
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_auth", "params": { "username": "myuser", "password":"mypass" } ,"id":21}'
Copied!

Console Example

1
> admin.auth({
2
"username": "myuser",
3
"password": "mypass"
4
})
Copied!

Returns:

String - JSON Web Token

Output:

1
{
2
"id": 21,
3
"jsonrpc": "2.0",
4
"result": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOiIyMDE4LTExLTEwVDE0OjQyOjU4LjUwNDI2MjQ2MyswMTowMCIsInVzZXJuYW1lIjoiYWRtaW4ifQ.u02jMZ-VShh6Jp18tbvxCJ1KWv6fIGXky8hh7vbgDrc"
5
}
Copied!

admin.login

Authenticates the current console session to allow private RPC APIs to be called from the console environment. Internally, it acquires a session via admin_auth endpoint, caches the session token and sets it on every JSON-RPC requests.
Parameters
Argument
Type
Required
Description
username
String
True
The RPC username.
password
String
False
The RPC password.
If the password argument is omitted, an interactive session is started to collect the password. This is the recommended approach.

Console Example

1
> admin.login("myuser", "mypass")
Copied!

Returns:

String - JSON Web Token

Output:

1
{
2
"id": 21,
3
"jsonrpc": "2.0",
4
"result": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOiIyMDE4LTExLTEwVDE0OjQyOjU4LjUwNDI2MjQ2MyswMTowMCIsInVzZXJuYW1lIjoiYWRtaW4ifQ.u02jMZ-VShh6Jp18tbvxCJ1KWv6fIGXky8hh7vbgDrc"
5
}
Copied!
Copy link