Send many outcomes
POST
/v1/outcomes
const url = 'https://api.pensievelabs.co/v1/outcomes';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"items":[{"model":"grade-audit","key":"rust-2291","outcome":"lab_rejected"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pensievelabs.co/v1/outcomes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "items": [ { "model": "grade-audit", "key": "rust-2291", "outcome": "lab_rejected" } ] }'Each item names its call by call_id, or by model and your own key. An item whose call isn’t
recorded yet is kept, and matched when a call with that id, or that model and key, arrives.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Idempotency-Key
string
Any unique string. Sending it again within 24 hours returns the first response.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
items
required
Array<object>
object
call_id
string
model
string
key
string
outcome
required
string
value
number
occurred_at
string format: date-time
note
string
Example
{ "items": [ { "model": "grade-audit", "key": "rust-2291", "outcome": "lab_rejected" } ]}Responses
Section titled “Responses”How many were recorded.
Media typeapplication/json
object
object
required
received
required
How many items were recorded.
integer
ids
required
For each item in order, the call or test case it was recorded as (for a capture with decision_id,
that decision’s call). For an outcome, the call it was matched to, or null while it waits for its
call: it is matched when a call with that id, or that model and key, is recorded.
Array<string | null>
Example
{ "object": "receipt"}default
Section titled “default”Something went wrong; error.type says what.
Media typeapplication/json
object
error
required
object
type
required
string
message
required
string
param
The request field the error is about.
string | null
request_id
required
string
Example
{ "error": { "type": "invalid_request" }}