Token info
What the token you are holding is, and what it can do. The first call to make when something returns 403 and you do not know why.
The object#
| Field | Type | Description |
|---|---|---|
| token | object | The token itself. |
| company | object | The one company this token acts in. |
| user | object | The user it acts as. |
| scopes | array of MeScope | Every scope on the token, sorted. |
Endpoints#
GET/me
200401
What this token can do.
Returns the token, its company, its user and every scope on it. No scope is required - this is the endpoint you call when a token is not working. A scope whose feature is not active on the install comes back with usable: false and the feature named, which answers the most common "I granted the scope and still get 403" question without a support ticket.
When it fails
| Status | Code | Meaning |
|---|---|---|
| 401 | unauthorized | No token, or not a valid one. |
curl \ 'https://acme.nolapro.com/!/api/v2/me' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/me'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.get( "https://acme.nolapro.com/!/api/v2/me", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/me', { method: 'GET', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var res = await http.GetAsync( "https://acme.nolapro.com/!/api/v2/me"); res.EnsureSuccessStatusCode();
Response 200
{
"scopes": [
{
"scope": "items:write",
"resource": "items",
"access": "write",
"usable": true,
"requires": "inventory",
"reason": ""
}
]
}