Skip to main content

Overview

WhatDoc uses JWT (JSON Web Token) authentication. After signing up or signing in, you’ll receive a token that must be included in subsequent API requests.

Authentication Methods

WhatDoc supports three authentication methods:
  1. Email/Password - Traditional signup and signin
  2. Google OAuth - Sign in with Google
  3. GitHub OAuth - Link GitHub account for private repository access

Sign Up

Create a new user account.
curl -X POST https://api.whatdoc.xyz/auth/signup \
  -H "Content-Type: application/json" \
  -d '{
    "fname": "John",
    "lname": "Doe",
    "email": "[email protected]",
    "password": "securePassword123"
  }'
fname
string
required
User’s first name
lname
string
required
User’s last name
email
string
required
Valid email address
password
string
required
Password (minimum 6 characters)
message
string
Success message
token
string
JWT token (expires in 7 days)
user
object
User object containing profile and plan information

Sign In

Authenticate with existing credentials.
curl -X POST https://api.whatdoc.xyz/auth/signin \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "securePassword123"
  }'
email
string
required
User’s email address
password
string
required
User’s password
Response: Same structure as Sign Up endpoint.

Google Authentication

Authenticate or create account using Google OAuth.
curl -X POST https://api.whatdoc.xyz/auth/google \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "displayName": "John Doe",
    "photoURL": "https://lh3.googleusercontent.com/..."
  }'
email
string
required
Email from Google OAuth
displayName
string
Display name from Google
photoURL
string
Profile photo URL from Google

Using Authentication Token

Include the JWT token in the Authorization header for protected endpoints:
curl -X GET https://api.whatdoc.xyz/auth/me \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Get Current User

Retrieve the authenticated user’s profile.
curl -X GET https://api.whatdoc.xyz/auth/me \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Authentication: Required
current_user
object
Complete user profile (excludes password and GitHub access token)

GitHub Integration

Get GitHub Auth URL

Get the OAuth URL to connect GitHub account.
curl -X GET "https://api.whatdoc.xyz/auth/github?includePrivate=true" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Authentication: Required
includePrivate
boolean
default:"false"
Request access to private repositories
url
string
GitHub OAuth authorization URL

Get GitHub Repositories

Fetch all repositories from the authenticated user’s GitHub account.
curl -X GET https://api.whatdoc.xyz/auth/github/repos \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Authentication: Required
username
string
GitHub username
repos
array
Array of repository objects
curl -X PUT https://api.whatdoc.xyz/auth/github/unlink \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Authentication: Required

Profile Management

Update Profile

Update user profile information.
curl -X PUT https://api.whatdoc.xyz/auth/profile \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "Jane",
    "lastName": "Smith",
    "avatarUrl": "https://example.com/avatar.jpg"
  }'
Authentication: Required
firstName
string
Updated first name
lastName
string
Updated last name
avatarUrl
string
Profile avatar URL

Promo Codes

Redeem Promo Code

Activate promo codes for bonus generations or plan upgrades.
curl -X POST https://api.whatdoc.xyz/auth/redeem-pro \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "WHATDOCFAM"
  }'
Authentication: Required
code
string
required
Promo code to redeem
Available Codes:
  • Pro access code (configured via PRO_CODE env var)
  • FREE5DOCS - Enables 5 documentation limit
  • WHATDOCFAM - 10 bonus generations + premium templates (limited redemptions)

Account Deletion

Permanently delete user account and all associated projects.
curl -X DELETE https://api.whatdoc.xyz/auth/account \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "password": "securePassword123"
  }'
Authentication: Required
password
string
required
User’s password for confirmation
This action is irreversible. All projects will be permanently deleted.

Token Expiration

JWT tokens expire after 7 days. After expiration, users must sign in again to obtain a new token.

Build docs developers (and LLMs) love