Our API offers a few different methods of authentication, and which one to
choose depends on your use case.
Both authentication methods below — OAuth access tokens and Personal Access Tokens — are issued against an
OAuth Application. Create one first, then follow the flow that
matches your use case.
Navigate to the OAuth
Applications area. From here you can create a new OAuth Application and
receive your client_id and
client_secret.
Make sure you save the client_secret straight away,
as we can only show it to you once. If you need to regenerate a new client_secret, email
support@vinsight.net.
Next Steps:
Choose the authentication flow that matches your use case:
Vinsight uses OAuth 2.0’s authorization code grant
flow to issue access tokens on behalf of users. The following diagram
illustrates the OAuth flow based on the actions of the user, your app, and Vinsight.

redirect_uri with aclient_id, client_secret, and thecode.Before you begin, create an OAuth Application. The
authorization code grant flow has two additional requirements:
client_id and client_secret on behalf1. Ask for permission
Before your app can access any Vinsight data, a user must grant permission to your
app. Granting permission happens when a user clicks the link to install your app.
Show the installation screen for your app
To show the installation screen for your app inside Vinsight, redirect the user to
the following URL with the query parameters defined below:
https://app.vinsight.net/oauth/authorize?client_id={client_id}&scope={scopes}&redirect_uri={redirect_uri}&state={nonce}
| Query parameter | Description |
|---|---|
{client_id} |
The Client ID for your app as shown in your OAuth Application page. |
{scopes} |
A space-separated list of scopes. For example, to write Sales Orders and read Contacts, use scope=write_salesorders read_contacts.Any permission to write a resource includes the permission to read it. |
{redirect_uri}
|
The URL to which a user is redirected after authorizing the app. The complete URL specified here must be added to your OAuth Application settings as an allowed redirection URL. Make sure you URL Encode this parameter. |
{nonce} |
A randomly selected value provided by your app that is unique for each authorization request. During the OAuth callback, your app must check that this value matches the one you provided during authorization. This mechanism is important for the security of your app. |

2. Confirm installation
When the user clicks the "Install App" button in the prompt, they're redirected to
your app's server. The authorization_code is passed
in the confirmation redirect:
https://example.com/oauth/redirect?code={authorization_code}&state={nonce}
Make sure that the state nonce returned to you is the same that you sent.
3. Get access token
Now you can exchange the authorization_code for an
access token by sending a request to Vinsight's /oauth/access_token endpoint:
POST https://app.vinsight.net/oauth/access_token
| Query parameter | Description |
|---|---|
{client_id}
|
The Client ID for your app as shown in your OAuth Application page. |
{client_secret}
|
The Client Secret for your app as shown in your OAuth Application page when you first created it. |
{code} |
The authorization code provided in the redirect. |
The server responds with an access token:
{
"scope": "write_salesorders,read_contacts,read_stockitems",
"access_token": "eyJ0eXAiOiJ ... 3HgH3Yxsau2UE7k",
"token_id": "gbc2l2tz25 .... e7tq",
"expires_in": 31536000
}
The following values are returned:
| Value | Description |
|---|---|
access_token
|
An API access token that can be used to access the user’s data as long as your app is installed. Your app should store the token somewhere to make authenticated requests. |
scope |
The list of access scopes that were granted to your app and are associated with the access token. |
token_id |
A unique installation ID to identify this connection. |
expires_in |
How many seconds the token is valid for. We currently set this to 1 year after which your user will need to re-authorize the connection manually by visiting the OAuth grant screen again. |
If the user re-authorises your application for any reason, all prior tokens for this
Vinsight Organisation will become invalid.
Make sure you are always querying with the most recent access token, otherwise you
will receive a 401 Unauthorised error.
4. Make Authenticated Requests
After your app has obtained an OAuth Access Token, it can make authenticated requests
to our API. These requests are accompanied with a header
X-Access: {access_token} where {access_token} is replaced
with the token you received in the previous step.
curl -X GET \
https://app.vinsight.net/LoginContexts/Current.json \
-H 'X-Access: {access_token}'
A Personal Access Token (PAT) is a scoped (you can set permissions to limit access),
revocable Bearer token that you issue directly from within your Vinsight account.
PATs are the recommended alternative to API keys when you want to
access your own organisation's data programmatically — for example from a script, a
reporting tool, or an AI agent.
Compared to API keys, Personal Access Tokens offer:
1. Create an OAuth Application
If you have not already, create an OAuth
Application. Personal Access Tokens do not require a
Partner Account or any redirect URLs — you only need the application itself.
You do not strictly need to save the client_secret to issue a
Personal Access Token manually. Save it only if you want to be able to
programmatically issue access tokens via the API rather than generating them by
hand. We can only show the client_secret to you once at
creation time; if you need to regenerate one, email support@vinsight.net.
2. Issue a Personal Access Token
On the OAuth Application you want to issue the token for and find the
Personal Access Tokens section.
Fill in the details:
| Field | Description |
|---|---|
| Token name | A human-readable label, e.g. Claude agent ornightly_reporting.
|
| Expiry | Choose 30, 90, 180, or 365 days, or enter a custom date. |
| Scopes | A comma-separated list of permissions, either read or write for each endpoint, eg write_salesorders,read_contacts.A token's scopes are fixed once issued — to change them, revoke the token and issue a new one. |
After clicking Issue Personal Access Token, the token value is shown
once only. Copy it to a secure location — it cannot be retrieved
again.
If you lose it, revoke it and issue a new one.
3. Make Authenticated Requests
Include the token as a Bearer token in the Authorization header:
curl -X GET \
https://app.vinsight.net/SalesOrders.json \
-H 'Authorization: Bearer {access_token}'
Alternatively, use the X-Access header (same
behaviour):
Or pass the token as a query parameter using the access_token parameter (RFC 6750):
https://app.vinsight.net/SalesOrders.json?access_token={access_token}
4. Revoking a Token
To revoke a token, open the OAuth Application in the portal, find the token in the
Personal Access Tokens list, and click Delete
button.
Revocation takes effect immediately — any subsequent request using that token will
receive a 401 Unauthorized
response.
NB: API keys are now obsolete and you should use a Personal Access Token instead,
which is more secure and flexible. API keys will continue to work for existing
keys but we will not issue new ones. If you need a new API key, please create a
Personal Access Token instead and update your applications to use that.