Skip to main content

API Endpoints

Complete reference for all QWED API endpoints.

Base URL

https://api.qwed.ai/v1

Health Check

GET /health

Check API status.

curl https://api.qwed.ai/v1/health

Response:

{
"status": "healthy",
"version": "1.0.0",
"timestamp": "2024-12-20T12:00:00Z"
}

Verification Endpoints

POST /verify

Auto-detect and verify any claim.

Request:

{
"query": "Is 2+2=4?",
"options": {
"include_attestation": true
}
}

Response:

{
"status": "VERIFIED",
"verified": true,
"engine": "math",
"result": {
"is_valid": true
},
"attestation": "eyJhbGciOiJFUzI1NiIs..."
}

POST /verify/math

Verify mathematical expressions.

Request:

{
"expression": "x**2 + 2*x + 1 = (x+1)**2"
}

POST /verify/logic

Verify logical constraints.

Request:

{
"query": "(AND (GT x 5) (LT y 10))",
"format": "dsl"
}

Response:

{
"status": "VERIFIED",
"verified": true,
"result": {
"satisfiability": "SAT",
"model": {"x": 6, "y": 9}
}
}

POST /verify/code

Check code for security vulnerabilities.

Request:

{
"code": "import os\nos.system('rm -rf /')",
"language": "python"
}

Response:

{
"status": "BLOCKED",
"verified": false,
"result": {
"vulnerabilities": [
{
"type": "os.system",
"severity": "critical",
"line": 2,
"message": "Shell command execution"
}
]
}
}

POST /verify/sql

Validate SQL queries.

Request:

{
"query": "SELECT * FROM users WHERE id = 1",
"schema": "CREATE TABLE users (id INT, name TEXT)",
"dialect": "postgresql"
}

POST /verify/fact

Verify factual claims.

Request:

{
"claim": "Paris is the capital of France",
"context": "France is a country in Western Europe. Its capital is Paris."
}

POST /verify/batch

Verify multiple items at once.

Request:

{
"items": [
{"query": "2+2=4", "type": "math"},
{"query": "3*3=9", "type": "math"},
{"query": "(GT x 5)", "type": "logic"}
],
"options": {
"parallel": true,
"stop_on_failure": false
}
}

Response:

{
"results": [...],
"summary": {
"total": 3,
"verified": 3,
"failed": 0,
"success_rate": 100.0
}
}

Agent Endpoints

POST /agent/register

Register a new AI agent.

Request:

{
"name": "MyAgent",
"type": "supervised",
"principal_id": "user_123",
"permissions": {
"allowed_engines": ["math", "logic"]
},
"budget": {
"max_daily_cost_usd": 100,
"max_requests_per_hour": 1000
}
}

POST /agent/verify-action

Verify an agent action before execution.

Request:

{
"agent_id": "agent_abc123",
"action": {
"type": "execute_sql",
"query": "SELECT * FROM users"
}
}

Attestation Endpoints

GET /attestation/:id

Get an attestation by ID.

POST /attestation/verify

Verify an attestation JWT.

Request:

{
"jwt": "eyJhbGciOiJFUzI1NiIs..."
}

Badge Endpoints

GET /badge/verified

Get a verified badge SVG.

GET /badge/status/:status

Get a badge for any status.

GET /badge/custom

Generate a custom badge.

Query params: label, message, color, logo