Skip to main content
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);
{
  "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
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Search request

prompt
string
required

The search query.

context
object[]

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.

response_type
enum<string>
default:markdown

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".

Available options:
text,
markdown

Response

Search response

answer
string
required

The main response generated by the API based on the provided prompt and context.

response_type
string
required

The format of the response, as specified by the user.

sources
string[]
required

The list of sources used to generate the response.

response_time
number
required

The total time taken to generate the response, in milliseconds.