Skip to navigation

Rotate a restaurant key

Partner key + restaurant key. Creates a new key first. It gets the same scopes as the old one (not its expiry date) and is shown in plain text once, in restaurantKey.key, in the same shape as when a restaurant is created. The old key keeps working for graceHours (default 24), so you can deploy the new key without downtime. effectiveAt is when the old key stops working.

Not allowed for an archived restaurant (409 RESTAURANT_ARCHIVED). See Rotating keys without downtime.

Authentication

AuthorizationBearer

The partner key, sent as Authorization: Bearer lbp_test_…. Created in the partner portal under Partner key. It belongs to the partner, not to a restaurant, and only works against /api/v1/partner. Server to server only: a request with an Origin header is rejected with 403 FORBIDDEN. A test key sees and creates only sandboxes; live partner keys are not available yet. A revoked key, a restaurant key (lbs_…) here, or a suspended or archived partner returns 401 UNAUTHORIZED; an expired key returns 401 KEY_EXPIRED.

X-LettBestilt-Restaurant-Keystring

The restaurant’s own key (lbs_test_… or lbs_live_…), sent in X-LettBestilt-Restaurant-Key together with the partner key for calls about one restaurant. The key must have full access (scope *, otherwise 403 INSUFFICIENT_SCOPE), belong to a restaurant the partner owns, and be in the same environment as the partner key (otherwise 401 UNAUTHORIZED). A slug that does not exist, belongs to another partner or does not match the key always gives the same 404 RESTAURANT_NOT_FOUND. Older keys without an environment in the prefix (lbs_<random>) are not accepted here; rotate them in the partner portal.

Path parameters

slugstringRequired
The restaurant's slug.
keyIdstringRequired

The id of the key to replace.

Request

This endpoint expects an object.
namestringRequired1-80 characters

A name for the new key, 1–80 characters.

graceHoursintegerOptional0-24Defaults to 24

How long the old key keeps working, 0–24 hours. Defaults to 24.

expiresOndateOptional

Optional expiry date for the new key (YYYY-MM-DD), from tomorrow up to two years ahead. The key works through that day, Norwegian time.

Response

The new key. Store restaurantKey.key now; it is not shown again.

dataobject
The new key's metadata.
restaurantKeyobject

A new restaurant key with the plain-text key in key, shown once. The same shape on creation and rotation.

effectiveAtdatetime
When the old key stops working.
messagestringOptional

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
422
Unprocessable Entity Error
429
Too Many Requests Error