Skip to content
API referenceRestaurant

Get the current key

Try it

Returns the key making the request: its scopes, its maker and the endpoints it may call now.

GEThttps://tablebuddy.radioworkflow.com/api/v1/key
Read

Any valid key may call it, about itself: its name, its prefix, the scopes it was made with, when it expires, who made it, and the endpoints it may call now.

endpoints is worked out when you ask, from the key's scopes and its maker's permissions today. A key's scopes never change: what they let it call follows its maker's permissions, and the endpoints filed under a scope grow only by a dated line in the changelog. Permissions are worked out endpoint by endpoint, so there is no single list of what the key holds. See Authentication.

Authentication

Key
Authorization: Bearer <key>, or the same key in x-api-key. A key acts as the person who made it, cut down to this endpoint’s scope, and never as an owner. How keys work
Scope
None: any valid key.
The key's creator needs
Nothing beyond a valid key.

Request headers

Authorizationrequired
Bearer <key>. x-api-key: <key> works too; Authorization wins when both are sent.
Idempotency-Keyignored
Ignored: a read changes nothing, so there is nothing to repeat. Idempotency

Query parameters

None. A query string is answered 422 invalid_request.

Response

200OK

The secret is never returned, only its prefix: Table Buddy keeps a hash of it and nothing else.

currencystringISO 4217
The restaurant's currency: every amount in this answer is in its minor units.
minor_digitsinteger0–3
Digits after the point when an amount is shown: 2 for USD (cents), 0 for JPY.
keyobject
The key.
key.idstringid
The key's id.
key.namestring
The key's name, as its maker wrote it.
key.prefixstring15 chars
The key's first 15 characters, as API Keys lists it. The rest of the secret is never stored.

Matches ^tb_live_[A-Za-z0-9_-]{7}$

key.scopesarray of enum
The scopes it was made with. They never change.
menu:readmenu:writetables:readtables:writeorders:readorders:writeorders:cancelinventory:readinventory:writepayroll:readreports:read
key.expires_atstringISO 8601nullable
When it stops working; null when it does not expire.
key.created_byobject
Who made it: a key acts as this person, cut down to its scopes, endpoint by endpoint.
key.created_by.user_idstringid
The login that made it.
key.created_by.namestringnullable
That login's name, when it has one.
key.endpointsarray of string≤ 48 chars
The endpoints it may call now: its scope held, and its maker's permissions allowing each one.

Matches ^[a-z]+(?:-[a-z]+)*$

An answer may gain fields within v1: ignore the ones you do not know. Versioning

Response headers

request-idalways
This request’s id. Quote it when asking for help.
Cache-Controlalways
no-store: an answer is never cached.
RateLimit-Limit, RateLimit-Remaining, RateLimit-Resetonce the key is known
The key’s units a minute, what is left of this minute’s, and the seconds until the window starts again. Never on a 401. Rate limits
x-error-codeon an error
The error’s code, the same as error.code in the body.
Retry-Afteron a 429
Seconds to wait before sending the same request again.
WWW-Authenticateon a 401
The Bearer challenge, naming what was wrong with the key.

Errors

403issuer_access_ended
The key's creator has left the restaurant, was suspended, or was removed and invited back.

Fix: Make a new key from an active account.

422invalid_request
A query parameter is sent: this endpoint takes none.

Fix: Send the request with no query string.

Possible on every endpoint
401missing_api_keyNo Authorization: Bearer header and no x-api-key header.
401invalid_api_keyThe key is unknown, revoked or expired (answered alike).
429rate_limitedOver the key's 60 units a minute, or over 30 unknown keys a minute from one network (an address; an IPv6 caller's /64).
500internal_errorSomething failed on our side. Nothing kept the Idempotency-Key.

Every code, and when to retry

Request
curl -X GET "$TABLEBUDDY_URL/api/v1/key" \
  -H "Authorization: Bearer $TABLEBUDDY_API_KEY"
Response200
{
  "currency": "USD",
  "minor_digits": 2,
  "key": {
    "id": "cmg5x9a1b0007tb2jq4w8e2rt",
    "name": "Kitchen display sync",
    "prefix": "tb_live_9fQ2xLb",
    "scopes": [
      "menu:read",
      "orders:read"
    ],
    "expires_at": "2027-09-29T15:02:11.000Z",
    "created_by": {
      "user_id": "cmg5w7t3e0001tb2jz7m3n8qp",
      "name": "Dana Reyes"
    },
    "endpoints": [
      "get-restaurant",
      "get-current-key",
      "list-menu-categories",
      "list-menu-items",
      "get-menu-item",
      "list-orders",
      "get-order"
    ]
  }
}