Skip to main content
GET
/
v1
/
agent
/
{id}
Retrieve Agent Response
curl --request GET \
  --url https://api.perplexity.ai/v1/agent/{id} \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.perplexity.ai/v1/agent/{id}"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.perplexity.ai/v1/agent/{id}', 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/agent/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.perplexity.ai/v1/agent/{id}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.perplexity.ai/v1/agent/{id}")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.perplexity.ai/v1/agent/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "created_at": 123,
  "id": "<string>",
  "model": "<string>",
  "object": "response",
  "output": [
    {
      "content": [
        {
          "text": "<string>",
          "type": "output_text",
          "annotations": [
            {
              "end_index": 123,
              "start_index": 123,
              "title": "<string>",
              "type": "<string>",
              "url": "<string>"
            }
          ]
        }
      ],
      "id": "<string>",
      "role": "assistant",
      "type": "message"
    }
  ],
  "error": {
    "message": "<string>",
    "code": "<string>",
    "type": "<string>"
  },
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123,
    "total_tokens": 123,
    "cost": {
      "currency": "USD",
      "input_cost": 123,
      "output_cost": 123,
      "total_cost": 123,
      "cache_creation_cost": 123,
      "cache_read_cost": 123,
      "tool_calls_cost": 123
    },
    "input_tokens_details": {
      "cache_creation_input_tokens": 123,
      "cache_read_input_tokens": 123
    },
    "tool_calls_details": {}
  }
}
{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>"
}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Response id (resp_<...>)

Response

JSON snapshot of the response.

Non-streaming response returned when stream is false

created_at
integer<int64>
required

Unix timestamp when the response was created

id
string
required

Unique identifier for the response

model
string
required

Model used for generation

object
enum<string>
required

Object type identifier

Available options:
response
output
(MessageOutputItem · object | SearchResultsOutputItem · object | FetchUrlResultsOutputItem · object | FinanceResultsOutputItem · object | PeopleSearchResultsOutputItem · object | FunctionCallOutputItem · object | SandboxResultsOutputItem · object | McpListToolsOutputItem · object | McpCallOutputItem · object)[]
required

Array of output items (messages, search results, tool calls)

status
enum<string>
required

Status of the response

Available options:
completed,
failed,
in_progress,
requires_action
error
ErrorInfo · object

Error details if the response failed

usage
ResponsesUsage · object

Token usage and cost information