import { AISearchAPIClient } from 'aisearchapi-client';const client = new AISearchAPIClient({ apiKey: 'YOUR_API_KEY'});const response = await client.search({ prompt: 'What are some security risks I should be aware of?', context: [{ role: 'user', content: 'I am developing a web app using Node.js and Express.' }], response_type: 'markdown'});console.log(response);
from aisearchapi_client import AISearchAPIClient, ChatMessage
client = AISearchAPIClient(api_key="YOUR_API_KEY")
response = client.search(
prompt="What are some security risks I should be aware of?",
context=[
ChatMessage(role="user", content="user conversation context for the LLM")
],
response_type="markdown"
)
print(response)
curl --request POST \
--url https://api.aisearchapi.io/v1/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "What are some security risks I should be aware of?",
"context": [
{
"role": "user",
"content": "I am developing a web app using Node.js and Express."
},
{
"role": "user",
"content": "The app stores personal data, including names and emails."
},
{
"role": "user",
"content": "We plan to deploy it on AWS."
}
],
"response_type": "markdown"
}
'
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisearchapi.io/v1/search",
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([
'prompt' => 'What are some security risks I should be aware of?',
'context' => [
[
'role' => 'user',
'content' => 'I am developing a web app using Node.js and Express.'
],
[
'role' => 'user',
'content' => 'The app stores personal data, including names and emails.'
],
[
'role' => 'user',
'content' => 'We plan to deploy it on AWS.'
]
],
'response_type' => 'markdown'
]),
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.aisearchapi.io/v1/search"
payload := strings.NewReader("{\n \"prompt\": \"What are some security risks I should be aware of?\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"I am developing a web app using Node.js and Express.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"The app stores personal data, including names and emails.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"We plan to deploy it on AWS.\"\n }\n ],\n \"response_type\": \"markdown\"\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.aisearchapi.io/v1/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"What are some security risks I should be aware of?\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"I am developing a web app using Node.js and Express.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"The app stores personal data, including names and emails.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"We plan to deploy it on AWS.\"\n }\n ],\n \"response_type\": \"markdown\"\n}")
.asString();
require 'uri'
require 'net/http'
url = URI("https://api.aisearchapi.io/v1/search")
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 \"prompt\": \"What are some security risks I should be aware of?\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"I am developing a web app using Node.js and Express.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"The app stores personal data, including names and emails.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"We plan to deploy it on AWS.\"\n }\n ],\n \"response_type\": \"markdown\"\n}"
response = http.request(request)
puts response.read_body
{ "answer": "### Node.js Security Risks and Mitigation Strategies\n\nWhen developing Node.js applications that handle personal data and deploy to AWS, you should be aware of several critical security risks:\n\n**Authentication and Authorization**\n- Implement secure session management\n- Use strong password policies and multi-factor authentication\n- Avoid hardcoded credentials in your code\n\n**Data Protection**\n- Encrypt sensitive data both in transit and at rest\n- Implement proper input validation and sanitization\n- Use HTTPS for all data transmission\n\n**Infrastructure Security**\n- Keep Node.js and dependencies up to date\n- Configure AWS security groups properly\n- Use AWS IAM roles with least privilege principle\n\n**Application Security**\n- Protect against common vulnerabilities like XSS, CSRF, and SQL injection\n- Implement rate limiting and request throttling\n- Use security headers like HSTS, CSP, and X-Frame-Options", "response_type": "markdown", "sources": [ "https://owasp.org/www-project-nodejs-goat/", "https://nodejs.org/en/docs/guides/security/", "https://aws.amazon.com/security/security-learning/" ], "response_time": 2847}
{
"error": {
"description": "Invalid or expired API key"
}
}
{
"error": {
"description": "Too Many Requests"
}
}
{
"error": {
"description": "Account is at / over message quota"
}
}
{
"error": {
"description": "Server Error"
}
}
API documentation
Search
Execute a search query.
POST
/
v1
/
search
Node.js SDK
import { AISearchAPIClient } from 'aisearchapi-client';const client = new AISearchAPIClient({ apiKey: 'YOUR_API_KEY'});const response = await client.search({ prompt: 'What are some security risks I should be aware of?', context: [{ role: 'user', content: 'I am developing a web app using Node.js and Express.' }], response_type: 'markdown'});console.log(response);
from aisearchapi_client import AISearchAPIClient, ChatMessage
client = AISearchAPIClient(api_key="YOUR_API_KEY")
response = client.search(
prompt="What are some security risks I should be aware of?",
context=[
ChatMessage(role="user", content="user conversation context for the LLM")
],
response_type="markdown"
)
print(response)
curl --request POST \
--url https://api.aisearchapi.io/v1/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "What are some security risks I should be aware of?",
"context": [
{
"role": "user",
"content": "I am developing a web app using Node.js and Express."
},
{
"role": "user",
"content": "The app stores personal data, including names and emails."
},
{
"role": "user",
"content": "We plan to deploy it on AWS."
}
],
"response_type": "markdown"
}
'
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisearchapi.io/v1/search",
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([
'prompt' => 'What are some security risks I should be aware of?',
'context' => [
[
'role' => 'user',
'content' => 'I am developing a web app using Node.js and Express.'
],
[
'role' => 'user',
'content' => 'The app stores personal data, including names and emails.'
],
[
'role' => 'user',
'content' => 'We plan to deploy it on AWS.'
]
],
'response_type' => 'markdown'
]),
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.aisearchapi.io/v1/search"
payload := strings.NewReader("{\n \"prompt\": \"What are some security risks I should be aware of?\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"I am developing a web app using Node.js and Express.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"The app stores personal data, including names and emails.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"We plan to deploy it on AWS.\"\n }\n ],\n \"response_type\": \"markdown\"\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.aisearchapi.io/v1/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"What are some security risks I should be aware of?\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"I am developing a web app using Node.js and Express.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"The app stores personal data, including names and emails.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"We plan to deploy it on AWS.\"\n }\n ],\n \"response_type\": \"markdown\"\n}")
.asString();
require 'uri'
require 'net/http'
url = URI("https://api.aisearchapi.io/v1/search")
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 \"prompt\": \"What are some security risks I should be aware of?\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"I am developing a web app using Node.js and Express.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"The app stores personal data, including names and emails.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"We plan to deploy it on AWS.\"\n }\n ],\n \"response_type\": \"markdown\"\n}"
response = http.request(request)
puts response.read_body
{ "answer": "### Node.js Security Risks and Mitigation Strategies\n\nWhen developing Node.js applications that handle personal data and deploy to AWS, you should be aware of several critical security risks:\n\n**Authentication and Authorization**\n- Implement secure session management\n- Use strong password policies and multi-factor authentication\n- Avoid hardcoded credentials in your code\n\n**Data Protection**\n- Encrypt sensitive data both in transit and at rest\n- Implement proper input validation and sanitization\n- Use HTTPS for all data transmission\n\n**Infrastructure Security**\n- Keep Node.js and dependencies up to date\n- Configure AWS security groups properly\n- Use AWS IAM roles with least privilege principle\n\n**Application Security**\n- Protect against common vulnerabilities like XSS, CSRF, and SQL injection\n- Implement rate limiting and request throttling\n- Use security headers like HSTS, CSP, and X-Frame-Options", "response_type": "markdown", "sources": [ "https://owasp.org/www-project-nodejs-goat/", "https://nodejs.org/en/docs/guides/security/", "https://aws.amazon.com/security/security-learning/" ], "response_time": 2847}
{
"error": {
"description": "Invalid or expired API key"
}
}
{
"error": {
"description": "Too Many Requests"
}
}
{
"error": {
"description": "Account is at / over message quota"
}
}
An ordered list of message objects that define the conversation context for the LLM. Each message contains a role and content. Currently, only the "user" role is supported.
The optional format parameter can be "text" or "markdown" (default). "text" returns plain text without formatting, useful for logs or custom-styled outputs. "markdown" includes rich formatting (bold, italics, lists, code, links) for apps that can render Markdown. If omitted, the API defaults to "markdown".
The total time taken to generate the response, in milliseconds.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"AI Search API","colors":{"primary":"#ff5a50","light":"#07C983","dark":"#ff5a50"},"logo":{"light":"https://mintcdn.com/aisearchapi/-4NB7pP5Gs-Pa4v8/logo/light.png?fit=max\u0026auto=format\u0026n=-4NB7pP5Gs-Pa4v8\u0026q=85\u0026s=a9c832ecd5397ef29aeb504937618376","dark":"https://mintcdn.com/aisearchapi/-4NB7pP5Gs-Pa4v8/logo/dark.png?fit=max\u0026auto=format\u0026n=-4NB7pP5Gs-Pa4v8\u0026q=85\u0026s=a764e7d27dedbc5230c0e336fa83b248"},"favicon":"/favicon.ico","navbar":{"links":[{"label":"Support","href":"mailto:admin@aisearchapi.io"}],"primary":{"type":"button","label":"Get an API key","href":"https://app.aisearchapi.io/dashboard"}},"footer":{"socials":{}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"]},"navigation":{"global":{"anchors":[{"anchor":"API Playground","icon":"play","href":"https://app.aisearchapi.io/playground"},{"anchor":"Blog","icon":"newspaper","href":"https://aisearchapi.io/blog"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"aisearchapi","hasAudioNarration":false,"actualSubdomain":"aisearchapi","customDomains":["docs.aisearchapi.io"],"gitSource":{"type":"github","owner":"aisearchapi","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a21e7b303d4026a3ef79366","collectionId":"e8da8f51-58e2-4288-9c34-7d416e07db7b","schemaVersion":"v2"},"entitlements":{},"buildId":"6a21e7b303d4026a3ef79366:success","clientVersion":"0.0.4044","searchFilterCounts":[{"language":"default","tag":"API reference","count":10},{"language":"default","tag":"Integrations","count":6},{"language":"default","tag":"API documentation","count":4}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/endpoint/search","slug":"/api-reference/endpoint/search","pageMetadata":{"title":"Search","openapi":"POST /v1/search","description":"Execute a search query.","href":"/api-reference/endpoint/search"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Execute a search query.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Search","openapi":"POST /v1/search","description":"Execute a search query.","href":"/api-reference/endpoint/search"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"description":"Execute a search query.","x-codeSamples":[{"lang":"javascript","label":"Node.js SDK","source":"import { AISearchAPIClient } from 'aisearchapi-client';\n\nconst client = new AISearchAPIClient({ \n apiKey: 'YOUR_API_KEY' \n});\n\nconst response = await client.search({\n prompt: 'What are some security risks I should be aware of?',\n context: [{\n role: 'user', \n content: 'I am developing a web app using Node.js and Express.'\n }],\n response_type: 'markdown'\n});\n\nconsole.log(response);"},{"lang":"python","label":"Python SDK","source":"from aisearchapi_client import AISearchAPIClient, ChatMessage\n\nclient = AISearchAPIClient(api_key=\"YOUR_API_KEY\")\nresponse = client.search(\n prompt=\"What are some security risks I should be aware of?\",\n context=[\n ChatMessage(role=\"user\", content=\"user conversation context for the LLM\")\n ],\n response_type=\"markdown\"\n)\n\nprint(response)"}],"requestBody":"fcf289ab-031e-49f5-9f80-40fbb90041cb","responses":{"200":"268ed3ad-55c8-4126-8fdb-720147cc6eb0","401":"e439df7b-e459-48c3-b144-60a7d93ad9c7","429":"4f36e665-a72d-4b78-a54e-7ffbf66bbff4","433":"32f8e12f-3fbe-45b5-b27f-8227e32c3d4f","500":"a8a97fde-cf3a-4cd3-9556-3470e32b6ec1"},"method":"post","type":"path","servers":["9b5cc802-11af-44fb-a035-6c8ab58214e0"],"security":["8b69582a-be03-47f2-b06a-a8c7827ed589"],"path":"/v1/search","baseUrlOptions":["https://api.aisearchapi.io"],"title":"","codeSamples":[{"label":"Node.js SDK","lang":"javascript","source":"import { AISearchAPIClient } from 'aisearchapi-client';\n\nconst client = new AISearchAPIClient({ \n apiKey: 'YOUR_API_KEY' \n});\n\nconst response = await client.search({\n prompt: 'What are some security risks I should be aware of?',\n context: [{\n role: 'user', \n content: 'I am developing a web app using Node.js and Express.'\n }],\n response_type: 'markdown'\n});\n\nconsole.log(response);"},{"label":"Python SDK","lang":"python","source":"from aisearchapi_client import AISearchAPIClient, ChatMessage\n\nclient = AISearchAPIClient(api_key=\"YOUR_API_KEY\")\nresponse = client.search(\n prompt=\"What are some security risks I should be aware of?\",\n context=[\n ChatMessage(role=\"user\", content=\"user conversation context for the LLM\")\n ],\n response_type=\"markdown\"\n)\n\nprint(response)"}],"requiredOnlyExamples":false,"requestExampleType":"codeSamples","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"description":"Search request","content":{"application/json":{"schema":{"required":["prompt"],"type":"object","properties":{"prompt":{"description":"The search query.","type":"string","isRequired":true,"uniqueKey":"prompt","typeLabel":"string"},"context":{"type":"array","items":{"required":["role","content"],"type":"object","properties":{"role":{"description":"Currently, only messages with the role \"user\" are considered when generating the context for the LLM. No other roles are supported at this time.","type":"string","isRequired":true,"uniqueKey":"context.items.[INDEX].role","typeLabel":"string"},"content":{"description":"The contents of the message. Previous messages can be included here to enhance the model's context, which will influence the final response generated.","type":"string","isRequired":true,"uniqueKey":"context.items.[INDEX].content","typeLabel":"string"}},"uniqueKey":"context.items.[INDEX]","typeLabel":"object"},"description":"An ordered list of message objects that define the conversation context for the LLM. Each message contains a role and content. Currently, only the \"user\" role is supported.","uniqueKey":"context","typeLabel":"object[]"},"response_type":{"type":"string","enum":["text","markdown"],"default":"markdown","description":"The optional format parameter can be \"text\" or \"markdown\" (default). \"text\" returns plain text without formatting, useful for logs or custom-styled outputs. \"markdown\" includes rich formatting (bold, italics, lists, code, links) for apps that can render Markdown. If omitted, the API defaults to \"markdown\".","uniqueKey":"response_type","typeLabel":"enum\u003cstring>"}},"uniqueKey":"","typeLabel":"object"},"example":{"prompt":"What are some security risks I should be aware of?","context":[{"role":"user","content":"I am developing a web app using Node.js and Express."},{"role":"user","content":"The app stores personal data, including names and emails."},{"role":"user","content":"We plan to deploy it on AWS."}],"response_type":"markdown"},"examples":{"Example":{"title":"Example","value":{"prompt":"What are some security risks I should be aware of?","context":[{"role":"user","content":"I am developing a web app using Node.js and Express."},{"role":"user","content":"The app stores personal data, including names and emails."},{"role":"user","content":"We plan to deploy it on AWS."}],"response_type":"markdown"}}},"exampleType":"examples"}},"required":true,"exampleType":"examples"},"responses":{"268ed3ad-55c8-4126-8fdb-720147cc6eb0":{"description":"Search response","content":{"application/json":{"schema":{"required":["answer","response_type","sources","response_time"],"type":"object","properties":{"answer":{"description":"The main response generated by the API based on the provided prompt and context.","type":"string","isRequired":true,"uniqueKey":"answer","typeLabel":"string"},"response_type":{"description":"The format of the response, as specified by the user.","type":"string","isRequired":true,"uniqueKey":"response_type","typeLabel":"string"},"sources":{"description":"The list of sources used to generate the response.","type":"array","items":{"type":"string","uniqueKey":"sources.items.[INDEX]","typeLabel":"string"},"isRequired":true,"uniqueKey":"sources","typeLabel":"string[]"},"response_time":{"description":"The total time taken to generate the response, in milliseconds.","type":"number","isRequired":true,"uniqueKey":"response_time","typeLabel":"number"}},"uniqueKey":"","typeLabel":"object"},"example":{"answer":"### Node.js Security Risks and Mitigation Strategies\n\nWhen developing Node.js applications that handle personal data and deploy to AWS, you should be aware of several critical security risks:\n\n**Authentication and Authorization**\n- Implement secure session management\n- Use strong password policies and multi-factor authentication\n- Avoid hardcoded credentials in your code\n\n**Data Protection**\n- Encrypt sensitive data both in transit and at rest\n- Implement proper input validation and sanitization\n- Use HTTPS for all data transmission\n\n**Infrastructure Security**\n- Keep Node.js and dependencies up to date\n- Configure AWS security groups properly\n- Use AWS IAM roles with least privilege principle\n\n**Application Security**\n- Protect against common vulnerabilities like XSS, CSRF, and SQL injection\n- Implement rate limiting and request throttling\n- Use security headers like HSTS, CSP, and X-Frame-Options","response_type":"markdown","sources":["https://owasp.org/www-project-nodejs-goat/","https://nodejs.org/en/docs/guides/security/","https://aws.amazon.com/security/security-learning/"],"response_time":2847},"examples":{"Example":{"title":"Example","value":{"answer":"### Node.js Security Risks and Mitigation Strategies\n\nWhen developing Node.js applications that handle personal data and deploy to AWS, you should be aware of several critical security risks:\n\n**Authentication and Authorization**\n- Implement secure session management\n- Use strong password policies and multi-factor authentication\n- Avoid hardcoded credentials in your code\n\n**Data Protection**\n- Encrypt sensitive data both in transit and at rest\n- Implement proper input validation and sanitization\n- Use HTTPS for all data transmission\n\n**Infrastructure Security**\n- Keep Node.js and dependencies up to date\n- Configure AWS security groups properly\n- Use AWS IAM roles with least privilege principle\n\n**Application Security**\n- Protect against common vulnerabilities like XSS, CSRF, and SQL injection\n- Implement rate limiting and request throttling\n- Use security headers like HSTS, CSP, and X-Frame-Options","response_type":"markdown","sources":["https://owasp.org/www-project-nodejs-goat/","https://nodejs.org/en/docs/guides/security/","https://aws.amazon.com/security/security-learning/"],"response_time":2847}}},"exampleType":"examples"}},"exampleType":"examples"},"e439df7b-e459-48c3-b144-60a7d93ad9c7":{"description":"Unauthorized","content":{"application/json":{"schema":{"required":["error"],"type":"object","properties":{"error":{"type":"object","properties":{"description":{"type":"string","uniqueKey":"error.description","typeLabel":"string"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"example":{"error":{"description":"Invalid or expired API key"}},"examples":{"Example":{"title":"Example","value":{"error":{"description":"Invalid or expired API key"}}}},"exampleType":"examples"}},"exampleType":"examples"},"4f36e665-a72d-4b78-a54e-7ffbf66bbff4":{"description":"Too Many Requests","content":{"application/json":{"schema":{"required":["error"],"type":"object","properties":{"error":{"type":"object","properties":{"description":{"type":"string","uniqueKey":"error.description","typeLabel":"string"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"example":{"error":{"description":"Too Many Requests"}},"examples":{"Example":{"title":"Example","value":{"error":{"description":"Too Many Requests"}}}},"exampleType":"examples"}},"exampleType":"examples"},"32f8e12f-3fbe-45b5-b27f-8227e32c3d4f":{"description":"Account is at / over message quota","content":{"application/json":{"schema":{"required":["error"],"type":"object","properties":{"error":{"type":"object","properties":{"description":{"type":"string","uniqueKey":"error.description","typeLabel":"string"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"example":{"error":{"description":"Account is at / over message quota"}},"examples":{"Example":{"title":"Example","value":{"error":{"description":"Account is at / over message quota"}}}},"exampleType":"examples"}},"exampleType":"examples"},"a8a97fde-cf3a-4cd3-9556-3470e32b6ec1":{"description":"Server Error","content":{"application/json":{"schema":{"required":["error"],"type":"object","properties":{"error":{"type":"object","properties":{"description":{"type":"string","uniqueKey":"error.description","typeLabel":"string"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"example":{"error":{"description":"Server Error"}},"examples":{"Example":{"title":"Example","value":{"error":{"description":"Server Error"}}}},"exampleType":"examples"}},"exampleType":"examples"}},"security":{"8b69582a-be03-47f2-b06a-a8c7827ed589":{"bearerAuth":{"type":"http","scheme":"bearer","scopes":[]}}},"servers":{"9b5cc802-11af-44fb-a035-6c8ab58214e0":{"url":"https://api.aisearchapi.io"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","scopes":[]},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"bearerAuth","name":"Authorization"}],"title":"bearerAuth"}]},"originalFileLocation":"api-reference/openapi.json"},"subdomain":"aisearchapi","siteName":"AI Search API","title":"Search - AI Search API","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"originalFileLocation":"api-reference/endpoint/search.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Execute a search query.\">\u003cmeta data-mint-head name=\"application-name\" content=\"AI Search API\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/aisearchapi/nqT-DV4gKrk5rmCO/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/aisearchapi/nqT-DV4gKrk5rmCO/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/aisearchapi/nqT-DV4gKrk5rmCO/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/aisearchapi/nqT-DV4gKrk5rmCO/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/aisearchapi/nqT-DV4gKrk5rmCO/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/aisearchapi/nqT-DV4gKrk5rmCO/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/aisearchapi/nqT-DV4gKrk5rmCO/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/aisearchapi/nqT-DV4gKrk5rmCO/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/aisearchapi/nqT-DV4gKrk5rmCO/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Search - AI Search API\">\u003cmeta data-mint-head property=\"og:description\" content=\"Execute a search query.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"AI Search API\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.aisearchapi.io/api-reference/endpoint/search\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://aisearchapi.mintlify.app/_mintlify/api/og/v2?division=API+documentation\u0026amp;title=Search\u0026amp;description=Execute+a+search+query.\u0026amp;theme=c5643720b834d60589adf003\u0026amp;signature=bf6ed04a236728030bcd49ee381b4e6316ab12905cc4c8f6da6a9ec2e764a739\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Search - AI Search API\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Execute a search query.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://aisearchapi.mintlify.app/_mintlify/api/og/v2?division=API+documentation\u0026amp;title=Search\u0026amp;description=Execute+a+search+query.\u0026amp;theme=c5643720b834d60589adf003\u0026amp;signature=bf6ed04a236728030bcd49ee381b4e6316ab12905cc4c8f6da6a9ec2e764a739\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/aisearchapi/nqT-DV4gKrk5rmCO/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"AI Search API\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#ff5a50\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.aisearchapi.io/api-reference/endpoint/search\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/endpoint/search.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.aisearchapi.io/#organization\",\"name\":\"AI Search API\",\"url\":\"https://docs.aisearchapi.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/aisearchapi/-4NB7pP5Gs-Pa4v8/logo/light.png?fit=max\u0026auto=format\u0026n=-4NB7pP5Gs-Pa4v8\u0026q=85\u0026s=a9c832ecd5397ef29aeb504937618376\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.aisearchapi.io#website\",\"name\":\"AI Search API\",\"url\":\"https://docs.aisearchapi.io\",\"publisher\":{\"@id\":\"https://docs.aisearchapi.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.aisearchapi.io/api-reference/endpoint/search#webpage\",\"url\":\"https://docs.aisearchapi.io/api-reference/endpoint/search\",\"name\":\"Search\",\"description\":\"Execute a search query.\",\"isPartOf\":{\"@id\":\"https://docs.aisearchapi.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.aisearchapi.io/api-reference/endpoint/search#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.aisearchapi.io/api-reference/endpoint/search#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API documentation\",\"item\":\"https://docs.aisearchapi.io/api-reference/about\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Search\",\"item\":\"https://docs.aisearchapi.io/api-reference/endpoint/search\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.aisearchapi.io/api-reference/endpoint/search#apireference\",\"headline\":\"Search\",\"name\":\"Search\",\"description\":\"Execute a search query.\",\"url\":\"https://docs.aisearchapi.io/api-reference/endpoint/search\",\"mainEntityOfPage\":{\"@id\":\"https://docs.aisearchapi.io/api-reference/endpoint/search#webpage\"},\"publisher\":{\"@id\":\"https://docs.aisearchapi.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.aisearchapi.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"AI Search API\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"AI Search API","nav":{"global":{"anchors":[{"anchor":"API Playground","icon":"play","href":"https://app.aisearchapi.io/playground"},{"anchor":"Blog","icon":"newspaper","href":"https://aisearchapi.io/blog"}]},"tabs":[{"tab":"API reference","groups":[{"group":"API documentation","pages":[{"title":"About","icon":"book","href":"/api-reference/about"},{"title":"Authentication","description":"This API documentation covers the REST endpoints for integrating with the AISearchAPI platform. These HTTP-based APIs work in any environment capable of making HTTP requests. For language-specific libraries and SDKs, check the libraries page.","icon":"key","href":"/api-reference/authentication"},{"title":"Search","openapi":"POST /v1/search","href":"/api-reference/endpoint/search"},{"title":"Balance","openapi":"GET /v1/balance","description":"Get account balance","href":"/api-reference/endpoint/balance"}]},{"group":"Integrations","pages":[{"title":"Node.js SDK","icon":"js","href":"/api-reference/integrations/javascript"},{"title":"Python SDK","icon":"python","href":"/api-reference/integrations/python"},{"title":"LangChain","icon":"link","href":"/api-reference/integrations/langchain"},{"title":"MCP","icon":"server","href":"/api-reference/integrations/mcp"},{"title":"n8n Node","icon":"https://mintlify.s3.us-west-1.amazonaws.com/aisearchapi/icons/n8n.svg","href":"/api-reference/integrations/n8n"},{"title":"CrewAI","icon":"https://mintlify.s3.us-west-1.amazonaws.com/aisearchapi/icons/crewai.svg","href":"/api-reference/integrations/crewai"}]}]}]},"basePath":"","title":"Search - AI Search API","buildId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","deploymentId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-CS552b7R.js","utils-DDTCYAF2.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-De8ttokP.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-DrwRDvAh.js","snippetPresets-DtAN0nWx.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-D5rWArI6.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-O2i12wsz.js","shallow-DV8xABTt.js","getApiPlaygroundDisplay-DBZ0B5Jx.js","CodeSnippet-BVi0tPUX.js","CodeSnippets-CqASbIwY.js","Page-m07pfKpT.js","getPastedJson-DG9vsMS8.js","icon-CXzRSCr8.js","MethodPill-BdKVtEuX.js","DuplicateIcon-CZlmBrJI.js","createIcon-biFEUKPL.js","DynamicMarkdown-B54_zNBF.js","SectionHeading-DwwHK3Pt.js","axios-vUo_bRtp.js","Markdown-DfhCTwyA.js","clsx-xpJZXxdP.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-BTZUMDnx.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-DqdKa2R4.js"]}