Searching for Tokens
Call the /tokens/search endpoint using POST to return a list of non-expired tokens that match the search criteria that you specify. This API is similar to /tokens, but enables a much more fine-grained search.
Note:If you do not have permission to view a given token, its details may be returned as masked entries.
Tip:Use the /tokens API to get a list of non-expired tokens for a specified user.
Item |
Description |
|||||||||||||||||||||||||||
URI |
/uar/v1/tokens/search |
|||||||||||||||||||||||||||
Method |
POST |
|||||||||||||||||||||||||||
Query parameters |
For descriptions, see Search Parameters, below.
|
|||||||||||||||||||||||||||
Request body |
{ "tokenCreator": "string", "expiresBefore": "string", "expiresLaterThan": "string", "issuedBefore": "string", "page": 0, "pageSize": 0, "tokenName": "string", "tokenType": "NORMAL | IMPERSONATED", "username": "string" } |
|||||||||||||||||||||||||||
Response codes |
200: Success 400: Unless you have the Create Impersonated Token permission and a Manage Users permission (see Permissions for access-token-controller), you cannot access tokens for other users. |
In the request body, specify at least one of the following search criteria: tokenCreator, username, expiresBefore, expiresLaterThan, issuedBefore, tokenName.
If you pass values for the username and tokenCreator parameters in the same request, the API returns a list of all non-expired tokens that match both parameters.
Parameter |
Description |
Notes |
tokenCreator |
The user name (email address) of the user who created the token. Use an asterisk (*) as placeholder for partial searches. Important:You need the Create Impersonated Token permission and a Manage Users permission (see Permissions for access-token-controller) to search for IMPERSONATED tokens. |
For NORMAL tokens, tokenCreator and username (if specifying both) must be the same user. |
username |
The user name (email address) of the user on whose behalf the token was created (in other words, the user who is being impersonated). |
|
expiresBefore |
Specify to return tokens that expire before a set interval. If specified, must be greater than the expiresLaterThan parameter. |
Use the following format to specify the interval: For example: 3Y 4M 3d 9h 6m |
expiresLaterThan |
Specify to return tokens that expire after a set interval. If specified, must be less than the expiresBefore parameter. |
|
issuedBefore |
Specify to return tokens that were issued before a set interval. |
|
tokenName |
Specify the name of the token. |
You can use the wildcard character * when you need a partial match, or if you are unsure of the exact token name. |
tokenType |
Specify NORMAL or IMPERSONATED. If not specified, tokens of both types will be returned. |
N/A |
page |
Mandatory. Specify the number of the page that should be returned. Values are zero based. |
N/A |
pageSize |
Mandatory. Specify how many tokens should be returned per page. |
N/A |
Sample Request
The following shows an example request to search for unexpired NORMAL tokens called “demo*” for user fnouser3@mycompany.com that expire within the next 3 months:
{
"tokenCreator": "fnouser3@mycompany.com",
"expiresBefore": "1y",
"expiresLaterThan": "1M",
"issuedBefore": "",
"page": 0,
"pageSize": 2,
"tokenName": "demo*",
"tokenType": "NORMAL",
"username": ""
}
This is the equivalent Curl call:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \
"tokenCreator": "fnouser3@mycompany.com", \
"expiresBefore": "3M", \
"expiresLaterThan": "", \
"issuedBefore": "", \
"page": 0, \
"pageSize": 2, \
"tokenName": "demo*", \
"tokenType": "NORMAL", \
"username": "" \
}' 'https://<siteID>.flexnetoperations.com/flexnet/uar/v1/tokens/search'
Sample Response
The following shows a sample response:
{
"statusMessage": "Successful",
"responseObject": {
"response": [
{
"expiryStr": "0y 3M",
"tokenName": "demo1",
"tokenDescription": "demo token 1",
"tokenType": "NORMAL",
"username": "fnouser3@mycompany.com",
"tokenIssueMillis": 1724347771843,
"tokenExpiryMillis": 1732300171843,
"tokenCreator": "fnouser3@mycompany.com"
},
{
"expiryStr": "0y 2M 25d 2h 50m",
"tokenName": "demo2",
"tokenDescription": "demo token 2",
"tokenType": "NORMAL",
"username": "fnouser3@mycompany.com",
"tokenIssueMillis": 1721308129531,
"tokenExpiryMillis": 1731762710070,
"tokenCreator": "fnouser3@mycompany.com"
}
],
"totalResults": 3,
"pageNumber": 0,
"pagesize": 2
}
}