curl --request POST \
--url https://api.you.com/v1/agents/runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": "express",
"input": "What is the capital of France?"
}
'import requests
url = "https://api.you.com/v1/agents/runs"
payload = {
"agent": "express",
"input": "What is the capital of France?"
}
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({agent: 'express', input: 'What is the capital of France?'})
};
fetch('https://api.you.com/v1/agents/runs', 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.you.com/v1/agents/runs",
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([
'agent' => 'express',
'input' => 'What is the capital of France?'
]),
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.you.com/v1/agents/runs"
payload := strings.NewReader("{\n \"agent\": \"express\",\n \"input\": \"What is the capital of France?\"\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.you.com/v1/agents/runs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": \"express\",\n \"input\": \"What is the capital of France?\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.you.com/v1/agents/runs")
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 \"agent\": \"express\",\n \"input\": \"What is the capital of France?\"\n}"
response = http.request(request)
puts response.read_body{
"output": [
{
"type": "web_search.results, message.answer",
"text": "The capital of France is Paris.",
"content": "What is the capital of France?",
"agent": "express"
}
]
}{
"errors": [
{
"status": "400",
"code": "bad_request",
"title": "Invalid request body",
"detail": "The field 'tools' must be an array of objects."
}
]
}{
"errors": [
{
"status": "401",
"code": "unauthorized",
"title": "Unauthorized",
"detail": "Missing or invalid Authorization header. Use 'Authorization: Bearer <API_KEY>'."
}
]
}{
"errors": [
{
"status": "403",
"code": "tool_not_allowed",
"title": "Tool not allowed",
"detail": "You are not allowed to use the requested tool for this agent or tenant."
}
]
}Express Agent (Beta)
curl --request POST \
--url https://api.you.com/v1/agents/runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": "express",
"input": "What is the capital of France?"
}
'import requests
url = "https://api.you.com/v1/agents/runs"
payload = {
"agent": "express",
"input": "What is the capital of France?"
}
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({agent: 'express', input: 'What is the capital of France?'})
};
fetch('https://api.you.com/v1/agents/runs', 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.you.com/v1/agents/runs",
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([
'agent' => 'express',
'input' => 'What is the capital of France?'
]),
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.you.com/v1/agents/runs"
payload := strings.NewReader("{\n \"agent\": \"express\",\n \"input\": \"What is the capital of France?\"\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.you.com/v1/agents/runs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": \"express\",\n \"input\": \"What is the capital of France?\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.you.com/v1/agents/runs")
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 \"agent\": \"express\",\n \"input\": \"What is the capital of France?\"\n}"
response = http.request(request)
puts response.read_body{
"output": [
{
"type": "web_search.results, message.answer",
"text": "The capital of France is Paris.",
"content": "What is the capital of France?",
"agent": "express"
}
]
}{
"errors": [
{
"status": "400",
"code": "bad_request",
"title": "Invalid request body",
"detail": "The field 'tools' must be an array of objects."
}
]
}{
"errors": [
{
"status": "401",
"code": "unauthorized",
"title": "Unauthorized",
"detail": "Missing or invalid Authorization header. Use 'Authorization: Bearer <API_KEY>'."
}
]
}{
"errors": [
{
"status": "403",
"code": "tool_not_allowed",
"title": "Tool not allowed",
"detail": "You are not allowed to use the requested tool for this agent or tenant."
}
]
}Description
This endpoint answers the user’s query with an LLM using web results (max 1 web search) to ground the answer. Use it for answering simple questions that involve a web search that require a low latency agent.Authorizations
The unique API Key required to authorize API access. Learn how to get yours in the “Get your API key” section of the documentation.
Body
The agent mode that will be used to execute your request. This parameter must be set as 'express'.
The input for the agent. This can be a query or a prompt.
"What is the capital of France?"
When set to "true", it will enable SSE (server side events) response. This is useful if you want to stream the response to your applications (e.g., with chatbots).
Add tools the system can call to expand its capabilities, providing more precise answers to the input query. Currently supports only the Web Search tool. See Web Search Tool for more details.
Show child attributes
Show child attributes
Response
Inference response in application/json or text/event-stream format.
Show child attributes
Show child attributes