RedSwitches API Private beta Reference
Menu

Account and key

Two endpoints about who you are: the key you are using, and the account it belongs to. Both need the read permission.

Check the key

GET /auth/verify returns the key the request was made with. Use it to test a new key and to see which permissions work right now.

curl -sS https://api.redswitches.com/v1/auth/verify \
  -H "Authorization: Bearer $REDSWITCHES_API_KEY"
const key = await rs.auth.verify();
key = client.auth.verify()
key, err := client.Auth.Verify(ctx)
{
  "id": "key_5",
  "label": "monitoring",
  "hint": "a1B2",
  "env": "live",
  "permissions": ["read", "read_billing"],
  "effective_permissions": ["read", "read_billing"],
  "expires_at": "2027-02-13T09:30:00Z"
}
FieldTypeMeaning
idstringThe key's id, key_<n>.
labelstringThe label you gave the key.
hintstringThe key's last four characters.
envstringlive.
permissionsarray of stringsWhat the key holds. See Authentication and keys.
effective_permissionsarray of stringsWhat works right now. A permission is missing here while RedSwitches has that part of the API switched off.
expires_atstringWhen the key stops working (UTC).

The key itself and its IP list are never returned.

Get the account

GET /account returns the account's id, status and currency. With read_billing it also returns the credit balance.

curl -sS https://api.redswitches.com/v1/account \
  -H "Authorization: Bearer $REDSWITCHES_API_KEY"
const account = await rs.account.get();
console.log(account.currency, account.credit ?? "(needs read_billing)");
account = client.account.get()
print(account.currency, getattr(account, "credit", None))
account, err := client.Account.Get(ctx)
if err != nil {
	log.Fatal(err)
}
fmt.Println(account.Currency)
{
  "id": "acc_100",
  "status": "active",
  "currency": "USD",
  "credit": "250.00"
}
FieldTypeMeaning
idstringThe account id, acc_<n>.
statusstringactive, inactive or closed. Only an active account can use the API, so you will see active.
currencystringThe account's currency, three capital letters. Every amount in the API is in this currency.
creditstringThe credit balance as a decimal string. Present only for a key with read_billing. Orders through the API are paid from this.