← Back to ChaiCode

Developer Portal

API documentation, integration guides, and machine-readable discovery files for ChaiCode.

Quickstart

Get started with ChaiCode's API in under 2 minutes:

1. Check API health

curl https://chaicode.com/health.json

2. Explore the OpenAPI spec

curl https://chaicode.com/openapi.json | jq .

3. Use the free API sandbox

# FreeAPI requires no authentication for most endpoints
curl https://api.freeapi.app/api/v1/public/randomusers

API Reference

Endpoint Method Description Auth
/health.json GET Deployment health check None
/openapi.json GET OpenAPI 3.1.0 specification None
/sitemap.xml GET XML sitemap of all pages None
/robots.txt GET Crawler directives None
/llms.txt GET AI agent context (summary) None
/llms-full.txt GET AI agent context (full) None
/graphql POST GraphQL API OAuth 2.0

OpenAPI Specification

The full OpenAPI 3.1.0 spec is available at /openapi.json. It describes all public endpoints with typed schemas, operation IDs, and example responses.

{
  "openapi": "3.1.0",
  "info": {
    "title": "ChaiCode Public API",
    "version": "1.0.0"
  },
  "servers": [{ "url": "https://chaicode.com" }]
}

GraphQL API

ChaiCode exposes a GraphQL API at /graphql. Introspection requires authentication via OAuth 2.0 bearer token.

Example query

curl -X POST https://chaicode.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{"query":"{ __schema { types { name } } }"}'

MCP ServerModel Context Protocol

ChaiCode provides an MCP server for AI agents (Claude, ChatGPT, etc.) to interact with the platform programmatically.

Available tools

Tool Description
navigate_to_route Navigate within chaicode.com to a known marketing or policy route
open_course_catalog Open the ChaiCode course catalog on courses.chaicode.com

Authentication

ChaiCode uses OAuth 2.0 for API authentication. Discovery metadata:

Supported grant types

Rate Limits

API responses include standard rate-limit headers per the IETF RateLimit header fields draft:

Header Description
RateLimit-Limit Maximum number of requests allowed in the current window
RateLimit-Remaining Number of requests remaining in the current window
RateLimit-Reset Seconds until the rate limit window resets
Retry-After Seconds to wait before retrying (included on 429 responses)

Public endpoints (health, openapi, sitemap, llms.txt) have generous rate limits. The GraphQL API has stricter limits based on query complexity.

Discovery Files

File URL Purpose
OpenAPI /openapi.json API specification
Sitemap /sitemap.xml Page index for crawlers
robots.txt /robots.txt Crawler directives
llms.txt /llms.txt AI agent context
llms-full.txt /llms-full.txt Extended AI agent context
API Catalog /.well-known/api-catalog RFC 9727 linkset
MCP Server Card /.well-known/mcp/server-card.json MCP capabilities
MCP Manifest /.well-known/mcp/manifest.json MCP tool definitions
Agent Skills /.well-known/agent-skills/index.json Agent skill index
Agent Card (A2A) /.well-known/agent-card.json A2A agent capabilities

Free Tier & Sandbox

No-auth public access

All public website pages, discovery files, and metadata endpoints are accessible without authentication. No API key required.

FreeAPI — Open-source API sandbox

FreeAPI (https://freeapi.app) is ChaiCode's fully open-source, self-serve API platform. Most endpoints require no authentication. It's ideal for:

Source code: github.com/hiteshchoudhary/apihub

SDKs & CLI

The chaicode npm package is available for CLI usage:

npx chaicode