Download OpenAPI specification:Download
Welcome to the Rainbird API documentation. It contains details of the API calls required to query a Knowledge Map and view evidence for the decisions returned. Knowledge Maps must first be created via the Rainbird Studio. More information on this can be found here.
Authentication with the Rainbird API uses a user key, passed in the header. This can be found on the Account page or with the controls for publishing a Knowledge Map.
Our legacy authentication method of HTTP BasicAuth continues to be supported, but we highly advise transitioning to the new method.
Security Scheme Type | API Key |
---|---|
Header parameter name: | X-API-Key |
Get decisions from your knowledge maps. Start a session, inject any available facts, run a query, provide a response to any questions asked and undo your answers to give a different response.
Note: query, response and undo endpoints can all return either a questionResponse (the reasoning engine needs more information) or a resultResponse (the decision).
Alternatively you can interact with the reasoning engine via natural language. This is in beta, is subject to change and responses may vary due to natural language interpretation.
Start a session with the reasoning engine, specifying the knowledge map and (optionally) the version you require.
By default it will start a session using the live version. If no version has been set live it will default to the draft version.
Alternatively the query parameters “useDraft” or “version” can be used as an override to request either the draft or a specific version. We recommend using a new session for each query, unless you need to make multiple queries within the same context.
kmID required | string The knowledge map ID to start a session against |
useDraft | boolean Flag to use the draft version of the knowledge map, cannot be used simultaneously with 'version' parameter |
version | integer Parameter to use a specific version of the map, cannot be used simultaneously with 'useDraft' parameter |
curl -i -X GET \ 'https://api.rainbird.ai/start/:kmID?useDraft=true&version=0' \ -H 'X-API-Key: YOUR_API_KEY_HERE'
{- "id": "c1bf18d7-d1f0-44bc-a639-8cd4ded56dce",
- "kmVersion": {
- "id": "77135768-7634-49f0-9fbf-ed915ce08a66"
}
}
Inject an array of facts as triples. For large requests we recommend injecting in batches of 250 facts.
sessionID required | string The session to inject facts into |
Array of facts to inject
subject required | string (Subject) The subject side concept instance or value |
relationship required | string (Relationship) The relationship between subject and object |
required | string or number or boolean (Object) The object side concept instance or value |
certainty required | number (Certainty) [ 1 .. 100 ] How certain this fact or answer is |
[- {
- "subject": "Ben",
- "relationship": "holds",
- "object": "Gold",
- "certainty": 100
}
]
{- "result": "OK"
}
A query is the method to get decisions from your knowledge map. You query a relationship in the knowledge map and provide either the subject, the object or both. More information can be found here.
sessionID required | string The session to query against |
Query for the engine to try to answer
subject | string (Subject) The subject side concept instance or value |
relationship required | string (Relationship) The relationship between subject and object |
string or number or boolean (Object) The object side concept instance or value |
{- "subject": "Ben",
- "relationship": "can claim"
}
{- "question": {
- "subject": "Ben",
- "dataType": "string",
- "relationship": "suffered",
- "type": "Second Form Object",
- "plural": true,
- "allowCF": true,
- "allowUnknown": false,
- "canAdd": true,
- "prompt": "What type of loss has Ben suffered?",
- "knownAnswers": [ ],
- "concepts": [
- {
- "conceptType": "loss",
- "name": "cosmetic damage",
- "type": "string",
- "value": "cosmetic damage"
}, - {
- "conceptType": "loss",
- "name": "water damage",
- "type": "string",
- "value": "water damage"
}, - {
- "conceptType": "loss",
- "name": "loss",
- "type": "string",
- "value": "loss"
}, - {
- "conceptType": "loss",
- "name": "theft",
- "type": "string",
- "value": "theft"
}
]
}, - "sid": "c1bf18d7-d1f0-44bc-a639-8cd4ded56dce"
}
If you have received a questionResponse from the query, response or undo endpoints, you can submit an array of answers. These must be provided as triples.
Note: properties returned in the question object will determine how you can respond.
sessionID required | string The session to send responses to |
Items to send as a response
Array of objects |
{- "answers": [
- {
- "subject": "Ben",
- "relationship": "suffered",
- "object": "water damage",
- "certainty": 100
}
]
}
{- "question": {
- "subject": "Ben",
- "dataType": "string",
- "relationship": "suffered",
- "type": "Second Form Object",
- "plural": true,
- "allowCF": true,
- "allowUnknown": false,
- "canAdd": true,
- "prompt": "What type of loss has Ben suffered?",
- "knownAnswers": [ ],
- "concepts": [
- {
- "conceptType": "loss",
- "name": "cosmetic damage",
- "type": "string",
- "value": "cosmetic damage"
}, - {
- "conceptType": "loss",
- "name": "water damage",
- "type": "string",
- "value": "water damage"
}, - {
- "conceptType": "loss",
- "name": "loss",
- "type": "string",
- "value": "loss"
}, - {
- "conceptType": "loss",
- "name": "theft",
- "type": "string",
- "value": "theft"
}
]
}, - "sid": "c1bf18d7-d1f0-44bc-a639-8cd4ded56dce"
}
A method to undo the previous answer array posted to the response endpoint. This rolls back the session, removing any facts inferred from the answer array and returns the original question. A different answer can be provided or undo can be used again to further roll-back the session.
Note: when there are no further answers to undo, the same question will be returned.
sessionID required | string The session to step back with an undo |
An empty object
{ }
{- "question": {
- "subject": "Ben",
- "dataType": "string",
- "relationship": "suffered",
- "type": "Second Form Object",
- "plural": true,
- "allowCF": true,
- "allowUnknown": false,
- "canAdd": true,
- "prompt": "What type of loss has Ben suffered?",
- "knownAnswers": [ ],
- "concepts": [
- {
- "conceptType": "loss",
- "name": "cosmetic damage",
- "type": "string",
- "value": "cosmetic damage"
}, - {
- "conceptType": "loss",
- "name": "water damage",
- "type": "string",
- "value": "water damage"
}, - {
- "conceptType": "loss",
- "name": "loss",
- "type": "string",
- "value": "loss"
}, - {
- "conceptType": "loss",
- "name": "theft",
- "type": "string",
- "value": "theft"
}
]
}, - "sid": "c1bf18d7-d1f0-44bc-a639-8cd4ded56dce"
}
Given a body of text, the endpoint will return a question, result or an error.
If a questionResponse is received, the question prompt can be displayed in a UI or used to embed and search a vector store to solicit an answer. The data containing the answer can be resubmitted in a new interact request, ensuring the same session ID is used. Please note: when a questionResponse has been received, the session is locked to the current query in progress. Therefore, if any additional requests contain a new question asked to Rainbird, the new question will be ignored until a result is received.
If a resultResponse is received, this contains the answer to the user's original question and can be presented as required. Once a resultResponse is received, the session is unlocked and further queries can be made in that session.
If an error response is received, this may be due to an internal error, but it can also be caused by such things as not being able to detect the query, the question being asked in an unfamiliar way, or the knowledge map not being designed to answer it. A suggested error response is included that can be used in chat interfaces. Alternatively, the error code can be mapped to your own custom error messages.
Version required | string Default: v1 Version of the natural language API |
User prompt for natural language processing
sessionID required | string The session ID needed to access that specific session |
userPrompt required | string The user's prompt for natural language processing |
{- "sessionID": "bdef015c-0ab4-417c-982f-b8d9ff48efc1",
- "userPrompt": "Can Ben claim?"
}
{- "responseType": "question",
- "facts": { },
- "metadata": {
- "querySubmittedAt": "2025-07-10T10:49:13.231973361Z",
- "languageEngineResponseTime": 2173,
- "llmTokens": {
- "completionTokens": 52,
- "promptTokens": 3117,
- "totalTokens": 3169
}, - "apiVersion": "",
- "endpoint": "interact",
- "sessionID": "bdef015c-0ab4-417c-982f-b8d9ff48efc1"
}, - "query": {
- "subject": "Ben",
- "relationship": "can claim",
- "object": null
}, - "questions": [
- {
- "allowCF": true,
- "canAdd": true,
- "concepts": [
- {
- "conceptType": "policy",
- "name": "Gold",
- "type": "string",
- "value": "Gold"
}, - {
- "conceptType": "policy",
- "name": "Silver",
- "type": "string",
- "value": "Silver"
}, - {
- "conceptType": "policy",
- "name": "Bronze",
- "type": "string",
- "value": "Bronze"
}
], - "dataType": "string",
- "prompt": "Which policy does Ben hold?",
- "relationship": "holds",
- "subject": "Ben",
- "type": "Second Form Object"
}
], - "results": null
}
View the source of the fact, including how it was derived when inferred from a rule.
factID required | string The factID for which to retrieve evidence |
sessionID required | string The sessionID where the fact was created |
curl -i -X GET \ https://api.rainbird.ai/analysis/evidence/:factID/:sessionID
{- "factID": "WA:RF:82a7b990eb2fe491389f37de10b1cd752cbd692b8c2c0d3fb36b354491f68173",
- "source": "rule",
- "fact": {
- "subject": {
- "type": "policy holder",
- "value": "Ben",
- "dataType": "string"
}, - "relationship": {
- "type": "can claim"
}, - "object": {
- "type": "claim",
- "value": "repair",
- "dataType": "string"
}, - "certainty": 100
}, - "time": 1752142054143,
- "rule": {
- "bindings": {
- "EQUIPMENT": "mobile phone",
- "LOSS": "water damage",
- "O": "repair",
- "POLICY": "Gold",
- "S": "Ben"
}, - "conditions": [
- {
- "certainty": 100,
- "factID": "WA:IF:af4d81cc4d1175c0c488d6632599f718520366541ce99e61fc83eff7f640749a",
- "factKey": "9c141933-344b-4d36-a3ef-ffdd96fbcb81",
- "impact": 14.29,
- "object": "Gold",
- "objectType": "string",
- "relationship": "holds",
- "salience": 100,
- "subject": "Ben"
}, - {
- "certainty": 100,
- "factID": "WA:KF:c2a63a881f856798e2df8999d7b7956bc28dd50e8e99d6728ca46730955263c1",
- "impact": 14.29,
- "object": "repair",
- "objectType": "string",
- "relationship": "provides",
- "salience": 100,
- "subject": "Gold"
}, - {
- "certainty": 100,
- "factID": "WA:AF:82b2bc07382e0372685aa06e30b1c9db95ccc30051cfc2ea3de4c2e7fc69d0c6",
- "factKey": "04b02c60-73c1-436c-b0d3-1ee44df7c14b",
- "impact": 14.29,
- "object": "water damage",
- "objectType": "string",
- "relationship": "suffered",
- "salience": 100,
- "subject": "Ben"
}, - {
- "certainty": 100,
- "factID": "WA:KF:cb08149770bded892f06d37433c305f4f4667837323167d21580b24de3a9c5dd",
- "impact": 14.29,
- "object": "water damage",
- "objectType": "string",
- "relationship": "appropriate for",
- "salience": 100,
- "subject": "repair"
}, - {
- "certainty": 100,
- "factID": "WA:KF:ec6e5652be4a48515d68c795b0497e87d6beeb83a384c4ae11ca562c6ba0e499",
- "impact": 14.29,
- "object": "mobile phone",
- "objectType": "string",
- "relationship": "insures",
- "salience": 100,
- "subject": "Gold"
}, - {
- "certainty": 100,
- "factID": "WA:AF:c6a366105ea7691fffae2e75fe27293bd66b4155d352213cee51368272af07b6",
- "factKey": "22667649-4df6-4731-9498-e4eb9c25d22c",
- "impact": 14.29,
- "object": "mobile phone",
- "objectType": "string",
- "relationship": "happened to",
- "salience": 100,
- "subject": "water damage"
}, - {
- "certainty": 100,
- "factID": "WA:KF:7467c2c1c00149ac477f0246173ef9cb19d08243624b52ddf8a7e05791cd5550",
- "impact": 14.29,
- "object": "water damage",
- "objectType": "string",
- "relationship": "covers",
- "salience": 100,
- "subject": "Gold"
}
], - "ruleMaxCertainty": 100
}
}
View a log of interaction events within the session, including queries, injected facts, questions asked, answers given and results returned.
Note: interaction log recording is switched off by default. It must be enabled in the Studio per version per knowledge map. Only sessions started after it is enabled will be recorded.
sessionID required | string The session id to access the interaction logs |
format | string Format of the retrieved data. CSV or JSON |
curl -i -X GET \ 'https://api.rainbird.ai/analysis/interactions/:sessionID?format=string'
[- {
- "values": {
- "start": {
- "useDraft": false,
- "kmVersionID": "77135768-7634-49f0-9fbf-ed915ce08a66",
- "sessionID": "c1bf18d7-d1f0-44bc-a639-8cd4ded56dce"
}
}, - "event": "start",
- "created": "2025-07-10T10:06:27.780Z"
}, - {
- "values": {
- "facts": [
- {
- "subject": "Ben",
- "object": "Gold",
- "relationship": "holds",
- "certainty": 100
}
]
}, - "event": "inject",
- "created": "2025-07-10T10:06:37.987Z"
}, - {
- "values": {
- "query": {
- "subject": "Ben",
- "relationship": "can claim"
}
}, - "event": "query",
- "created": "2025-07-10T10:06:44.532Z"
}, - {
- "values": {
- "questions": [
- {
- "prompt": "What type of loss has Ben suffered?",
- "relationship": "suffered",
- "subject": "Ben"
}
]
}, - "event": "question",
- "created": "2025-07-10T10:06:44.713Z"
}, - {
- "values": {
- "answers": [
- {
- "subject": "Ben",
- "object": "water damage",
- "relationship": "suffered",
- "certainty": 100
}
]
}, - "event": "answer",
- "created": "2025-07-10T10:07:19.252Z"
}, - {
- "values": {
- "questions": [
- {
- "prompt": "What item of equipment suffered water damage?",
- "relationship": "happened to",
- "subject": "water damage"
}
]
}, - "event": "question",
- "created": "2025-07-10T10:07:19.523Z"
}, - {
- "values": {
- "answers": [
- {
- "subject": "water damage",
- "object": "mobile phone",
- "relationship": "happened to",
- "certainty": 100
}
]
}, - "event": "answer",
- "created": "2025-07-10T10:07:34.098Z"
}, - {
- "values": {
- "results": [
- {
- "subject": "Ben",
- "object": "repair",
- "relationship": "can claim",
- "certainty": 100
}, - {
- "subject": "Ben",
- "object": "new replacement",
- "relationship": "can claim",
- "certainty": 97
}
]
}, - "event": "result",
- "created": "2025-07-10T10:07:34.276Z"
}
]
Access session information, such as all of the facts available within a session, or version information for the knowledge map used in a session.
sessionID required | string The sessionID of the session |
filter | Array of strings Default: ["version"] The type of information requested. |
relationships | Array of strings A comma-separated list of relationships to filter the session data by. |
curl -i -X GET \ 'https://api.rainbird.ai/analysis/session/:sessionID?filter=version&relationships=string' \ -H 'X-API-Key: YOUR_API_KEY_HERE'
{- "km": {
- "id": "77135768-7634-49f0-9fbf-ed915ce08a66",
- "name": "Loss Assessment",
- "versionID": "77135768-7634-49f0-9fbf-ed915ce08a66",
- "versionCreated": "2025-07-09T14:27:22Z",
- "versionStatus": "Draft"
}
}
Get a natural language explanation of the chain of reasoning for any given fact.
Version required | string Default: v1 Version of the natural language API |
Language, factID, and sessionID for natural language processing
language required | string The users preferred language setting i.e. "en", "za" |
sessionID required | string The session ID needed to access that specific session |
factID required | string The ID of a fact specific to that session to retrieve data from |
{- "language": "en",
- "sessionID": "bdef015c-0ab4-417c-982f-b8d9ff48efc1",
- "factID": "WA:RF:e1d3a2380a814cea00d5a1adf69b2cdafba0e0228192cd8014400925bb4422ea"
}
{- "explanation": "Based on the information provided, Ben can claim for a repair. This decision is supported by several key facts:\n\nBen holds a Gold policy, which provides comprehensive coverage for his mobile phone. The Gold policy specifically covers water damage, which is the type of loss Ben has suffered. \n\nThe incident in question involves water damage to Ben's mobile phone. This aligns with the coverage provided by his Gold policy, as the policy explicitly insures mobile phones and covers water damage.\n\nIn response to this type of loss, a repair claim is deemed appropriate. The Gold policy includes provisions for repair claims, making this a suitable course of action for addressing the water damage to Ben's mobile phone.\n\nAll of these factors come together to support the conclusion that Ben is eligible to claim for a repair of his water-damaged mobile phone under his Gold policy.",
- "metadata": {
- "querySubmittedAt": "2025-07-10T11:16:12.597111859Z",
- "languageEngineResponseTime": 5538,
- "llmTokens": {
- "completionTokens": 174,
- "promptTokens": 726,
- "totalTokens": 900
}, - "apiVersion": "",
- "endpoint": "explain",
- "sessionID": "bdef015c-0ab4-417c-982f-b8d9ff48efc1"
}
}