Skip to main content
Lucidworks AI offers several APIs for managing and automating your AI implementation. You can use them to train and manage models, run synchronous and asynchronous predictions, preview and debug pass-through prompts and embedding model tokens, and chunk text. Lucidworks AI APIs let you control and customize your AI orchestration to suit your business needs by enabling developer teams to build out bespoke integrations and implementations. You can use the Lucidworks AI APIs in addition to, or instead of, the Lucidworks Platform UI, but some actions are only supported with the APIs or through Fusion pipeline stages. For example, you can use the custom model training user interface or the Models API to train and deploy custom models, but running predictions and chunking text require you to use the APIs or Fusion stages. Some APIs are used in conjunction with other APIs. For example, use the Use Case API and Tokenization API to generate values for the Prediction API.

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.
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
Learn more about integrations.
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 base64 command line utility, like this:
echo -n "CLIENT_ID:CLIENT_SECRET" | base64
Compose your request like this:
curl --request POST \
  --url 'https://identity.lucidworks.com/oauth2/ausao8uveaPmyhv0v357/v1/token?scope=API_SCOPE&grant_type=client_credentials' \
  --header 'Accept: application/json' \
  --header 'Authorization: Basic [CLIENT_ID:CLIENT_SECRET_BASE64]' \
  --header 'Cache-Control: no-cache' \
  --header 'Content-Type: application/x-www-form-urlencoded'
The value of the scope query parameter varies between APIs, and you need a separate access token for each scope:
  • The Models API uses the machinelearning.model scope.
  • All other APIs use the machinelearning.predict scope.
3

Fetch the access token

When you send a successful Authentication API request, the JSON response looks like this:
{
"token_type": "Bearer",
"expires_in": 3600,
"access_token": "ACCESS_TOKEN",
"scope": "API_SCOPE"
}
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.
Once you request a new token, the previous one is deleted even if it has not yet expired. All subsequent API calls must use the new token.

Using the APIs

Once you have an access token, you’re ready to send API requests. The base URL depends on the API:
APIBase URL
Authentication APIhttps://identity.lucidworks.com
Async Chunking APIhttps://APPLICATION_ID.applications.lucidworks.com
Async Prediction APIhttps://APPLICATION_ID.applications.lucidworks.com
Models APIhttps://api.lucidworks.com
Prediction APIhttps://APPLICATION_ID.applications.lucidworks.com
Prompting Preview APIhttps://APPLICATION_ID.applications.lucidworks.com
Tokenization APIhttps://APPLICATION_ID.applications.lucidworks.com
Use Case APIhttps://APPLICATION_ID.applications.lucidworks.com
You can get the 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:
Authorization: Bearer ACCESS_TOKEN
See the Platform API Reference for details about all of the available endpoints. The additional pages in this section also provide information to help you learn about each API.