{"openapi":"3.1.0","info":{"title":"Datagoat API","version":"1.0.0","description":"Ask yes/no, score, choice and rank questions about cases. Datagoat answers from what happened to cases like them: deterministic, with reasons, signed, and it refuses rather than guess. MCP: https://api.datagoat.io/mcp","contact":{"url":"https://datagoat.io"}},"servers":[{"url":"https://api.datagoat.io"}],"security":[{"bearer":[]}],"tags":[{"name":"ask","description":"The one call."},{"name":"supporting","description":"Data, tasks, outcomes, drift, verification."}],"paths":{"/v1/ask":{"post":{"operationId":"dg_ask","summary":"Ask","description":"Answers typed questions about cases from a record of past outcomes. Question types: yesno (the chance the outcome happens), score (that chance as a level: unlikely, possible, likely, very_likely), choice (the best option for each case, with each option's chance, most_likely and least_likely; choice is the only type that needs outcome_is_desirable), rank (cases in order of the chance). Questions about one record can share one call, and questions on the same outcome and outcome_is_desirable share one fit. The record can be a table (one row per case) or, with shape, an event log, a time series, a panel, sensor signals or agent traces. Each answer has a state: answered; refused (the record holds no pattern that holds on held-out rows, and the same call returns the same refusal); or not_yet (too few labeled rows; needs.labeled_rows gives how many more). An answered case carries p, up to four reasons (column, value, likelihood_direction, strength) and a signed Verdict. Reasons are associations, not causes; likelihood_direction is the direction the chance moved, not whether that is good news. Answers are deterministic: the same record and question give the same answer. A first fit on a large record returns status pending with a task_id for dg_poll. Free to try on the samples, e.g. data.dataset_id sample:saas_churn, entity_column customer_id, outcome_column churned, cases {ids: [\"cust_0001\"]}. Cost: one decision per answered case; refusals and not_yet are free","tags":["ask"],"x-dg-cost":"one decision per answered case; the first ask on a record also runs a fit","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_ask_input"}}}},"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_ask_output"}}}},"202":{"description":"Pending: poll dg_poll with task_id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_ask_output"}}}},"default":{"description":"Problem","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/add-dataset":{"post":{"operationId":"dg_add_dataset","summary":"Add a dataset","description":"Stores a table so later asks can name it by dataset_id. Free. Takes rows or csv (up to 10,000 rows per call), a fetch_url to download, or upload: true for a presigned PUT URL (large files). Calling again with the returned dataset_id and more rows appends a piece; pieces append in order until the first ask seals the dataset, and a piece with different columns is refused. Returns dataset_id, status (ready | open | awaiting_upload), rows and columns. A stored dataset is deleted 24 hours after it was last used, or at once with dg_delete_dataset","tags":["supporting"],"x-dg-cost":"free","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_add_dataset_input"}}}},"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_add_dataset_output"}}}},"default":{"description":"Problem","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/poll":{"post":{"operationId":"dg_poll","summary":"Poll a task","description":"Free. Returns the current state of a pending task (a first ask on a large record): status pending until it finishes, then the same object the original call would have returned. retry_after_ms is the suggested wait between polls. Re-sending the original call instead would start a second fit. Results are kept for 24 hours","tags":["supporting"],"x-dg-cost":"free","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_poll_input"}}}},"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_poll_output"}}}},"default":{"description":"Problem","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/preflight":{"post":{"operationId":"dg_preflight","summary":"Check a table before asking","description":"Free; fits nothing. Reports whether a table is worth asking about before the first ask: grain (whether one row is one kind of thing), resolutions (what each column's values are; an ambiguous column is not a sound predictor), and fitness (positives per usable predictor over labeled rows). blocking entries mean an answer from this table would not be believable; advisory entries are worth reading. It reports and refuses nothing, and a clean preflight does not promise a pattern exists. Tables only","tags":["supporting"],"x-dg-cost":"free","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_preflight_input"}}}},"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_preflight_output"}}}},"default":{"description":"Problem","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/report-outcomes":{"post":{"operationId":"dg_report_outcomes","summary":"Report what happened","description":"Free. Records the real outcome for cases answered under a model_ref: outcome is yes/no (0/1, true/false), observed_at is when it was observed, event_id is the caller's idempotency key. Outcomes are evidence about the model's track record; they do not change a model or an answer. Needs a key with the write:outcomes capability","tags":["supporting"],"x-dg-cost":"free","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_report_outcomes_input"}}}},"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_report_outcomes_output"}}}},"default":{"description":"Problem","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/drift":{"post":{"operationId":"dg_drift","summary":"Has the pattern moved?","description":"Free. For a model_ref from an ask that named refit_of, compares the new fit with the old: pattern is unchanged | changed | no_prior, and recommendation is keep | refit | abandon. The chain is built by asking again on the new version of a record with refit_of set to the previous model_ref. A single refusal on a refresh is not drift","tags":["supporting"],"x-dg-cost":"free","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_drift_input"}}}},"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_drift_output"}}}},"default":{"description":"Problem","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/verify":{"post":{"operationId":"dg_verify","summary":"Verify a Verdict","description":"Free, and needs no key over REST. Checks that a Verdict is genuine and unaltered. Takes the verdict and signature exactly as received (re-serialising them breaks the signature). Returns status: valid | invalid_signature | expired | unknown_key. An expired Verdict is stale and its question can be asked again. Public keys: https://api.datagoat.io/.well-known/jwks.json","tags":["supporting"],"x-dg-cost":"free","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_verify_input"}}}},"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_verify_output"}}}},"default":{"description":"Problem","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/describe":{"post":{"operationId":"dg_describe","summary":"What Datagoat can do","description":"Free. Lists the question types, record shapes, answer states, limits, prices and the free sample datasets, each sample with a ready-to-run ask","tags":["supporting"],"x-dg-cost":"free","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_describe_input"}}}},"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_describe_output"}}}},"default":{"description":"Problem","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/delete-dataset":{"post":{"operationId":"dg_delete_dataset","summary":"Delete a dataset","description":"Free. Deletes a stored dataset now: its rows are removed from storage and its dataset_id stops working. Fitted models hold no rows and are not affected. Without this call a dataset is deleted 24 hours after it was last used","tags":["supporting"],"x-dg-cost":"free","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_delete_dataset_input"}}}},"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dg_delete_dataset_output"}}}},"default":{"description":"Problem","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/register":{"post":{"operationId":"register_agent","summary":"Get a free test key","description":"No credential needed. Returns a dgk_test_ key that works on the sample datasets only. Rate-limited per address. For your own data, create a live key at https://datagoat.io/keys.","security":[],"responses":{"201":{"description":"A test key, shown once.","content":{"application/json":{"schema":{"type":"object","properties":{"api_key":{"type":"string"},"mode":{"const":"test"},"note":{"type":"string"}},"required":["api_key","mode"]}}}},"default":{"description":"Problem","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"A dgk_live_ / dgk_test_ key, or an OAuth access token."}},"schemas":{"Problem":{"type":"object","description":"RFC 9457 problem. Read `code` and `remedy`; `field` names the argument at fault.","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"code":{"type":"string"},"remedy":{"type":"string"},"field":{"type":"string"},"request_id":{"type":"string"}},"required":["type","title","status","detail","code","remedy"]},"dg_ask_input":{"type":"object","properties":{"data":{"type":"object","properties":{"dataset_id":{"description":"A dataset from dg_add_dataset (ds_…), or a free sample (sample:…; dg_describe lists them).","type":"string","minLength":1},"rows":{"description":"Inline rows, one object per case. Up to 10,000 rows; for more, use dg_add_dataset.","minItems":1,"maxItems":10000,"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"csv":{"description":"Inline CSV text with a header row.","type":"string","minLength":1,"maxLength":8000000},"fetch_url":{"description":"A public https URL Datagoat downloads the CSV from. No redirects; private and internal hosts are refused.","type":"string","format":"uri"},"fetch_headers":{"description":"Headers to send with fetch_url, e.g. an Authorization header for a private object.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"additionalProperties":false},"entity_column":{"description":"The column naming each case, e.g. customer_id.","type":"string","minLength":1},"subject_kind":{"description":"What each case is. person turns on decision-support safeguards.","type":"string","enum":["person","org","object","event","other"]},"questions":{"type":"object","propertyNames":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"additionalProperties":{"type":"object","properties":{"type":{"description":"yesno: the chance the outcome happens. score: that chance as a level. choice: the best option (needs outcome_is_desirable), with each option's chance, most_likely and least_likely. rank: cases in order of the chance.","type":"string","enum":["yesno","score","choice","rank"]},"outcome_column":{"description":"The yes/no column to learn. Required except for choice with option_outcomes.","type":"string","minLength":1},"outcome_is_desirable":{"description":"true when the outcome is one you WANT (converted, renewed, repaid); false when you want to avoid it (churned, defaulted, failed). Optional except on choice; when absent, Datagoat does not fill it in.","type":"boolean"},"positive_values":{"description":"Values of the outcome column that mean yes. Omit when the column has two values such as 0/1, true/false or yes/no.","minItems":1,"type":"array","items":{"type":"string"}},"levels":{"description":"score only. Level names, lowest first. Default: unlikely, possible, likely, very_likely.","minItems":2,"maxItems":10,"type":"array","items":{"type":"string","minLength":1}},"cuts":{"description":"score only. One fewer than levels, strictly ascending. Default: 0.25, 0.50, 0.75.","minItems":1,"maxItems":9,"type":"array","items":{"type":"number","exclusiveMinimum":0,"exclusiveMaximum":1}},"option_column":{"description":"choice only. A column you control (team, channel, offer, contract). Each case is scored once per option, and the best option is named.","type":"string","minLength":1},"options":{"description":"choice with option_column: the values to try.","minItems":2,"maxItems":255,"type":"array","items":{"type":"string"}},"option_outcomes":{"description":"choice only, other form: {option: outcome_column}, one learned outcome per option (2 to 32).","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","minLength":1}},"top_k":{"description":"rank only. How many to return. Default 20.","type":"integer","minimum":1,"maximum":1000},"refit_of":{"description":"The model_ref of an earlier answer on an older version of this record. Adds a drift report, and links the two for dg_drift.","type":"string","pattern":"^mr1_[0-9a-f]{32}$"}},"required":["type"],"additionalProperties":false}},"cases":{"description":"The cases to answer about. Required for yesno, score and choice. Omit for rank to rank the whole record.","type":"object","properties":{"ids":{"description":"Cases already in the record, by entity id. With several rows per id, the latest wins (see time_column).","minItems":1,"maxItems":10000,"type":"array","items":{"type":"string","minLength":1}},"rows":{"description":"New cases, one object per case. Each needs the entity column and every column the model uses.","minItems":1,"maxItems":10000,"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"additionalProperties":false},"time_column":{"description":"The time column. Orders rows, so cases by id take each id's latest row. Required with every shape except table.","type":"string","minLength":1},"shape":{"description":"How to read the record when it is not one row per case: an event log, a series, a panel, signals or traces. Omit for a table. The engine reads the record into rows per case before it fits; see dg_describe for each shape with a ready-to-run ask.","type":"object","properties":{"kind":{"description":"table: one row per case (the default). events: an event log, many rows per case. series: a time series per case, one row per case per period, with an outcome on each row. panel: periods per case, with the outcome read from a column's trend or final window. signals: timestamped sensor readings, with fault or event intervals in the same table. traces: a log of runs (one row per run) with agent, task or tool columns.","type":"string","enum":["table","events","series","panel","signals","traces"]},"event_column":{"description":"events, signals: the column naming the event type.","type":"string","minLength":1,"maxLength":200},"value_columns":{"description":"series (required): the numeric columns to summarise over trailing windows. events: amounts to sum and average.","minItems":1,"maxItems":24,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"signal_columns":{"description":"signals (required): the numeric sensor columns.","minItems":1,"maxItems":24,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"event_start_column":{"description":"signals: when an event interval starts. A row with an event_column value is an interval, not a reading.","type":"string","minLength":1,"maxLength":200},"event_end_column":{"description":"signals: when an event interval ends.","type":"string","minLength":1,"maxLength":200},"agent_column":{"description":"traces: the agent that ran.","type":"string","minLength":1,"maxLength":200},"task_column":{"description":"traces: the task it ran.","type":"string","minLength":1,"maxLength":200},"tool_column":{"description":"traces: the tool it used.","type":"string","minLength":1,"maxLength":200},"label":{"description":"events (required): {lapsed: true}, or {name, when}. panel (required): {trend_of, direction?, alpha?}, or {window_of, periods?, agg?}.","anyOf":[{"anyOf":[{"description":"1 when the case has no event at all in the last horizon_days of the log.","type":"object","properties":{"lapsed":{"type":"boolean","const":true}},"required":["lapsed"],"additionalProperties":false},{"type":"object","properties":{"name":{"description":"Lowercase, digits and underscores. Becomes the outcome column {name}_next_{horizon_days}d.","type":"string","maxLength":40,"pattern":"^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$"},"when":{"description":"1 when ANY event in the last horizon_days matches. A leaf is {column, op, value}; combine leaves with {all: [...]} or {any: [...]}.","$ref":"#/$defs/__schema0"}},"required":["name","when"],"additionalProperties":false}]},{"anyOf":[{"type":"object","properties":{"trend_of":{"description":"A numeric column. The outcome is 1 when this column shows a significant trend across the case's periods.","type":"string","minLength":1,"maxLength":200},"direction":{"description":"Default down.","type":"string","enum":["down","up"]},"alpha":{"description":"Significance level. Default 0.1.","anyOf":[{"type":"number","const":0.05},{"type":"number","const":0.1}]}},"required":["trend_of"],"additionalProperties":false},{"type":"object","properties":{"window_of":{"description":"A yes/no column observed each period. The outcome is its value over the last periods of each case.","type":"string","minLength":1,"maxLength":200},"periods":{"description":"How many final periods form the outcome window. Default 1.","anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4}]},"agg":{"description":"How the window's values combine. Default max: yes if any period says yes.","type":"string","enum":["max","min","last","any"]}},"required":["window_of"],"additionalProperties":false}]}]},"horizon_days":{"description":"events: the outcome window at the end of the log, in days. Default 30.","anyOf":[{"type":"number","const":30},{"type":"number","const":60},{"type":"number","const":90}]},"lookback_days":{"description":"events: the two activity windows before the outcome window. Default [30, 90].","anyOf":[{"type":"array","prefixItems":[{"type":"number","const":30},{"type":"number","const":90}]},{"type":"array","prefixItems":[{"type":"number","const":7},{"type":"number","const":30}]},{"type":"array","prefixItems":[{"type":"number","const":90},{"type":"number","const":365}]}]},"windows":{"description":"series (required): trailing windows in periods, one of [3, 6], [7, 30], [4, 12]. signals (required): in snapshots, one of [1, 3, 7], [3, 7, 30], [1, 7, 30].","minItems":2,"maxItems":3,"type":"array","items":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"snapshot_every":{"description":"signals (required): one snapshot of each case per this period.","type":"string","enum":["1h","6h","1d","1w"]},"horizon":{"description":"signals (required): a snapshot's outcome is 1 when an event starts within this many snapshots.","anyOf":[{"type":"number","const":1},{"type":"number","const":3},{"type":"number","const":7},{"type":"number","const":30}]},"min_history":{"description":"signals: readings a snapshot needs (3, 5 or 10; default 3). panel: periods a case needs (2, 3, 5 or 8).","type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"as_of":{"description":"events, signals: the end of the log, ISO-8601. Default: the latest time in the data.","type":"string","minLength":4,"maxLength":40}},"required":["kind"],"additionalProperties":false},"band":{"description":"Advanced. Adds band (act, escalate, refuse), band_reason and max_autonomy to each case.","type":"boolean"},"acknowledge_decision_support":{"description":"Required true when subject_kind is person: results are decision support, with a human in the loop.","type":"boolean"},"idempotency_key":{"description":"A retry with the same key returns the first call's answer without fitting or billing again (keys are kept 24 hours).","type":"string","minLength":1,"maxLength":128}},"required":["data","entity_column","subject_kind","questions"],"additionalProperties":false,"$defs":{"__schema0":{"anyOf":[{"type":"object","properties":{"column":{"type":"string","minLength":1,"maxLength":200},"op":{"type":"string","enum":["==","!=","<","<=",">",">=","in"]},"value":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},{"minItems":1,"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]}},"required":["column","op","value"],"additionalProperties":false},{"type":"object","properties":{"all":{"minItems":1,"maxItems":16,"type":"array","items":{"$ref":"#/$defs/__schema0"}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"minItems":1,"maxItems":16,"type":"array","items":{"$ref":"#/$defs/__schema0"}}},"required":["any"],"additionalProperties":false}]}}},"dg_ask_output":{"type":"object","properties":{"status":{"description":"pending: the first fit on a large record is still running; call dg_poll with task_id.","type":"string","enum":["done","pending"]},"task_id":{"type":"string"},"retry_after_ms":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contract":{"type":"string"},"core_hash":{"type":"string"},"record":{"type":"object","properties":{"content_hash":{"type":"string"}},"required":["content_hash"],"additionalProperties":{}},"answers":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"type":{"type":"string","enum":["yesno","score","choice","rank"]},"state":{"description":"READ FIRST. answered: use it. refused: the record holds no pattern that holds on held-out rows; retrying returns the same. not_yet: too few labeled rows; needs says how many more.","type":"string","enum":["answered","refused","not_yet"]},"cache":{"type":"string","enum":["hit","miss"]},"model_ref":{"type":"string"},"model_refs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"polarity":{"anyOf":[{"type":"string"},{"type":"null"}]},"quality":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"cases":{"type":"array","items":{"type":"object","properties":{"entity_id":{"type":"string"},"p":{"description":"The chance, 0 to 1. For choice, a map of option to chance.","anyOf":[{"type":"number"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}}]},"level":{"type":"string"},"most_likely":{"description":"choice only. The option with the highest chance of the outcome.","type":"string"},"least_likely":{"description":"choice only. The option with the lowest chance of the outcome.","type":"string"},"choice":{"description":"choice only. The best option: most_likely for an outcome you want, least_likely for one you avoid.","type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reasons":{"maxItems":4,"type":"array","items":{"type":"object","properties":{"feature_label":{"type":"string"},"value":{},"likelihood_direction":{"type":"string","enum":["higher","lower"]},"strength":{"type":"string","enum":["strong","moderate"]},"association_not_causal":{"type":"boolean","const":true}},"required":["feature_label","likelihood_direction","strength","association_not_causal"],"additionalProperties":{}}},"levers":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"refused":{"type":"boolean"},"refused_reason":{"type":"string"}},"required":["entity_id","p","reasons"],"additionalProperties":{}}},"ranked":{"type":"array","items":{"type":"object","properties":{"entity_id":{"type":"string"},"p":{"description":"The chance, 0 to 1. For choice, a map of option to chance.","anyOf":[{"type":"number"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}}]},"level":{"type":"string"},"most_likely":{"description":"choice only. The option with the highest chance of the outcome.","type":"string"},"least_likely":{"description":"choice only. The option with the lowest chance of the outcome.","type":"string"},"choice":{"description":"choice only. The best option: most_likely for an outcome you want, least_likely for one you avoid.","type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reasons":{"maxItems":4,"type":"array","items":{"type":"object","properties":{"feature_label":{"type":"string"},"value":{},"likelihood_direction":{"type":"string","enum":["higher","lower"]},"strength":{"type":"string","enum":["strong","moderate"]},"association_not_causal":{"type":"boolean","const":true}},"required":["feature_label","likelihood_direction","strength","association_not_causal"],"additionalProperties":{}}},"levers":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"refused":{"type":"boolean"},"refused_reason":{"type":"string"}},"required":["entity_id","p","reasons"],"additionalProperties":{}}},"ranked_total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"verdicts":{"type":"array","items":{"type":"object","properties":{"option":{"type":"string"},"verdict":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"signature":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["verdict","signature"],"additionalProperties":{}}},"reasons":{"type":"array","items":{"type":"string"}},"retry":{"type":"string","const":"unproductive"},"needs":{"type":"object","properties":{"labeled_rows":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["labeled_rows"],"additionalProperties":{}},"drift":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["type","state"],"additionalProperties":{}}},"dataset_id":{"description":"The stored dataset or sample asked about. Absent for inline data, which is not kept.","type":"string"},"shape":{"description":"With shape: the kind, the as_of the engine read the record at, and its row counts.","type":"object","properties":{"kind":{"type":"string"}},"required":["kind"],"additionalProperties":{}},"fits_run":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billable_decisions":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["status"],"additionalProperties":{}},"dg_add_dataset_input":{"type":"object","properties":{"dataset_id":{"description":"Append to this dataset instead of creating one. Only an open dataset takes more rows.","type":"string","pattern":"^ds_[0-9a-z]{20,40}$"},"rows":{"minItems":1,"maxItems":10000,"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"csv":{"type":"string","minLength":1,"maxLength":8000000},"fetch_url":{"type":"string","format":"uri"},"fetch_headers":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"upload":{"description":"Return a presigned PUT URL for a large CSV instead of sending bytes here.","type":"boolean","const":true},"filename":{"type":"string","pattern":"^[A-Za-z0-9._-]{1,120}$"}},"additionalProperties":false},"dg_add_dataset_output":{"type":"object","properties":{"dataset_id":{"type":"string"},"status":{"type":"string","enum":["ready","open","awaiting_upload"]},"rows":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"columns":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"upload_url":{"type":"string"},"upload_method":{"type":"string","const":"PUT"},"expires_in":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["dataset_id","status","rows","columns"],"additionalProperties":{}},"dg_poll_input":{"type":"object","properties":{"task_id":{"type":"string","pattern":"^tk_[0-9a-z]{20,40}$"}},"required":["task_id"],"additionalProperties":false},"dg_poll_output":{"type":"object","properties":{"status":{"description":"pending: the first fit on a large record is still running; call dg_poll with task_id.","type":"string","enum":["done","pending"]},"task_id":{"type":"string"},"retry_after_ms":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contract":{"type":"string"},"core_hash":{"type":"string"},"record":{"type":"object","properties":{"content_hash":{"type":"string"}},"required":["content_hash"],"additionalProperties":{}},"answers":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"type":{"type":"string","enum":["yesno","score","choice","rank"]},"state":{"description":"READ FIRST. answered: use it. refused: the record holds no pattern that holds on held-out rows; retrying returns the same. not_yet: too few labeled rows; needs says how many more.","type":"string","enum":["answered","refused","not_yet"]},"cache":{"type":"string","enum":["hit","miss"]},"model_ref":{"type":"string"},"model_refs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"polarity":{"anyOf":[{"type":"string"},{"type":"null"}]},"quality":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"cases":{"type":"array","items":{"type":"object","properties":{"entity_id":{"type":"string"},"p":{"description":"The chance, 0 to 1. For choice, a map of option to chance.","anyOf":[{"type":"number"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}}]},"level":{"type":"string"},"most_likely":{"description":"choice only. The option with the highest chance of the outcome.","type":"string"},"least_likely":{"description":"choice only. The option with the lowest chance of the outcome.","type":"string"},"choice":{"description":"choice only. The best option: most_likely for an outcome you want, least_likely for one you avoid.","type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reasons":{"maxItems":4,"type":"array","items":{"type":"object","properties":{"feature_label":{"type":"string"},"value":{},"likelihood_direction":{"type":"string","enum":["higher","lower"]},"strength":{"type":"string","enum":["strong","moderate"]},"association_not_causal":{"type":"boolean","const":true}},"required":["feature_label","likelihood_direction","strength","association_not_causal"],"additionalProperties":{}}},"levers":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"refused":{"type":"boolean"},"refused_reason":{"type":"string"}},"required":["entity_id","p","reasons"],"additionalProperties":{}}},"ranked":{"type":"array","items":{"type":"object","properties":{"entity_id":{"type":"string"},"p":{"description":"The chance, 0 to 1. For choice, a map of option to chance.","anyOf":[{"type":"number"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}}]},"level":{"type":"string"},"most_likely":{"description":"choice only. The option with the highest chance of the outcome.","type":"string"},"least_likely":{"description":"choice only. The option with the lowest chance of the outcome.","type":"string"},"choice":{"description":"choice only. The best option: most_likely for an outcome you want, least_likely for one you avoid.","type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reasons":{"maxItems":4,"type":"array","items":{"type":"object","properties":{"feature_label":{"type":"string"},"value":{},"likelihood_direction":{"type":"string","enum":["higher","lower"]},"strength":{"type":"string","enum":["strong","moderate"]},"association_not_causal":{"type":"boolean","const":true}},"required":["feature_label","likelihood_direction","strength","association_not_causal"],"additionalProperties":{}}},"levers":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"refused":{"type":"boolean"},"refused_reason":{"type":"string"}},"required":["entity_id","p","reasons"],"additionalProperties":{}}},"ranked_total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"verdicts":{"type":"array","items":{"type":"object","properties":{"option":{"type":"string"},"verdict":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"signature":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["verdict","signature"],"additionalProperties":{}}},"reasons":{"type":"array","items":{"type":"string"}},"retry":{"type":"string","const":"unproductive"},"needs":{"type":"object","properties":{"labeled_rows":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["labeled_rows"],"additionalProperties":{}},"drift":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["type","state"],"additionalProperties":{}}},"dataset_id":{"description":"The stored dataset or sample asked about. Absent for inline data, which is not kept.","type":"string"},"shape":{"description":"With shape: the kind, the as_of the engine read the record at, and its row counts.","type":"object","properties":{"kind":{"type":"string"}},"required":["kind"],"additionalProperties":{}},"fits_run":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"billable_decisions":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["status"],"additionalProperties":{}},"dg_preflight_input":{"type":"object","properties":{"dataset_id":{"description":"A dataset from dg_add_dataset, or a sample.","type":"string","minLength":1},"outcome_column":{"description":"Name it to get the fitness arithmetic.","type":"string","minLength":1},"predictors":{"type":"array","items":{"type":"string"}},"labelled_column":{"type":"string"}},"required":["dataset_id"],"additionalProperties":false},"dg_preflight_output":{"type":"object","properties":{"dataset_id":{"type":"string"},"grain":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"resolutions":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"fitness":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"blocking":{"type":"array","items":{"type":"string"}},"advisory":{"type":"array","items":{"type":"string"}}},"required":["dataset_id","grain","resolutions","blocking","advisory"],"additionalProperties":{}},"dg_report_outcomes_input":{"type":"object","properties":{"model_ref":{"type":"string","pattern":"^mr1_[0-9a-f]{32}$"},"outcomes":{"minItems":1,"maxItems":10000,"type":"array","items":{"type":"object","properties":{"entity_id":{"type":"string","minLength":1},"outcome":{"anyOf":[{"type":"boolean"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"string"}]},"observed_at":{"type":"string","minLength":1},"event_id":{"type":"string","maxLength":128}},"required":["entity_id","outcome","observed_at"],"additionalProperties":false}}},"required":["model_ref","outcomes"],"additionalProperties":false},"dg_report_outcomes_output":{"type":"object","properties":{"written":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"duplicates":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["written","duplicates"],"additionalProperties":{}},"dg_drift_input":{"type":"object","properties":{"model_ref":{"type":"string","pattern":"^mr1_[0-9a-f]{32}$"}},"required":["model_ref"],"additionalProperties":false},"dg_drift_output":{"type":"object","properties":{"pattern":{"type":"string","enum":["unchanged","changed","no_prior"]},"recommendation":{"type":"string","enum":["keep","refit","abandon"]}},"required":["pattern","recommendation"],"additionalProperties":{}},"dg_verify_input":{"type":"object","properties":{"verdict":{"type":"object","properties":{"verdict_id":{"type":"string"},"kind":{"type":"string"}},"required":["verdict_id","kind"],"additionalProperties":{}},"signature":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["verdict","signature"],"additionalProperties":false},"dg_verify_output":{"type":"object","properties":{"status":{"type":"string","enum":["valid","invalid_signature","expired","unknown_key"]}},"required":["status"],"additionalProperties":{}},"dg_describe_input":{"type":"object","properties":{},"additionalProperties":false},"dg_describe_output":{"type":"object","properties":{"question_types":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"samples":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"required":["question_types","samples"],"additionalProperties":{}},"dg_delete_dataset_input":{"type":"object","properties":{"dataset_id":{"type":"string","pattern":"^ds_[0-9a-z]{20,40}$"}},"required":["dataset_id"],"additionalProperties":false},"dg_delete_dataset_output":{"type":"object","properties":{"dataset_id":{"type":"string"},"deleted":{"type":"boolean","const":true}},"required":["dataset_id","deleted"],"additionalProperties":{}}}}}