VipterHelp Center

Authentication and API keys

How to create an API key in the dashboard, the vk_live_… format, the read and write scopes, how to send the key on every request, how to revoke, how to test without a test mode and what each 401 and 403 error means.

Admin or OwnerAll plans

Every API request carries one of the store's API keys. The key identifies the store and says what the request may do. There is no user, password or session: whoever holds the key has the access.

Before you start

  • Admin or Owner role in the store.
  • The API on for the store (it is on by default). See below.

Create a key

  1. Open GeneralSettings › Developers.
  2. Create a new key. Give it a name that says where it will be used, such as "ERP" or "Production server", and choose the scopes.
  3. Copy the full value, vk_live_…. It is shown only once. After that, the dashboard shows only the last four characters.

Each key is pinned to an API version, the current one on the day it was created. See Version.

The step by step with what the dashboard shows is in Developers: keys and logs.

Key format

vk_live_AbCdEfGhIjKlMnOpQrStUvWxYz0123456789AbCdEfGh
PartLengthWhat it is for
vk_live_8Fixed prefix. Tells a Vipter key apart from a Stripe sk_live_ in the same .env.
Identifier12 charactersLocates the key. Not secret.
Secret32 charactersThe part that proves possession. Vipter stores only a hash of it.

Letters and digits, nothing else. A key with any other shape is refused with 401 invalid_api_key before the database is consulted.

Only the live prefix exists. Vipter has no test mode; see Testing without a test mode.

Scopes

ScopeWhat it allowsMethods
readQuery the account, customers, subscriptions, orders, offers and products.GET
writeCreate and change data: checkout sessions, customers and customer portal sessions.POST, DELETE

A key can have one or both scopes. A request to an endpoint without the required scope gets 403 insufficient_scope. For an integration that only reads data, create the key with read only.

Use the key

Send the key in the Authorization header, as a Bearer token:

curl https://api.vipter.com/v1/account \
  -H "Authorization: Bearer vk_live_AbCdEfGhIjKlMnOpQrStUvWxYz0123456789AbCdEfGh"

The API also accepts HTTP Basic with the key as the user and an empty password, the same habit as Stripe's examples with -u. The two forms are equivalent:

curl https://api.vipter.com/v1/account \
  -u vk_live_AbCdEfGhIjKlMnOpQrStUvWxYz0123456789AbCdEfGh:

The trailing colon tells curl the password is empty. Without it, curl prompts for a password in the terminal.

The key works for https://api.vipter.com/v1 and for https://app.vipter.com/api/v1; see Base URL.

Store the key

  • Keep the key in an environment variable or a secrets vault. Never in source code, in a repository or in a page served to the browser.
  • Use one key per system and per environment. If one leaks, you revoke only that one.
  • The API does not accept browser calls with the key: anyone opening the page would have the key. Call the API from your server.
  • If a key showed up somewhere public, revoke it right away and create another. Vipter has no way to recover a key's value: only the hash of the secret is stored.

Revoke a key

In the key list, use the revoke action. The key stops working immediately: the next request with it gets 401 api_key_revoked. It cannot be undone. To rotate a key without stopping the integration, create the new one, deploy, check in the last-used column that the old one is no longer used, and only then revoke the old one.

Revoked keys stay in the list, for the history. The request logs show which key made each call.

The API is on for every store

There is nothing to request: every active store answers the API as soon as it has a key. Vipter can switch the API off for one store, for abuse or an account issue. The Developers tab then shows a notice and every request, even with a valid key, gets 403 api_not_enabled. To turn it back on, contact Vipter support and give the store's name. Existing keys work again as soon as the API is back on.

The API also only answers for active stores. A suspended store, or one in another state, gets 403 project_inactive.

Testing without a test mode

Vipter has no test keys and no separate environment. Testing happens in the same store, with a payment provider's test connection:

  1. Under PaymentsProviders, create a connection with Test connection turned on. It uses the provider's test environment and charges nobody for real.
  2. Make a purchase through the checkout with that connection. See Test your store.
  3. Retrieve the order through the API. An order that went through a test connection comes with "livemode": false. Customers, subscriptions, offers and products have no connection, so they come with "livemode": true.

Because the test happens in the real store, test orders show up in the dashboard and in the reports next to the real ones. Use the livemode field to tell them apart in your system.

Authentication errors

All of them come in the standard error format. A 401 is about the key; a 403 is about what the key may do or about the store.

HTTPtypecodeCauseWhat to do
401authentication_errorapi_key_missingThe request carried no Authorization, or carried one that is neither Bearer nor Basic.Send Authorization: Bearer vk_live_….
401authentication_errorinvalid_api_keyThe key does not exist, the secret is wrong, the shape is wrong or the store was deleted. The message is the same in all these cases, on purpose.Check that you copied the whole key, without spaces. Create another if needed.
401authentication_errorapi_key_revokedThe key was revoked in the dashboard.Create a new key.
401authentication_errorapi_key_expiredThe key passed its expiry date.Create a new key.
403permission_errorapi_not_enabledThe API was switched off for the store.Ask support to turn it back on.
403permission_errorproject_inactiveThe store is not active.Fix the store's state in the dashboard.
403permission_errorinsufficient_scopeThe key lacks the scope the endpoint requires.Create a key with the right scope.

Requests without a valid key are limited by IP address, at 10 per minute. Beyond that, the answer is 429 rate_limit until the window clears. This protects against key guessing and does not affect authenticated calls, which have their own limit.

What to do next

Was this page helpful?

On this page

Language