Authentication#
The Afosto API uses API keys to authenticate requests. Include your API key in the
Authorization header of every request.
·
Note:
An API key is for servers. A webshop calls the API from the browser with a storefront token, and with a user token for a logged-in customer. See Tokens.
Getting an API key#
- Log in to your Afosto account
- Go to Settings → API
- Click Create API key
- Copy the key — it will only be shown once
⚠
Warning:
Your API key is shown only once at creation time. Store it in a secrets manager or environment variable immediately — there is no way to retrieve it later.
Using your API key#
Pass your API key as a Bearer token in the Authorization header:
Example request#
Security#
- Keep your API key secret — treat it like a password
- Never expose API keys in client-side code or public repositories
- Rotate keys periodically and immediately if compromised
- Use one key per integration to make it easy to revoke access