Skip to main content

Welcome to WhatDoc API

The WhatDoc API enables you to programmatically generate, manage, and customize documentation for your GitHub repositories. This REST API uses JWT authentication and returns JSON responses.

Base URL

All API requests should be made to:
https://api.whatdoc.xyz
For local development:
http://localhost:3000

API Routes Structure

The API is organized into the following route groups:
  • /auth - Authentication and user management
  • /projects - Project creation and management
  • /payment - Payment and subscription handling

Response Format

Success Response

All successful API responses follow this structure:
{
  "message": "Operation successful",
  "data": {
    // Response data varies by endpoint
  }
}

Error Response

Error responses include an error message and appropriate HTTP status code:
{
  "error": "Error description",
  "code": "ERROR_CODE" // Optional error code
}

HTTP Status Codes

The API uses standard HTTP status codes:
Status CodeDescription
200Success - Request completed successfully
201Created - Resource created successfully
400Bad Request - Invalid request parameters
401Unauthorized - Invalid or missing authentication
403Forbidden - Insufficient permissions
404Not Found - Resource not found
409Conflict - Resource already exists
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Server error

Rate Limiting

API endpoints are rate-limited to prevent abuse:
  • Generation endpoints: 30 requests per minute
  • Standard headers are included in rate limit responses
  • When rate limited, you’ll receive a 429 status code
{
  "error": "Too many generation requests."
}

CORS

The API supports CORS for:
  • Whitelisted origins configured in CORS_ORIGINS
  • Subdomains of whatdoc.xyz
  • Custom domains configured in project settings

Content Type

All requests with a body should include the Content-Type header:
Content-Type: application/json

Bring Your Own Key (BYOK)

For LLM API calls, you can optionally provide your own API key: Headers:
  • X-Custom-Api-Key - Your LLM provider API key
  • X-Target-Model - Target model (default: gemini-2.5-flash-lite)

Payment Endpoints

Create Order

Create a Razorpay payment order for upgrading to Pro.
curl -X POST https://api.whatdoc.xyz/payment/create-order \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "planTier": "499"
  }'
Request Body:
planTier
string
required
Plan tier to upgrade to. Options: "499" (₹499/month - 10 repos) or "999" (₹999/month - 25 repos)
Response:
{
  "id": "order_N1234567890",
  "entity": "order",
  "amount": 49900,
  "currency": "INR",
  "receipt": "rcpt_abc123_1234567890",
  "status": "created",
  "key_id": "rzp_live_xxxxxxxxxx"
}
id
string
Razorpay order ID to be used in payment verification
amount
number
Amount in smallest currency unit (paise for INR)
key_id
string
Razorpay key ID for client-side payment integration

Verify Payment

Verify Razorpay payment and activate Pro subscription.
curl -X POST https://api.whatdoc.xyz/payment/verify \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "razorpay_order_id": "order_N1234567890",
    "razorpay_payment_id": "pay_N1234567890",
    "razorpay_signature": "signature_string",
    "planTier": "499"
  }'
Request Body:
razorpay_order_id
string
required
Order ID from create-order response
razorpay_payment_id
string
required
Payment ID from Razorpay client callback
razorpay_signature
string
required
Payment signature from Razorpay client callback
planTier
string
required
Plan tier being purchased ("499" or "999")
Response:
{
  "success": true,
  "message": "Payment verified and upgraded successfully.",
  "user": {
    "isPro": true,
    "planTier": "499",
    "proExpiryDate": "2026-04-03T15:00:00.000Z"
  }
}
Pro subscriptions are valid for 30 days from the payment verification date.

Next Steps

Authentication

Learn how to authenticate API requests

Projects

Create and manage documentation projects

Generation

Monitor documentation generation status

Customization

Customize your documentation site

Build docs developers (and LLMs) love