Skip to content

Authentication

Login

pb login

Open a browser window for OAuth login. After successful authentication, credentials are stored locally.

Example:

bash
pb login
text
✓ Login successful
json
{
  "code": 200,
  "data": null,
  "msg": "Login successful"
}

Logout

pb logout

Clear stored credentials and log out of PhoneBase.

Example:

bash
pb logout
text
✓ Logged out
json
{
  "code": 200,
  "data": null,
  "msg": "Logged out"
}

Status

pb status

Check the current authentication status and account balance.

Example:

bash
pb status
text
Authenticated: yes (api_key)  Balance: $50.00
json
{
  "code": 200,
  "data": {
    "authenticated": true,
    "auth_type": "api_key",
    "balance_cents": 5000
  },
  "msg": "OK"
}

API Key

pb apikey [key]

Set or view the API key. Without arguments, displays the current key. With an argument, saves the key to the config file.

ParameterTypeRequiredDescription
keystringNoAPI key to set. Omit to display the current key

Examples:

bash
# View current API key
pb apikey

# Set a new API key
pb apikey pb_sk_xxxxxxxxxxxxxxxxxxxx
text
api_key = pb_sk_xxxxxxxxxxxxxxxxxxxx
json
{
  "code": 200,
  "data": { "api_key": "pb_sk_xxxxxxxxxxxxxxxxxxxx" },
  "msg": "OK"
}