AI Tools Directory API Reference

Complete REST API documentation for the AI Tools Directory backend — built on Cloudflare Workers, Hono, and D1. All endpoints return JSON.

Base URL https://ai-tools-backend.workers.dev/api

⚡ Environments

Productionhttps://ai-tools-backend.workers.dev/api
Local Devhttp://localhost:8787/api
HealthGET /health

🔐 Authentication

Most endpoints require a valid JWT access token. Tokens are issued after login or email verification and expire in 15 minutes. Refresh tokens last 30 days.

Option 1 — Authorization Header (recommended)

HTTP
Authorization: Bearer <access_token>

Option 2 — Cookie (browser clients)

Cookie
access_token=<access_token>
â„šī¸ All 🔒 Auth Required endpoints will return 401 Unauthorized without a valid token. Admin-only endpoints return 403 Forbidden for non-admin users.

Error Format

All errors follow a consistent JSON envelope regardless of the error type.

JSON — Error Response
{
  "success": false,
  "errorCode": "VALIDATION_ERROR",
  "message": "Validation failed",
  "errors": [         // present for validation errors only
    { "field": "email", "message": "Invalid email address" }
  ]
}

HTTP Status Codes

200
OK — Success
201
Created
400
Bad Request
401
Unauthorized
403
Forbidden
404
Not Found
409
Conflict
422
Unprocessable
500
Server Error

API Modules