API Documentation

The PromptKnight API enables seamless integration of AI-powered virtual assistants into your applications.

API Endpoint

POST https://prompt-knight.vercel.app/api/prompt-knight

Headers

{
  "Content-Type": "application/json",
  "Authorization": "Bearer YOUR_API_KEY"
}

Request Parameters

Parameter Type Description
entity_type string Type of business entity (e.g., "enterprise", "university", "hotel")
entity_id string Your unique entity identifier
query string The user's question or request
chat_history array Previous messages for context (optional)
customer_ip string Client IP address for rate limiting

Response Format

{
  "response": "Hello! How can I assist you today?",
  "tokens_used": 150,
  "block_user": false,
  "customer_ip": "192.168.1.1"
}

Code Examples

import requests

API_URL = "https://prompt-knight.vercel.app/api/prompt-knight"
headers = {
    "Content-Type": "application/json",
}

data = {
    "entity_type": "enterprise",
    "entity_id": "your-entity-id",
    "query": "Hello!",
    "chat_history": [],
    "customer_ip": "192.168.1.1"
}

response = requests.post(API_URL, json=data, headers=headers)
print(response.json())