Keys

Every call carries a key in the X-Api-Key header. A key belongs to one club and has a label (site, agent, ...) chosen when it is issued; the label only groups the usage records.

Publishable keys

Prefix lb_pk_. For web pages.

Server keys

Prefix lb_sk_. For servers, scripts and AI agents. The key has the same rights as a publishable one but no origin check, so it must stay secret.

Rotation

Ask lovebowls to rotate a key whenever it may have leaked, when someone who knew it leaves, or on a schedule you set. Rotation issues a new key and revokes the old one at once, so deploy the new key straight away. A revoked key answers 401 api_key_invalid, the same as a key that never existed.

What the answers mean

StatuscodeMeaning and what to do
401api_key_missingNo X-Api-Key header. Send one.
401api_key_invalidNot a lovebowls key, unknown, or revoked. Check for a copy and paste slip, then ask for a new key.
403origin_not_allowedA publishable key from an origin that is not on its list. Ask for the origin to be added.
403server_key_in_browserA server key sent with an Origin header. Move the call to a server, use a publishable key in the browser, and rotate the server key.
403club_mismatchThe {clubId} in the path is not the key's club. Use the id of the club the key was issued for.
403feature_not_in_planThe operation's group is switched off for the club. Not used today, but handle it.

Cross-origin calls (CORS)

The API answers the browser's preflight request itself, and allows only the origins on the calling key's list. If a browser reports a CORS failure, the cause is almost always the origin list or a wrong key.