AI Query
Ask natural language questions about any website. Orsa scrapes the site, passes content to an LLM, and returns structured answers.
Endpoint: POST /v1/brand/ai/query
Credits: 10 per request
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
domain | string | Yes | Domain to analyze |
data_to_extract | string | Yes | Natural language description of what to extract |
url | string | No | Specific URL to analyze (default: domain homepage) |
response_format | string | No | text or json (default: json) |
Request Body
{
"domain": "stripe.com",
"data_to_extract": "pricing plans with names, prices, and key features",
"response_format": "json"
}Response Schema
{
"success": true,
"data": {
"domain": "stripe.com",
"query": "pricing plans with names, prices, and key features",
"result": {
"plans": [
{
"name": "Integrated",
"price": "2.9% + 30¢ per transaction",
"features": ["Full platform", "135+ currencies", "Instant payouts"]
}
]
},
"source_urls": ["https://stripe.com/pricing"],
"model": "gpt-4o",
"tokens_used": 1240
},
"credits_used": 10
}Code Examples
cURL
curl -X POST "https://api.orsa.dev/v1/brand/ai/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"domain": "stripe.com",
"data_to_extract": "pricing plans with features",
"response_format": "json"
}'TypeScript
const result = await client.ai.query({
domain: 'stripe.com',
dataToExtract: 'pricing plans with names, prices, and features',
responseFormat: 'json',
});
console.log(result.result); // Structured JSON response
console.log(result.sourceUrls); // Pages that were analyzedPython
result = client.ai.query(
domain="stripe.com",
data_to_extract="pricing plans with names, prices, and features",
response_format="json",
)
print(result.result)
print(result.source_urls)Tips
- Be specific in
data_to_extract— "pricing plans with prices" works better than "tell me about the company." - Use
response_format: "json"for programmatic consumption and"text"for human-readable summaries. - The AI may navigate to subpages (like
/pricing) if the homepage doesn't contain the requested data. - Results are not cached by default since queries are freeform.