curl --request POST \
--url https://api.perplexity.ai/v1/decisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "pplx-decider-latest",
"state": {
"title": "Battery died after two weeks",
"review": "The headphones sound great, but the battery stopped charging after two weeks."
},
"questions": {
"defect": {
"type": "noul",
"instructions": "Does the review report a product defect?"
},
"sentiment": {
"type": "choice",
"instructions": "What is the overall sentiment of the review?",
"criteria": {
"positive": "Mostly satisfied",
"mixed": "Praise and complaints in one review",
"negative": "Mostly dissatisfied"
}
},
"severity": {
"type": "score",
"instructions": "How severe is the reported problem?",
"criteria": [
"Cosmetic",
"Inconvenient",
"Product unusable"
]
}
}
}
'import requests
url = "https://api.perplexity.ai/v1/decisions"
payload = {
"model": "pplx-decider-latest",
"state": {
"title": "Battery died after two weeks",
"review": "The headphones sound great, but the battery stopped charging after two weeks."
},
"questions": {
"defect": {
"type": "noul",
"instructions": "Does the review report a product defect?"
},
"sentiment": {
"type": "choice",
"instructions": "What is the overall sentiment of the review?",
"criteria": {
"positive": "Mostly satisfied",
"mixed": "Praise and complaints in one review",
"negative": "Mostly dissatisfied"
}
},
"severity": {
"type": "score",
"instructions": "How severe is the reported problem?",
"criteria": ["Cosmetic", "Inconvenient", "Product unusable"]
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'pplx-decider-latest',
state: {
title: 'Battery died after two weeks',
review: 'The headphones sound great, but the battery stopped charging after two weeks.'
},
questions: {
defect: {type: 'noul', instructions: 'Does the review report a product defect?'},
sentiment: {
type: 'choice',
instructions: 'What is the overall sentiment of the review?',
criteria: {
positive: 'Mostly satisfied',
mixed: 'Praise and complaints in one review',
negative: 'Mostly dissatisfied'
}
},
severity: {
type: 'score',
instructions: 'How severe is the reported problem?',
criteria: ['Cosmetic', 'Inconvenient', 'Product unusable']
}
}
})
};
fetch('https://api.perplexity.ai/v1/decisions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.perplexity.ai/v1/decisions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'pplx-decider-latest',
'state' => [
'title' => 'Battery died after two weeks',
'review' => 'The headphones sound great, but the battery stopped charging after two weeks.'
],
'questions' => [
'defect' => [
'type' => 'noul',
'instructions' => 'Does the review report a product defect?'
],
'sentiment' => [
'type' => 'choice',
'instructions' => 'What is the overall sentiment of the review?',
'criteria' => [
'positive' => 'Mostly satisfied',
'mixed' => 'Praise and complaints in one review',
'negative' => 'Mostly dissatisfied'
]
],
'severity' => [
'type' => 'score',
'instructions' => 'How severe is the reported problem?',
'criteria' => [
'Cosmetic',
'Inconvenient',
'Product unusable'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.perplexity.ai/v1/decisions"
payload := strings.NewReader("{\n \"model\": \"pplx-decider-latest\",\n \"state\": {\n \"title\": \"Battery died after two weeks\",\n \"review\": \"The headphones sound great, but the battery stopped charging after two weeks.\"\n },\n \"questions\": {\n \"defect\": {\n \"type\": \"noul\",\n \"instructions\": \"Does the review report a product defect?\"\n },\n \"sentiment\": {\n \"type\": \"choice\",\n \"instructions\": \"What is the overall sentiment of the review?\",\n \"criteria\": {\n \"positive\": \"Mostly satisfied\",\n \"mixed\": \"Praise and complaints in one review\",\n \"negative\": \"Mostly dissatisfied\"\n }\n },\n \"severity\": {\n \"type\": \"score\",\n \"instructions\": \"How severe is the reported problem?\",\n \"criteria\": [\n \"Cosmetic\",\n \"Inconvenient\",\n \"Product unusable\"\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.perplexity.ai/v1/decisions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"pplx-decider-latest\",\n \"state\": {\n \"title\": \"Battery died after two weeks\",\n \"review\": \"The headphones sound great, but the battery stopped charging after two weeks.\"\n },\n \"questions\": {\n \"defect\": {\n \"type\": \"noul\",\n \"instructions\": \"Does the review report a product defect?\"\n },\n \"sentiment\": {\n \"type\": \"choice\",\n \"instructions\": \"What is the overall sentiment of the review?\",\n \"criteria\": {\n \"positive\": \"Mostly satisfied\",\n \"mixed\": \"Praise and complaints in one review\",\n \"negative\": \"Mostly dissatisfied\"\n }\n },\n \"severity\": {\n \"type\": \"score\",\n \"instructions\": \"How severe is the reported problem?\",\n \"criteria\": [\n \"Cosmetic\",\n \"Inconvenient\",\n \"Product unusable\"\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.perplexity.ai/v1/decisions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"pplx-decider-latest\",\n \"state\": {\n \"title\": \"Battery died after two weeks\",\n \"review\": \"The headphones sound great, but the battery stopped charging after two weeks.\"\n },\n \"questions\": {\n \"defect\": {\n \"type\": \"noul\",\n \"instructions\": \"Does the review report a product defect?\"\n },\n \"sentiment\": {\n \"type\": \"choice\",\n \"instructions\": \"What is the overall sentiment of the review?\",\n \"criteria\": {\n \"positive\": \"Mostly satisfied\",\n \"mixed\": \"Praise and complaints in one review\",\n \"negative\": \"Mostly dissatisfied\"\n }\n },\n \"severity\": {\n \"type\": \"score\",\n \"instructions\": \"How severe is the reported problem?\",\n \"criteria\": [\n \"Cosmetic\",\n \"Inconvenient\",\n \"Product unusable\"\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"model": "pplx-decider-latest",
"answers": {
"defect": {
"type": "noul",
"noul": 0.9424522889347015
},
"sentiment": {
"type": "choice",
"choice": "mixed",
"confidence": 0.9255246944002182,
"probabilities": {
"positive": 0.020649883775315993,
"mixed": 0.9503497962668123,
"negative": 0.02900031995787183
}
},
"severity": {
"type": "score",
"score": 1.7838686319784252,
"confidence": 0.7838686319784252,
"legend": {
"0": "Cosmetic",
"1": "Inconvenient",
"2": "Product unusable"
},
"probabilities": {
"0": 0.008423954913615923,
"1": 0.199283458194343,
"2": 0.7922925868920411
}
}
},
"usage": {
"input_tokens": 367,
"output_tokens": 3
}
}{
"error": {
"message": "Invalid model 'pplx-decidr-latest'. Permitted models can be found in the documentation at https://docs.perplexity.ai/docs/getting-started/models.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Invalid API key provided. You can find your API key at https://console.perplexity.ai.",
"type": "invalid_api_key",
"code": 401
}
}{
"error": {
"code": null,
"message": "request body exceeds the maximum allowed size of 33554432 bytes",
"param": null,
"type": "invalid_request_error"
}
}{
"error": {
"code": null,
"message": "Request rate limit exceeded, please try again later.",
"param": null,
"type": "too_many_requests"
}
}Answer questions
Evaluate one or more named questions against the content in state. Mix noul, choice, and score questions in one request; the response returns one answer per question under the same name, plus the model name and token usage. Set model to pplx-decider-v1.2 or pplx-decider-flash-v1.2, or to the alias pplx-decider-latest or pplx-decider-flash-latest; a missing or unknown model returns 400. Send the key as Authorization: Bearer <key>; an x-api-key header is not read and returns 401.
curl --request POST \
--url https://api.perplexity.ai/v1/decisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "pplx-decider-latest",
"state": {
"title": "Battery died after two weeks",
"review": "The headphones sound great, but the battery stopped charging after two weeks."
},
"questions": {
"defect": {
"type": "noul",
"instructions": "Does the review report a product defect?"
},
"sentiment": {
"type": "choice",
"instructions": "What is the overall sentiment of the review?",
"criteria": {
"positive": "Mostly satisfied",
"mixed": "Praise and complaints in one review",
"negative": "Mostly dissatisfied"
}
},
"severity": {
"type": "score",
"instructions": "How severe is the reported problem?",
"criteria": [
"Cosmetic",
"Inconvenient",
"Product unusable"
]
}
}
}
'import requests
url = "https://api.perplexity.ai/v1/decisions"
payload = {
"model": "pplx-decider-latest",
"state": {
"title": "Battery died after two weeks",
"review": "The headphones sound great, but the battery stopped charging after two weeks."
},
"questions": {
"defect": {
"type": "noul",
"instructions": "Does the review report a product defect?"
},
"sentiment": {
"type": "choice",
"instructions": "What is the overall sentiment of the review?",
"criteria": {
"positive": "Mostly satisfied",
"mixed": "Praise and complaints in one review",
"negative": "Mostly dissatisfied"
}
},
"severity": {
"type": "score",
"instructions": "How severe is the reported problem?",
"criteria": ["Cosmetic", "Inconvenient", "Product unusable"]
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'pplx-decider-latest',
state: {
title: 'Battery died after two weeks',
review: 'The headphones sound great, but the battery stopped charging after two weeks.'
},
questions: {
defect: {type: 'noul', instructions: 'Does the review report a product defect?'},
sentiment: {
type: 'choice',
instructions: 'What is the overall sentiment of the review?',
criteria: {
positive: 'Mostly satisfied',
mixed: 'Praise and complaints in one review',
negative: 'Mostly dissatisfied'
}
},
severity: {
type: 'score',
instructions: 'How severe is the reported problem?',
criteria: ['Cosmetic', 'Inconvenient', 'Product unusable']
}
}
})
};
fetch('https://api.perplexity.ai/v1/decisions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.perplexity.ai/v1/decisions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'pplx-decider-latest',
'state' => [
'title' => 'Battery died after two weeks',
'review' => 'The headphones sound great, but the battery stopped charging after two weeks.'
],
'questions' => [
'defect' => [
'type' => 'noul',
'instructions' => 'Does the review report a product defect?'
],
'sentiment' => [
'type' => 'choice',
'instructions' => 'What is the overall sentiment of the review?',
'criteria' => [
'positive' => 'Mostly satisfied',
'mixed' => 'Praise and complaints in one review',
'negative' => 'Mostly dissatisfied'
]
],
'severity' => [
'type' => 'score',
'instructions' => 'How severe is the reported problem?',
'criteria' => [
'Cosmetic',
'Inconvenient',
'Product unusable'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.perplexity.ai/v1/decisions"
payload := strings.NewReader("{\n \"model\": \"pplx-decider-latest\",\n \"state\": {\n \"title\": \"Battery died after two weeks\",\n \"review\": \"The headphones sound great, but the battery stopped charging after two weeks.\"\n },\n \"questions\": {\n \"defect\": {\n \"type\": \"noul\",\n \"instructions\": \"Does the review report a product defect?\"\n },\n \"sentiment\": {\n \"type\": \"choice\",\n \"instructions\": \"What is the overall sentiment of the review?\",\n \"criteria\": {\n \"positive\": \"Mostly satisfied\",\n \"mixed\": \"Praise and complaints in one review\",\n \"negative\": \"Mostly dissatisfied\"\n }\n },\n \"severity\": {\n \"type\": \"score\",\n \"instructions\": \"How severe is the reported problem?\",\n \"criteria\": [\n \"Cosmetic\",\n \"Inconvenient\",\n \"Product unusable\"\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.perplexity.ai/v1/decisions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"pplx-decider-latest\",\n \"state\": {\n \"title\": \"Battery died after two weeks\",\n \"review\": \"The headphones sound great, but the battery stopped charging after two weeks.\"\n },\n \"questions\": {\n \"defect\": {\n \"type\": \"noul\",\n \"instructions\": \"Does the review report a product defect?\"\n },\n \"sentiment\": {\n \"type\": \"choice\",\n \"instructions\": \"What is the overall sentiment of the review?\",\n \"criteria\": {\n \"positive\": \"Mostly satisfied\",\n \"mixed\": \"Praise and complaints in one review\",\n \"negative\": \"Mostly dissatisfied\"\n }\n },\n \"severity\": {\n \"type\": \"score\",\n \"instructions\": \"How severe is the reported problem?\",\n \"criteria\": [\n \"Cosmetic\",\n \"Inconvenient\",\n \"Product unusable\"\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.perplexity.ai/v1/decisions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"pplx-decider-latest\",\n \"state\": {\n \"title\": \"Battery died after two weeks\",\n \"review\": \"The headphones sound great, but the battery stopped charging after two weeks.\"\n },\n \"questions\": {\n \"defect\": {\n \"type\": \"noul\",\n \"instructions\": \"Does the review report a product defect?\"\n },\n \"sentiment\": {\n \"type\": \"choice\",\n \"instructions\": \"What is the overall sentiment of the review?\",\n \"criteria\": {\n \"positive\": \"Mostly satisfied\",\n \"mixed\": \"Praise and complaints in one review\",\n \"negative\": \"Mostly dissatisfied\"\n }\n },\n \"severity\": {\n \"type\": \"score\",\n \"instructions\": \"How severe is the reported problem?\",\n \"criteria\": [\n \"Cosmetic\",\n \"Inconvenient\",\n \"Product unusable\"\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"model": "pplx-decider-latest",
"answers": {
"defect": {
"type": "noul",
"noul": 0.9424522889347015
},
"sentiment": {
"type": "choice",
"choice": "mixed",
"confidence": 0.9255246944002182,
"probabilities": {
"positive": 0.020649883775315993,
"mixed": 0.9503497962668123,
"negative": 0.02900031995787183
}
},
"severity": {
"type": "score",
"score": 1.7838686319784252,
"confidence": 0.7838686319784252,
"legend": {
"0": "Cosmetic",
"1": "Inconvenient",
"2": "Product unusable"
},
"probabilities": {
"0": 0.008423954913615923,
"1": 0.199283458194343,
"2": 0.7922925868920411
}
}
},
"usage": {
"input_tokens": 367,
"output_tokens": 3
}
}{
"error": {
"message": "Invalid model 'pplx-decidr-latest'. Permitted models can be found in the documentation at https://docs.perplexity.ai/docs/getting-started/models.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Invalid API key provided. You can find your API key at https://console.perplexity.ai.",
"type": "invalid_api_key",
"code": 401
}
}{
"error": {
"code": null,
"message": "request body exceeds the maximum allowed size of 33554432 bytes",
"param": null,
"type": "invalid_request_error"
}
}{
"error": {
"code": null,
"message": "Request rate limit exceeded, please try again later.",
"param": null,
"type": "too_many_requests"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The content to evaluate and the named questions to ask about it. Unknown fields return 400. The state plus any one question must stay under 256K input tokens; questions that do not fit together are answered in groups, and each group counts the state again. The body must stay under 32 MiB.
The decision model: pplx-decider-v1.2 (27B, $0.02 per million input tokens) or pplx-decider-flash-v1.2 (4B, $0.01 per million input tokens). The aliases pplx-decider-latest and perplexity/pplx-decider-latest select pplx-decider-v1.2, and pplx-decider-flash-latest and perplexity/pplx-decider-flash-latest select pplx-decider-flash-v1.2; an alias can move to a newer model over time. pplx-decider-v1.1-27b and pplx-decider-v1-27b remain accepted and select pplx-decider-v1.2. A missing or unknown model returns 400.
"pplx-decider-latest"
The content every question in the request refers to: a string, an object, or an array. Images can appear anywhere in state as OpenAI-style image_url parts with base64 PNG, JPEG, or WebP data URLs and are read in place. Up to 8 images per question.
"The headphones sound great, but the battery stopped charging after two weeks."
Questions keyed by a non-empty name you choose. The response uses the same names. 1 to 128 questions.
Show child attributes
Show child attributes
{
"defect": {
"type": "noul",
"instructions": "Does the review report a product defect?"
}
}
Response
One answer per question, under the question's name.
Answers keyed by question name, plus the model that answered and token usage.
The model name you sent, echoed back.
"pplx-decider-latest"
One answer per question, under the question's name.
Show child attributes
Show child attributes
{
"defect": {
"type": "noul",
"noul": 0.9424522889347015
}
}
Token counts for this request.
Show child attributes
Show child attributes
{ "input_tokens": 367, "output_tokens": 3 }
Was this page helpful?