API access tokens
Lucidworks AI APIs require you to authenticate using Java Web tokens (JWT) tokens. Generate these tokens using the Authentication API, then include them in the request header.Fetch an access token
Fetch an access token
1
Locate your integration
In the Platform UI, navigate to Models > Integrations and click on your integration.
To fetch an access token, you’ll need these details from your integration:
- Client ID
- Client secret
2
Compose your request
You’ll send your access token request using the Authentication API.The request uses basic authentication, where your base64-encoded client ID is your username and your base64-encoded client secret is your password.
Some clients perform the encoding automatically; if not, you can use the Compose your request like this:The value of the
base64 command line utility, like this:scope query parameter varies between APIs, and you need a separate access token for each scope:- The Models API uses the
machinelearning.modelscope. - All other APIs use the
machinelearning.predictscope.
3
Fetch the access token
When you send a successful Authentication API request, the JSON response looks like this:Copy the value of the
access_token key and use it for API authentication.4
Refresh your token every 60 minutes
API access tokens expire after 60 minutes.
Using the APIs
Once you have an access token, you’re ready to send API requests. The base URL depends on the API:| API | Base URL |
|---|---|
| Authentication API | https://identity.lucidworks.com |
| Async Chunking API | https://APPLICATION_ID.applications.lucidworks.com |
| Async Prediction API | https://APPLICATION_ID.applications.lucidworks.com |
| Models API | https://api.lucidworks.com |
| Prediction API | https://APPLICATION_ID.applications.lucidworks.com |
| Prompting Preview API | https://APPLICATION_ID.applications.lucidworks.com |
| Tokenization API | https://APPLICATION_ID.applications.lucidworks.com |
| Use Case API | https://APPLICATION_ID.applications.lucidworks.com |
APPLICATION_ID from your integration (at Models > Integrations in the Platform UI).
Your request must include a Bearer authorization header containing your access token, like this: