Predict API (1.0.0)
Download OpenAPI specification:Download
API powering the Predict feature of Algolia.
Get user profile
Get predictions, properties (raw, computed or custom) and segments (computed or custom) for a user profile.
Authorizations:
path Parameters
userID required | string User ID for authenticated users or cookie ID for non-authenticated repeated users (visitors). |
Request Body schema: application/json
modelsToRetrieve | Array of strings (modelsToRetrieve) Items Enum: "funnel_stage" "order_value" "affinities" |
Responses
Request samples
- Payload
{- "modelsToRetrieve": [
- "funnel_stage"
]
}
Response samples
- 200
- 400
- 404
- 405
{- "user": "string",
- "predictions": {
- "funnel_stage": {
- "value": [
- {
- "name": "string",
- "probability": 1
}
], - "lastUpdatedAt": "string"
}, - "order_value": {
- "value": 0,
- "lastUpdatedAt": "string"
}, - "affinities": {
- "value": [
- {
- "name": "string",
- "value": "string",
- "probability": 1
}
], - "lastUpdatedAt": "string"
}
}, - "properties": {
- "raw": { },
- "computed": { },
- "custom": { }
}, - "segments": {
- "computed": [
- "string"
], - "custom": [
- "string"
]
}
}
Delete user profile
Delete all data and predictions associated with an authenticated user (userID) or an anonymous user (cookieID, sessionID).
Authorizations:
path Parameters
userID required | string User ID for authenticated users or cookie ID for non-authenticated repeated users (visitors). |
Responses
Response samples
- 200
- 401
- 404
- 422
- 500
{- "user": "string",
- "deletedUntil": "string"
}
Get all user profiles
Get all users with predictions in the provided application.
Authorizations:
Request Body schema: application/json
modelsToRetrieve | Array of strings (modelsToRetrieve) Items Enum: "funnel_stage" "order_value" "affinities" |
Responses
Request samples
- Payload
{- "modelsToRetrieve": [
- "funnel_stage"
]
}
Response samples
- 200
- 400
- 401
- 422
- 500
{- "users": [
- {
- "user": "string",
- "predictions": {
- "funnel_stage": {
- "value": [
- {
- "name": "string",
- "probability": 1
}
], - "lastUpdatedAt": "string"
}, - "order_value": {
- "value": 0,
- "lastUpdatedAt": "string"
}, - "affinities": {
- "value": [
- {
- "name": "string",
- "value": "string",
- "probability": 1
}
], - "lastUpdatedAt": "string"
}
}, - "properties": {
- "raw": { },
- "computed": { },
- "custom": { }
}, - "segments": {
- "computed": [
- "string"
], - "custom": [
- "string"
]
}
}
], - "previousPageToken": "string",
- "nextPageToken": "string"
}
Get a list of available model types
Get a list of all available model types. Each model type can be activated more than once, by selecting a different data source.
Authorizations:
Responses
Response samples
- 200
- 401
- 422
- 500
[- {
- "name": "string",
- "type": "string",
- "compatibleSources": [
- "bigquery"
], - "dataRequirements": {
- "minUsers": 0,
- "minDays": 0
}
}
]
Get a model’s instance configuration
Get the configuration for a model that was activated.
Authorizations:
path Parameters
modelID required | string The ID of the model to retrieve. |
Responses
Response samples
- 200
- 401
- 404
- 422
- 500
{- "modelID": "string",
- "name": "string",
- "type": "string",
- "sourceID": "string",
- "index": "string",
- "affinities": [
- "string"
], - "contentAttributes": [
- "string"
], - "lastTrained": "string",
- "lastInference": "string",
- "error": "string",
- "status": "pending"
}
Update a model instance
Update a model’s configuration.
Authorizations:
path Parameters
modelID required | string The ID of the model to retrieve. |
Request Body schema: application/json
name | string (name) The model’s instance name. |
affinities | Array of strings (affinities) |
contentAttributes | Array of strings (contentAttributes) |
status | string (status) Enum: "active" "inactive"
|
Responses
Request samples
- Payload
{- "name": "string",
- "affinities": [
- "string"
], - "contentAttributes": [
- "string"
], - "status": "active"
}
Response samples
- 200
- 401
- 404
- 422
- 500
{- "modelID": "string",
- "updatedAt": "string"
}
Delete a model instance
Delete the model’s configuration, pipelines and generated predictions.
Authorizations:
path Parameters
modelID required | string The ID of the model to retrieve. |
Responses
Response samples
- 200
- 401
- 404
- 422
- 500
{- "modelID": "string",
- "deletedUntil": "string"
}
Response samples
- 200
- 401
- 422
- 500
[- {
- "modelID": "string",
- "name": "string",
- "type": "string",
- "sourceID": "string",
- "index": "string",
- "affinities": [
- "string"
], - "contentAttributes": [
- "string"
], - "lastTrained": "string",
- "lastInference": "string",
- "error": "string",
- "status": "pending"
}
]
Activate a model instance
Activate an existing model template. This action triggers the training and inference pipelines for the selected model. The model is added with status=pending
. If a model with the exact same source & index already exists, the API endpoint returns an error.
Authorizations:
Request Body schema: application/json
type required | string (modelsToRetrieve) Enum: "funnel_stage" "order_value" "affinities" |
name required | string (name) The model’s instance name. |
sourceID required | string (sourceID) The data source ID, as returned by the (external) sources API. |
index required | string (index) The index name. |
affinities | Array of strings (affinities) |
contentAttributes | Array of strings (contentAttributes) |
Responses
Request samples
- Payload
{- "type": "funnel_stage",
- "name": "string",
- "sourceID": "string",
- "index": "string",
- "affinities": [
- "string"
], - "contentAttributes": [
- "string"
]
}
Response samples
- 200
- 401
- 422
- 500
{- "modelID": "string",
- "updatedAt": "string"
}
Get a model’s instance metrics
Get the model instance’ training metrics.
Authorizations:
path Parameters
modelID required | string The ID of the model to retrieve. |
Responses
Response samples
- 200
- 401
- 404
- 422
- 500
[- {
- "precision": 0,
- "recall": 0,
- "mrr": 0,
- "coverage": 0,
- "f1_score": 0,
- "updatedAt": "string"
}
]