Use platform token authentication
Use platform token authentication
This is for:
DeveloperIn this article
Platform tokens are special JSON web tokens that can be used to query almost any Coveo API as a specific user. You can generate platform tokens by making a call to the Authorization Server API.
Note
Currently, the Search API doesn’t support platform token authentication. |
Request a platform token
To request a platform token, make a POST
request to https://platform.cloud.coveo.com/rest/organizations/<MY_ORGANIZATION>/tokens
.
You must also specify a validityPeriod
in your request, after which the token will expire.
The default is 24 hours (validityPeriod=PT24H
).
To test the service on Coveo, use the Swagger UI.
Sample request
POST https://platform.cloud.coveo.com/rest/organizations/<MY_ORGANIZATION>/tokens?validityPeriod=PT24H HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Bearer **********-****-****-****-************
Payload:
{
"body": {
"additionalConfiguration": {
"analytics": {
"event": {
"userDisplayName": "Alice Smith",
"userId": "12345678"
}
},
"search": {
"userIds": [
{
"name": "asmith@example.com",
"provider": "Email Security Provider",
"type": "User"
}
]
}
},
"organizationId": "<MY_ORGANIZATION>",
"privileges": [
{
"level": "NORMAL",
"owner": "CUSTOMER_SERVICE",
"targetDomain": "USE_CASE_ASSIST",
"targetId": "*",
"type": "ENABLE"
}
]
}
}
Successful response
200 OK
{
"token": "fzKjcHdjPJKJVaJ2OjK0fzK2CI6dHJ1ZSwiZXhwIjoxNDY4Njk2NzEwLCJpYXQiOjE0lQGN..."
}