Skip to main content

Base URL

The Jefftube API runs on:
http://localhost:3001/api

Authentication

The Jefftube API uses IP-based authentication with automatic user creation:
  • Users are automatically identified by their IP address
  • Each IP address is hashed using SHA-256 with a salt for privacy
  • A unique username (format: @user-xxxxxx) is automatically generated
  • No registration or login required

IP Detection

The API checks the following headers in order:
  1. x-forwarded-for - First IP in the list
  2. x-real-ip - Direct IP header
  3. Fallback to 127.0.0.1 for local development

Rate Limiting

All API endpoints are protected by rate limiting:
rate-limit
global
50 requests per minute per IP address
When you exceed the rate limit, the API returns a 429 Too Many Requests response.

reCAPTCHA Protection

Certain write operations require reCAPTCHA verification to prevent abuse:
  • Creating comments
  • Liking/unliking comments
  • Liking/unliking videos

Implementation

For protected endpoints, include the reCAPTCHA token in the request header:
headers: {
  'X-Recaptcha-Token': 'your-recaptcha-token'
}
In local development without RECAPTCHA_SECRET_KEY configured, reCAPTCHA verification is skipped.

Verification Threshold

reCAPTCHA v3 scores must be 0.5 or higher to pass verification.

Error Handling

The API uses standard HTTP status codes:
200
OK
Request succeeded
201
Created
Resource created successfully
400
Bad Request
Invalid request parameters or validation failed
403
Forbidden
reCAPTCHA verification failed or token missing
404
Not Found
Resource or endpoint not found
429
Too Many Requests
Rate limit exceeded
500
Internal Server Error
Server error occurred

Response Format

Success Responses

Successful responses return JSON with the requested data:
{
  "id": "...",
  "field": "value"
}

Error Responses

Error responses include an error field with a descriptive message:
{
  "error": "Error description"
}

Data Types

UUIDs

User IDs, comment IDs, and like IDs are UUIDs (v4 format):
"550e8400-e29b-41d4-a716-446655440000"

Video IDs

Video IDs are string identifiers (up to 50 characters):
"EFTA01683563"

Timestamps

All timestamps are in ISO 8601 format:
"2026-03-05T12:34:56.789Z"

Health Check

A health check endpoint is available outside the /api namespace:
GET /health
Response:
{
  "status": "ok",
  "timestamp": "2026-03-05T12:34:56.789Z"
}

Build docs developers (and LLMs) love