Documentation

Everything you need to integrate Promptective and secure your AI applications.

Quickstart Guide

1Install the SDK

Add Promptective to your project using your package manager.

npm install @promptective/sdk

2Initialize the Client

Configure the SDK with your API key from the dashboard.

import { Promptective } from '@promptective/sdk';

const promptective = new Promptective({
  apiKey: process.env.PROMPTECTIVE_API_KEY,
});

3Analyze Prompts

Check user inputs before sending them to your LLM.

// Analyze a prompt before sending to LLM
const result = await promptective.analyze({
  prompt: userInput,
  context: { userId: user.id },
});

if (result.isBlocked) {
  // Handle detected threat
  console.log('Threat detected:', result.threats);
} else {
  // Safe to proceed with LLM call
  const response = await openai.chat(userInput);
}

API Reference

Promptective provides a RESTful API for analyzing prompts, retrieving traffic logs, and managing alerts.

POST/api/v1/analyze

Analyze a prompt for potential threats. Returns detection results and risk scores.

curl -X POST https://api.promptective.com/v1/analyze \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "User input here",
    "options": {
      "detectInjection": true,
      "detectPII": true,
      "detectToxicity": true
    }
  }'
GET/api/v1/traffic

Retrieve traffic logs with filtering and pagination support.

GET/api/v1/alerts

List security alerts with filtering by severity, type, and date range.

Detection Rules

Promptective includes built-in detection rules for common LLM attacks. You can also create custom rules.

Prompt Injection

Detects attempts to override system instructions or inject malicious commands.

Jailbreak Attempts

Identifies jailbreak patterns like DAN, roleplay exploits, and boundary violations.

PII Detection

Flags requests containing personal information like emails, phone numbers, or SSNs.

Data Exfiltration

Catches attempts to extract training data, system prompts, or sensitive information.

Encoded Attacks

Detects encoded payloads in Base64, ROT13, hex, and other formats.

Authority Spoofing

Identifies fake authority claims like 'As an admin...' or 'The developer said...'.

Official SDKs

We provide official SDKs for popular languages. All SDKs are open source and available on GitHub.

JavaScript/TypeScript

npm install @promptective/sdk

Python

pip install promptective

Go

go get github.com/promptective/go-sdk

Need Help?

Can't find what you're looking for? Join our community or contact support.