Query & workflows
Get a saved AI query
Returns one saved AI Query with its conversation. Each message that produced a query version carries that version as queryConfig, and isSelected marks the version currently selected in the app.
GET
/
v1
/
query
/
sessions
/
{sessionId}
Get a saved AI query
curl --request GET \
--url https://api.orion.file.ai/prod/v1/query/sessions/{sessionId} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.orion.file.ai/prod/v1/query/sessions/{sessionId}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.orion.file.ai/prod/v1/query/sessions/{sessionId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "6ad0d4f5588cb7527658c099",
"name": "Invoice lines with account and job codes",
"isDraft": true,
"includeSubfolders": true,
"locations": [
{
"id": "6acc52de30b8532b2eefd6b0",
"name": "Invoices",
"description": "Supplier invoices"
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"messages": [
{
"id": "6ad0d4f5588cb7527658c09a",
"role": "user",
"content": "<string>",
"plainContent": "<string>",
"mentionReferList": [
{
"mentionId": "<string>",
"type": "schema",
"text": "Invoice",
"info": {}
}
],
"isQueryConfigModified": true,
"isSelected": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"configId": "<string>",
"queryConfig": {},
"queryConfigModifiedAt": "2023-11-07T05:31:56Z"
}
],
"selectedMessageId": "<string>"
}{
"type": "https://errors.file.ai/validation-failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields are invalid.",
"instance": "/v1/files/upload",
"code": "VALIDATION_FAILED",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [
{
"code": "REQUIRED",
"detail": "must not be empty",
"pointer": "#/fileName",
"parameter": "limit"
}
],
"message": "Validation failed",
"error": "Unprocessable Entity",
"statusCode": 422,
"retryAfter": 42
}{
"type": "https://errors.file.ai/validation-failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields are invalid.",
"instance": "/v1/files/upload",
"code": "VALIDATION_FAILED",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [
{
"code": "REQUIRED",
"detail": "must not be empty",
"pointer": "#/fileName",
"parameter": "limit"
}
],
"message": "Validation failed",
"error": "Unprocessable Entity",
"statusCode": 422,
"retryAfter": 42
}{
"type": "https://errors.file.ai/not-found",
"title": "Not found",
"status": 404,
"detail": "No such query session.",
"instance": "/v1/{route}",
"code": "NOT_FOUND",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [],
"message": "No such query session.",
"error": "Not Found",
"statusCode": 404
}{
"type": "https://errors.file.ai/validation-failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields are invalid.",
"instance": "/v1/files/upload",
"code": "VALIDATION_FAILED",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [
{
"code": "REQUIRED",
"detail": "must not be empty",
"pointer": "#/fileName",
"parameter": "limit"
}
],
"message": "Validation failed",
"error": "Unprocessable Entity",
"statusCode": 422,
"retryAfter": 42
}{
"type": "https://errors.file.ai/validation-failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields are invalid.",
"instance": "/v1/files/upload",
"code": "VALIDATION_FAILED",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [
{
"code": "REQUIRED",
"detail": "must not be empty",
"pointer": "#/fileName",
"parameter": "limit"
}
],
"message": "Validation failed",
"error": "Unprocessable Entity",
"statusCode": 422,
"retryAfter": 42
}{
"type": "https://errors.file.ai/validation-failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields are invalid.",
"instance": "/v1/files/upload",
"code": "VALIDATION_FAILED",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [
{
"code": "REQUIRED",
"detail": "must not be empty",
"pointer": "#/fileName",
"parameter": "limit"
}
],
"message": "Validation failed",
"error": "Unprocessable Entity",
"statusCode": 422,
"retryAfter": 42
}Request · Response
More details
More details
queryConfig is returned exactly as POST /v1/query/execute accepts it,
so to run the selected version, send its queryConfig to that endpoint
unchanged.
Authorizations
API key for authentication
Path Parameters
Saved query to read.
Response
The saved query.
Saved query id, used by GET /v1/query/sessions/{sessionId}.
Example:
"6ad0d4f5588cb7527658c099"
Example:
"Invoice lines with account and job codes"
True while the query is an unpublished draft.
Whether the query also covers subfolders of its locations.
Folders the query is saved to. Empty when it has none.
Show child attributes
Show child attributes
The conversation, oldest first.
Show child attributes
Show child attributes
Id of the message whose query version is selected in the app, or null if none is.
⌘I
Get a saved AI query
curl --request GET \
--url https://api.orion.file.ai/prod/v1/query/sessions/{sessionId} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.orion.file.ai/prod/v1/query/sessions/{sessionId}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.orion.file.ai/prod/v1/query/sessions/{sessionId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "6ad0d4f5588cb7527658c099",
"name": "Invoice lines with account and job codes",
"isDraft": true,
"includeSubfolders": true,
"locations": [
{
"id": "6acc52de30b8532b2eefd6b0",
"name": "Invoices",
"description": "Supplier invoices"
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"messages": [
{
"id": "6ad0d4f5588cb7527658c09a",
"role": "user",
"content": "<string>",
"plainContent": "<string>",
"mentionReferList": [
{
"mentionId": "<string>",
"type": "schema",
"text": "Invoice",
"info": {}
}
],
"isQueryConfigModified": true,
"isSelected": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"configId": "<string>",
"queryConfig": {},
"queryConfigModifiedAt": "2023-11-07T05:31:56Z"
}
],
"selectedMessageId": "<string>"
}{
"type": "https://errors.file.ai/validation-failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields are invalid.",
"instance": "/v1/files/upload",
"code": "VALIDATION_FAILED",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [
{
"code": "REQUIRED",
"detail": "must not be empty",
"pointer": "#/fileName",
"parameter": "limit"
}
],
"message": "Validation failed",
"error": "Unprocessable Entity",
"statusCode": 422,
"retryAfter": 42
}{
"type": "https://errors.file.ai/validation-failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields are invalid.",
"instance": "/v1/files/upload",
"code": "VALIDATION_FAILED",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [
{
"code": "REQUIRED",
"detail": "must not be empty",
"pointer": "#/fileName",
"parameter": "limit"
}
],
"message": "Validation failed",
"error": "Unprocessable Entity",
"statusCode": 422,
"retryAfter": 42
}{
"type": "https://errors.file.ai/not-found",
"title": "Not found",
"status": 404,
"detail": "No such query session.",
"instance": "/v1/{route}",
"code": "NOT_FOUND",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [],
"message": "No such query session.",
"error": "Not Found",
"statusCode": 404
}{
"type": "https://errors.file.ai/validation-failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields are invalid.",
"instance": "/v1/files/upload",
"code": "VALIDATION_FAILED",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [
{
"code": "REQUIRED",
"detail": "must not be empty",
"pointer": "#/fileName",
"parameter": "limit"
}
],
"message": "Validation failed",
"error": "Unprocessable Entity",
"statusCode": 422,
"retryAfter": 42
}{
"type": "https://errors.file.ai/validation-failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields are invalid.",
"instance": "/v1/files/upload",
"code": "VALIDATION_FAILED",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [
{
"code": "REQUIRED",
"detail": "must not be empty",
"pointer": "#/fileName",
"parameter": "limit"
}
],
"message": "Validation failed",
"error": "Unprocessable Entity",
"statusCode": 422,
"retryAfter": 42
}{
"type": "https://errors.file.ai/validation-failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields are invalid.",
"instance": "/v1/files/upload",
"code": "VALIDATION_FAILED",
"requestId": "0f1c8e03-978e-40d5-bc93-6894a57f9324",
"errors": [
{
"code": "REQUIRED",
"detail": "must not be empty",
"pointer": "#/fileName",
"parameter": "limit"
}
],
"message": "Validation failed",
"error": "Unprocessable Entity",
"statusCode": 422,
"retryAfter": 42
}