Skip to content

Bachao.AI API & SDK — Trigger VAPT Scans, Stream Findings, Automate DPDP Evidence

REST endpoints, runtime-protection SDKs, and CI/CD integrations for shipping faster without trading away security. Built for Indian SaaS startups, SMBs, and platform teams.

Quickstart: Trigger Your First VAPT Scan (cURL)

One curl call kicks off a full automated VAPT against a target you control.

Book a scan
curl -X POST https://www.bachao.ai/api/scans/book \
-H "Cookie: bachao-session=YOUR_SESSION" \
-H "Content-Type: application/json" \
-d '{"scanUrl":"https://staging.example.com","scanType":"pentest"}'

# Response:
# { "success": true, "scanId": "clx...", "status": "queued" }

Your session cookie comes from the dashboard login. For unattended pipelines, generate a setup token (see API Authentication) and use it instead. The scan ID returned here is what you poll onGET /api/scansor receive via webhook when complete.

RASP SDK Quickstart

Add runtime protection to your Node.js app in under 2 minutes.

Install
npm install @bachao/rasp-node
Express
import express from "express";
import { bachaoRasp } from "@bachao/rasp-node";

const app = express();

app.use(bachaoRasp({
apiKey: process.env.BACHAO_RASP_KEY!,
appName: "my-api",
mode: "monitor", // start in monitor mode, switch to "block" from dashboard
}));

app.listen(3000);
Fastify
import Fastify from "fastify";
import { bachaoRaspFastify } from "@bachao/rasp-node/fastify";

const app = Fastify();
app.register(bachaoRaspFastify, {
apiKey: process.env.BACHAO_RASP_KEY!,
appName: "my-api",
});
NestJS
import { Module } from "@nestjs/common";
import { BachaoRaspModule } from "@bachao/rasp-node/nestjs";

@Module({
imports: [BachaoRaspModule.forRoot({
apiKey: process.env.BACHAO_RASP_KEY!,
appName: "my-api",
})],
})
export class AppModule {}

API Authentication

How authentication works between the dashboard, SDK, and API.

Auth Flow

  1. Dashboard generates a setup token via POST /api/rasp/setup/generate-key
  2. SDK uses the setup token during agent registration
  3. Agent receives a permanent API key (sent via x-rasp-key header)
  4. All subsequent SDK → API calls use the x-rasp-key header
  5. Dashboard calls use a session cookie (from OTP login)
Generate setup token from dashboard
# Generate setup token from dashboard
curl -X POST https://www.bachao.ai/api/rasp/setup/generate-key \
-H "Cookie: bachao-session=YOUR_SESSION" \
-H "Content-Type: application/json"

# Response:
# { "success": true, "setupToken": "eyJ..." }

API Endpoints Reference

All public API endpoints available for integration.

MethodEndpointAuthDescription
POST/api/rasp/registerSetup tokenRegister new RASP agent
POST/api/rasp/heartbeatAPI keyAgent health check + rule sync
POST/api/rasp/eventsAPI keyReport security events (batch)
GET/api/rasp/rulesAPI keyFetch protection rules
POST/api/rasp/rulesSessionCreate protection rule
GET/api/rasp/agentsSessionList registered agents
GET/api/rasp/statsSessionDashboard statistics
POST/api/scans/bookSessionBook a VAPT scan
GET/api/scansSessionList your scans
GET/api/reports/{id}SessionFetch scan report

Webhook Reference

Receive real-time notifications when events occur in your account.

scan.completed event payload
{
"event": "scan.completed",
"scanId": "clx...",
"scanUrl": "https://example.com",
"scanType": "pentest",
"riskScore": 72,
"findingsCount": 23,
"criticalCount": 2,
"timestamp": "2026-03-23T10:00:00Z"
}

CI/CD Integration

Trigger security scans automatically from your deployment pipeline.

.github/workflows/security-scan.yml
# .github/workflows/security-scan.yml
name: Bachao.AI Security Scan
on: [push]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Trigger VAPT Scan
run: |
curl -X POST https://www.bachao.ai/api/scans/book \
-H "Cookie: bachao-session=${{secrets.BACHAO_SESSION}}" \
-H "Content-Type: application/json" \
-d '{"scanUrl":"https://staging.example.com","scanType":"pentest"}'

SDKs & Libraries

Official client libraries and platform support.

@bachao/rasp-node

Node.js RASP SDK

npm

Java, Python, PHP

Server-side RASP agents

Coming Soon

REST API

Available for all products

Available

Rate Limits, Errors & Status Codes

What our APIs return, how we throttle, and what to do when something breaks.

Rate limits

  • /api/scans/book — 6 / hour / account
  • /api/rasp/events — 60 / minute / agent (batched)
  • /api/rasp/heartbeat — 12 / minute / agent
  • Dashboard reads — 600 / minute / session

When throttled you'll get a 429 with aRetry-After header in seconds.

Error shape

{
"success": false,
"error": "validation_failed",
"message": "scanUrl must be a valid URL",
"field": "scanUrl"
}
StatusMeaningAction
200OKSuccess — response body is your data.
201CreatedResource created (scan, agent, rule).
400Bad requestInspect error.field — fix payload, retry.
401UnauthorizedMissing or expired session / API key.
403ForbiddenAuth OK but role lacks permission.
404Not foundResource doesn't exist or isn't yours.
409ConflictDuplicate (e.g., agent already registered).
429Rate limitedHonour Retry-After, back off, then retry.
5xxServer errorRetry with exponential backoff. Page us if persistent.

Need help integrating?

Talk to our engineering team. We'll help you get set up in under 30 minutes.

Talk to Engineering
Find your vulnerabilitiesStart free scan →