Decide legacy
POST /v1/organisations/{organisation_id}/workspaces/{workspace_id}/apps/{app_id}/instances/{instance_id}/decisions Deprecated
Asks TypeSafe AI's Jev the instance's questions about a state, all in one call: yes or no, one of several options, or a place on a scale, each answer with its probability and, where Jev gives one, its confidence, so the app acts on confident answers and hands the rest on.
Only the instance's own app token asks (the TypeSafe AI space's app offers it to agents as tools). The call runs on the installation's TypeSafe AI account and is billed in credits as a model call of the app's principal (source decision), within the plan's limits. The state and questions are never logged.
Authentication
Send an API key, or an access token from your organisation’s identity provider, in the Authorization header. How API keys work
Scope the API key needs: conversations:write
Security schemes in the OpenAPI document: session_cookie (cookie __Host-ivy_session)bearer (bearer)api_key (bearer)
Parameters
-
organisation_idpathstringrequired -
workspace_idpathstringrequired -
app_idpathstringrequired -
instance_idpathstringrequired
Request body
application/json DecisionRequest required
-
1 to 16 questions, answered together against the same state.
-
statestringrequiredWhat the questions are about: a message, a document, a situation.
Responses
-
An answer to each question, in the request's order
-
unauthenticated -
usage_limit_reached,billing_restricted,service_identity_limit_reached -
insufficient_scope: only an app instance asks, with its own app token; viewers can't use awriteapp.eu_only_processing: the organisation allows only EU processing, and TypeSafe AI has no EU route.access_revoked: the app's principal lost access, or the space was archived, before the decision ran -
Not the token's organisation or space
-
validation_failedwith thefieldandreason(required,too_long,out_of_range,duplicate,invalid_format,not_allowed);invalid_body -
rate_limited: the instance's requests per minute -
internal -
decision_refused: TypeSafe AI refused the questions -
provider_unavailable: this installation has no TypeSafe AI account, or it didn't answer in time; orunavailable: the database is briefly unavailable; retry afterRetry-Afterseconds
Error codes
Errors come back as an ErrorBody whose code is one of these.
- 401
unauthenticated - 402
usage_limit_reachedbilling_restrictedservice_identity_limit_reached - 403
insufficient_scope - 404
not_foundgeneric code for this status - 422
validation_failedtoo_longout_of_rangeduplicateinvalid_formatnot_allowedinvalid_body - 429
rate_limited - 500
internal - 502
decision_refused - 503
provider_unavailableunavailable
Examples
curl -X POST "$IVY_API_URL/v1/organisations/$ORGANISATION_ID/workspaces/$WORKSPACE_ID/apps/$APP_ID/instances/$INSTANCE_ID/decisions" \
-H "Authorization: Bearer $IVY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"questions": [
{
"id": "id_123",
"kind": "boolean",
"options": [
{
"description": "string",
"name": "Ada Lovelace"
}
],
"prompt": "string",
"scale": [
"string"
]
}
],
"state": "string"
}' import { client, decideLegacy } from "@spacivapp/ivy-sdk";
client.setConfig({
baseUrl: process.env.IVY_API_URL,
headers: { Authorization: `Bearer ${process.env.IVY_API_KEY}` },
});
const { data, error, response } = await decideLegacy({
path: { organisation_id: organisationId, workspace_id: workspaceId, app_id: appId, instance_id: instanceId },
body: {
questions: [
{
id: "id_123",
kind: "boolean",
options: [
{
description: "string",
name: "Ada Lovelace"
}
],
prompt: "string",
scale: [
"string"
]
}
],
state: "string"
},
}); {
"questions": [
{
"id": "id_123",
"kind": "boolean",
"options": [
{
"description": "string",
"name": "Ada Lovelace"
}
],
"prompt": "string",
"scale": [
"string"
]
}
],
"state": "string"
} {
"answers": [
{
"confidence": 1,
"id": "id_123",
"kind": "boolean",
"probabilities": {},
"probability": 1,
"value": false
}
],
"model": "string"
}