Skip to Content
Developer docs

Authentication

The three kinds of Meishi keys, where to get them and how to keep them safe.

Every request names its key in the Authorization header as a bearer token:

Authorization: Bearer msk_live_…

Kinds of keys

KeyPrefixUsed byWhere to get it
API keymsk_live_Your server, for the Meishi APIPartner › API and webhooks
Website keymk_live_Your web page, to open the editor. Public by designPartner › Shops and integrations
Server keysk_live_Your server, for the website orders APIPartner › Shops and integrations › Server connection

Keys from a development Meishi start with msk_dev_, mk_dev_ and sk_dev_ instead (see Environments).

API keys

An API key stands for your whole organization: everything it makes belongs to the organization and counts against its plan. Only owners and admins can create, replace and delete keys. The API comes with the Enterprise and Partner plans; on other plans every request answers 402 plan_required.

Each key can have its own webhook and its own retention (how long its experiences are kept).

Website keys

A website key is publishable, like a Stripe publishable key. It only works on the websites you list on it, so it is safe in a page. It cannot read or change anything on its own: it only opens the editor.

Server keys

A server key belongs to one website key and lets your server confirm, cancel and look up the designs sent through it. Like an API key, it is secret.

Keep secret keys secret

API keys and server keys are shown once, when they are made. Store them in your server's secret store or an environment variable. Never put them in a web page, a mobile app or a repository.

  • Replace a key in the portal if it may have leaked. The old secret stops at once, and the experiences it made keep working.
  • Delete a key to stop it for good. Printed QR codes keep working.
  • Use one key per system (your shop, your print queue…), so you can replace one without touching the others. The portal shows when each key was last used.

Errors

StatusCodeMeaning
401api_key_required / server_key_requiredNo key in the Authorization header
401api_key_invalid / server_key_invalidThe key is wrong, was replaced or was deleted
402plan_requiredYour plan does not include the API