Skip to main content

How do I authenticate with the API?

Jaye Hackett avatar
Written by Jaye Hackett
Updated this week

All requests require a client ID and client secret, which you can get from the API integration page of the Vouchsafe dashboard.

You can trade these for an access token using the authenticate endpoint, which you then provide as a bearer token with requests.

If you are using sandbox mode, you will need a sandbox secret. Otherwise, use a live secret.

Dealing with expired tokens

Each access token lasts 24 hours, after which you will need to re-authenticate.

For low-volume use cases, it is fine to re-authenticate every time you call the API, but for high-volume use cases we recommend re-using the token, with a fallback for when it expires:

  1. Save the access token to memory or a database

  2. Use the saved token when calling the API

  3. Re-authenticate only upon a 401 unauthorised error, then save the new token

This reduces the number of requests and will make your application more performant.

Did this answer your question?