API Tokens
Use our API to easily control access to the parcelLab API.
Managing Tokens
Details of how the tokens
endpoint can be used to retrieve, create, and revoke API tokens in the parcelLab system are described below.
All endpoints require a token with generate
scope.
GET List of All Tokens
You can retrieve a list of all API tokens with the tokens/list
endpoint. To use this API, you need your parcelLab user_id
and API token
for authentication.
The details of the Get List of All Tokens API are described in the following section.
API Details
GET
https://api.parcellab.com/tokens/list
Header
user
number
parcelLab user ID
token
string
parcelLab API token
content-type
string
'application/json'
An example request is displayed below to show the format for retrieving the list of tokens.
curl --location 'https://api.parcellab.com/tokens/list’ \
--header 'content-type: application/json' \
--header 'user: 100' \
--header 'token: parcelLabAPItoken-30characters' \
Responses
200 - accepted
POST Create a New Token
You can create a new API token with the tokens/generate
endpoint. To use this API, you need your parcelLab user_id
and API token
for authentication. When you have generated a new API token, this can be used for authentication with the parcelLab API.
The details of the Create a New Token API are described in the following section.
API Details
POST
https://api.parcellab.com/tokens/generate
Header
user
number
parcelLab user ID
token
string
parcelLab API token
content-type
string
'application/json'
Request Body
note
string
An associated note, which can be any string.
scope
string
The scope can be one of read
, write
or generate
.
An example request is displayed below to show the format for creating a token.
curl --location 'https://api.parcellab.com/tokens/generate’ \
--header 'content-type: application/json' \
--header 'user: 100' \
--header 'token: parcelLabAPItoken-30characters' \
--data ‘{
“note”: “track”,
“scopes”: [
“write”
]
}’
Responses
200 - accepted
POST Revoke a Token
You can revoke a single API token with the tokens/revoke
endpoint. To use this API, you need your parcelLab user_id
and API token
for authentication.
This action revokes the token immediately.
The details of the Revoke a Token API are described in the following section.
API Details
POST
https://api.parcellab.com/tokens/revoke
Header
user
number
parcelLab user ID
token
string
parcelLab API token
content-type
string
'application/json'
Request Body
tokenId
number
The token ID as specified in /tokens/list
.
An example request is displayed below to show the format for revoking a token.
curl --location 'https://api.parcellab.com/tokens/revoke’ \
--header 'content-type: application/json' \
--header 'user: 100' \
--header 'token: parcelLabAPItoken-30characters' \
--data ‘{
“tokenId”: “The token ID as in /tokens/list”
}’
Responses
200 - accepted
Last updated
Was this helpful?