Getting the Privileges of an Access Token

When you perform a REST API operation call, you must ensure that the access token you use to authenticate your API call minimally grants you the privileges which are required to access the endpoint (see Privilege Management and Privilege Reference). Otherwise, the call typically returns a 401 UNAUTHORIZED response.

Use the Get all organization privileges for the access token operation to retrieve the list of privileges which are granted to a certain access token (OAuth2 token, Coveo Cloud API key, or JWT search token) in the scope of a specific Coveo Cloud organization.

Request template

POST https://platform.cloud.coveo.com/rest/organizations/<MyOrganizationId>/privileges/token?accessToken=<MyAccessTokenToValidate> HTTP/1.1
 
Accept: application/json
Content-Type: application-json
Authorization: Bearer <MyAccessToken>

Payload

{}

In the request path:

In the Authorization HTTP header:

  • Replace <MyAccessToken> with a valid Coveo Cloud platform access token. This access token does not need to have any privileges in the target Coveo Cloud organization.

The body of a successful response (200 OK) contains the list of privileges granted by the token that corresponds to the accessToken you provide as a query string argument (see Valid Privilege owner, targetDomain, and type Combinations). Those privileges only apply within the confines of the target Coveo Cloud organization.

Sample Request

Request - Getting the privileges of an access token

POST https://platform.cloud.coveo.com/rest/organizations/mycoveocloudv2organizationg8tp8wu3/privileges/token?accessToken=xx590a182c-5045-4914-a00b-1f4099581b3e HTTP/1.1
 
Accept: application/json
Content-Type: application-json
Authorization: Bearer **********-****-****-****-************

Payload

{}

Successful response - 200 OK

[
  {
    "targetDomain": "EXECUTE_QUERY",
    "targetIds": [],
    "owner": "SEARCH_API",
    "global": false
  },
  {
    "type": "EDIT",
    "targetDomain": "ANALYTICS_DATA",
    "targetIds": [],
    "owner": "USAGE_ANALYTICS",
    "global": false
  }
]