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"
}
| Field | Type | Meaning |
|---|---|---|
id | string | The key's id, key_<n>. |
label | string | The label you gave the key. |
hint | string | The key's last four characters. |
env | string | live. |
permissions | array of strings | What the key holds. See Authentication and keys. |
effective_permissions | array of strings | What works right now. A permission is missing here while RedSwitches has that part of the API switched off. |
expires_at | string | When 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"
}
| Field | Type | Meaning |
|---|---|---|
id | string | The account id, acc_<n>. |
status | string | active, inactive or closed. Only an active account can use the API, so you will see active. |
currency | string | The account's currency, three capital letters. Every amount in the API is in this currency. |
credit | string | The credit balance as a decimal string. Present only for a key with read_billing. Orders through the API are paid from this. |