Python
import os
import requests
response = requests.post(
"https://api.parallel.ai/v1/decisions",
headers={"x-api-key": os.environ["PARALLEL_API_KEY"]},
json={
"state": {
"company": "Clay",
"website": "https://www.clay.com",
},
"questions": {
"has_cli": {
"type": "noul",
"instructions": "Does Clay offer an official command-line interface (CLI)?",
}
},
},
timeout=30,
)
response.raise_for_status()
decision = response.json()
answer = decision["answers"]["has_cli"]
if answer["type"] == "refusal":
print("No decision returned; review this question.")
else:
print("Estimated probability:", answer["noul"])
for citation in decision["citations"]:
print(citation["url"])async function main() {
const response = await fetch("https://api.parallel.ai/v1/decisions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.PARALLEL_API_KEY!,
},
body: JSON.stringify({
state: {
company: "Clay",
website: "https://www.clay.com",
},
questions: {
has_cli: {
type: "noul",
instructions: "Does Clay offer an official command-line interface (CLI)?",
},
},
}),
});
if (!response.ok) {
throw new Error(`Decision failed: ${response.status} ${await response.text()}`);
}
const decision = await response.json();
const answer = decision.answers.has_cli;
if (answer.type === "refusal") {
console.log("No decision returned; review this question.");
} else {
console.log("Estimated probability:", answer.noul);
}
for (const citation of decision.citations) {
console.log(citation.url);
}
}
main().catch(console.error);curl https://api.parallel.ai/v1/decisions \
-H "Content-Type: application/json" \
-H "x-api-key: $PARALLEL_API_KEY" \
-d '{
"state": {
"company": "Clay",
"website": "https://www.clay.com"
},
"questions": {
"has_cli": {
"type": "noul",
"instructions": "Does Clay offer an official command-line interface (CLI)?"
}
}
}'{
"mode": "fast",
"answers": {
"has_cli": {
"type": "noul",
"noul": 0.9992643798509062
}
},
"usage": {
"input_tokens": 4212,
"output_tokens": 0
},
"citations": [
{
"url": "https://developers.clay.com/concepts/cli-basics",
"title": "CLI basics",
"excerpts": [
"The Clay CLI (clay) is JSON-first: every command writes machine-readable JSON to stdout on success and a structured error envelope to stderr on failure."
]
},
{
"url": "https://university.clay.com/docs/cli-security-privacy",
"title": "CLI security & privacy - Clay Docs",
"excerpts": [
"Clay's CLI lets your team drive a Clay workspace from a terminal or coding agent instead of the UI."
]
}
],
"decision_id": "decisions_34b4be1b1405e19ba5516d9bb76c56ad"
}{
"type": "error",
"error": {
"ref_id": "<reference-id>",
"message": "Request validation error"
}
}Decisions
Decisions
Answer typed questions using current web evidence.
POST
/
v1
/
decisions
Python
import os
import requests
response = requests.post(
"https://api.parallel.ai/v1/decisions",
headers={"x-api-key": os.environ["PARALLEL_API_KEY"]},
json={
"state": {
"company": "Clay",
"website": "https://www.clay.com",
},
"questions": {
"has_cli": {
"type": "noul",
"instructions": "Does Clay offer an official command-line interface (CLI)?",
}
},
},
timeout=30,
)
response.raise_for_status()
decision = response.json()
answer = decision["answers"]["has_cli"]
if answer["type"] == "refusal":
print("No decision returned; review this question.")
else:
print("Estimated probability:", answer["noul"])
for citation in decision["citations"]:
print(citation["url"])async function main() {
const response = await fetch("https://api.parallel.ai/v1/decisions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.PARALLEL_API_KEY!,
},
body: JSON.stringify({
state: {
company: "Clay",
website: "https://www.clay.com",
},
questions: {
has_cli: {
type: "noul",
instructions: "Does Clay offer an official command-line interface (CLI)?",
},
},
}),
});
if (!response.ok) {
throw new Error(`Decision failed: ${response.status} ${await response.text()}`);
}
const decision = await response.json();
const answer = decision.answers.has_cli;
if (answer.type === "refusal") {
console.log("No decision returned; review this question.");
} else {
console.log("Estimated probability:", answer.noul);
}
for (const citation of decision.citations) {
console.log(citation.url);
}
}
main().catch(console.error);curl https://api.parallel.ai/v1/decisions \
-H "Content-Type: application/json" \
-H "x-api-key: $PARALLEL_API_KEY" \
-d '{
"state": {
"company": "Clay",
"website": "https://www.clay.com"
},
"questions": {
"has_cli": {
"type": "noul",
"instructions": "Does Clay offer an official command-line interface (CLI)?"
}
}
}'{
"mode": "fast",
"answers": {
"has_cli": {
"type": "noul",
"noul": 0.9992643798509062
}
},
"usage": {
"input_tokens": 4212,
"output_tokens": 0
},
"citations": [
{
"url": "https://developers.clay.com/concepts/cli-basics",
"title": "CLI basics",
"excerpts": [
"The Clay CLI (clay) is JSON-first: every command writes machine-readable JSON to stdout on success and a structured error envelope to stderr on failure."
]
},
{
"url": "https://university.clay.com/docs/cli-security-privacy",
"title": "CLI security & privacy - Clay Docs",
"excerpts": [
"Clay's CLI lets your team drive a Clay workspace from a terminal or coding agent instead of the UI."
]
}
],
"decision_id": "decisions_34b4be1b1405e19ba5516d9bb76c56ad"
}{
"type": "error",
"error": {
"ref_id": "<reference-id>",
"message": "Request validation error"
}
}Body
application/json
Response
Successful Response