Documentation for the CNDQ Marketplace game.
The CNDQ API is fully documented using OpenAPI 3.0 (Swagger).
Interactive Swagger UI (Recommended):
- Navigate to
/api-docs.phpin your web browser - Try out endpoints directly in the browser
- See request/response examples
- Test with your session
Static Documentation:
- Read API.md for a comprehensive guide
- View openapi.yaml for the raw OpenAPI spec
- API Overview - Complete API documentation
- OpenAPI Spec - Machine-readable API specification
- Swagger UI - Interactive API explorer
- Database Guide - Database structure and initialization
- Professor Setup Guide - Zero-to-running guide for Windows, no GUI installers, screen-reader friendly
- Start your local server (Laravel Herd, XAMPP, etc.)
- Navigate to
http://your-domain.local/api-docs.php - Log in to get a session cookie
- Use "Try it out" in Swagger UI to test endpoints
All endpoints are under /api/:
/api/session/status - Session and phase info
/api/marketplace/offers - View marketplace
/api/offers/create - Create offers
/api/negotiations/initiate - Start negotiations
/api/listings/post - Post buy listings
... and more
See API.md for the complete list.
Most endpoints require authentication via session cookies. The /api/session/status endpoint is public and doesn't require authentication.
JavaScript (fetch):
// Get session status (public)
const response = await fetch('/api/session/status');
const data = await response.json();
// Create an offer (requires auth)
const response = await fetch('/api/offers/create', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
credentials: 'include', // Include session cookie
body: JSON.stringify({
chemical: 'C',
quantity: 100,
minPrice: 5.50
})
});cURL:
# Get session status
curl https://your-domain.com/api/session/status
# Create an offer
curl -X POST https://your-domain.com/api/offers/create \
-H "Content-Type: application/json" \
-H "Cookie: PHPSESSID=your-session-id" \
-d '{"chemical":"C","quantity":100,"minPrice":5.50}'- C - Carbon
- N - Nitrogen
- D - Deuterium
- Q - Quantum particles
- TRADING - Market open, players can trade
- PRODUCTION - Production calculations running, market locked
- STOPPED - Game paused by administrator
- Marketplace - Public offers and buy orders
- Negotiations - Private 1-on-1 trading
- Advertisements - Attract trading partners
- Production - Generate chemicals and earn points
- Leaderboard - Team rankings
- NPC Teams - AI-controlled teams (admin feature)
When adding new API endpoints:
- Add the endpoint to openapi.yaml
- Update API.md if needed
- Test using Swagger UI at
/api-docs.php - Follow existing patterns for request/response formats
Contact the game administrator or check the code comments in the PHP files.