Welcome to the CNDQ (Chemical Name-Drop Quote) Marketplace API documentation.
Access the interactive Swagger UI documentation:
- Via Web Server: Navigate to
/api-docs.phpin your browser - Standalone: Open
docs/index.htmlin your browser
All API endpoints are prefixed with /api/:
/api/session/status
/api/marketplace/offers
/api/offers/create
etc.
Most API endpoints require authentication via session cookies (except /api/session/status).
Users must be logged in through Shibboleth (university SSO). In local development, the dev.php page bypasses authentication for testing. The session cookie PHPSESSID is automatically managed by the browser.
The CNDQ marketplace operates in phases:
- TRADING - Players can create offers, negotiate, and execute trades
- PRODUCTION - Production calculations run, market is locked
- STOPPED - Game is paused by admin
Check the current phase using /api/session/status.
Four types of chemicals can be traded:
- C - Carbon
- N - Nitrogen
- D - Deuterium
- Q - Quantum particles
- sell - Offering to sell chemicals you own
- buy - Creating a buy order for chemicals you want
- Offers (sell orders) - You post what you're selling
- Buy Orders - You post what you want to buy
- Both appear in the marketplace for other teams to see
Private 1-on-1 negotiations between teams:
- Initiate a negotiation with a specific team
- Make counter-offers back and forth
- Accept or reject the final terms
- Can be tied to advertisements
Public messages to attract trading partners:
- Post what you're looking to buy or sell
- Other teams can initiate negotiations based on your ad
- Limited to 280 characters
GET /api/session/status- Get current session, phase, and timer (public)POST /api/session/status- Acknowledge production results
GET /api/marketplace/offers- View all active offers and buy orders- Query param:
?chemical=Cor?chemical=C,N,Dto filter
- Query param:
POST /api/offers/create- Create a sell offerPOST /api/offers/bid- Create a buy orderPOST /api/offers/cancel- Cancel an offer
GET /api/negotiations/list- List your negotiationsPOST /api/negotiations/initiate- Start a negotiationPOST /api/negotiations/accept- Accept current offerPOST /api/negotiations/counter- Make counter-offerPOST /api/negotiations/reject- Reject negotiationPOST /api/negotiations/react- Add emoji reaction
GET /api/listings/list- View all active buy listingsGET /api/listings/my-listings- View your own buy listingsPOST /api/listings/post- Post a buy listingPOST /api/listings/cancel- Cancel a buy listing
GET /api/production/results- Your production resultsGET /api/production/shadow-prices- Current shadow pricesGET /api/leaderboard/standings- Team rankingsGET /api/notifications/list- Your notifications
GET /api/team/settings- Get team profilePOST /api/team/settings- Update team settings
GET/POST /api/admin/session- Control game sessionPOST /api/admin/reset-game- Reset game stateGET /api/admin/npc/list- List NPC teamsPOST /api/admin/npc/create- Create NPCPOST /api/admin/npc/delete- Delete NPCPOST /api/admin/npc/toggle- Enable/disable NPCPOST /api/admin/npc/toggle-system- Enable/disable NPC system
{
"success": true,
"message": "Operation completed",
"data": { ... }
}{
"error": "Error type",
"message": "Detailed error message"
}200- Success400- Bad Request (invalid data)401- Unauthorized (not logged in)403- Forbidden (wrong phase, not admin, etc.)405- Method Not Allowed (wrong HTTP method)500- Server Error
curl https://your-domain.com/api/session/statusResponse:
{
"success": true,
"session": 3,
"phase": "TRADING",
"timeRemaining": 180,
"autoAdvance": true,
"productionJustRan": null,
"gameStopped": false
}curl https://your-domain.com/api/marketplace/offers?chemical=C \
-H "Cookie: PHPSESSID=your-session-id"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
}'curl -X POST https://your-domain.com/api/negotiations/initiate \
-H "Content-Type: application/json" \
-H "Cookie: PHPSESSID=your-session-id" \
-d '{
"responderId": "team@example.com",
"chemical": "N",
"quantity": 50,
"price": 8.25,
"type": "buy"
}'✅ Allowed:
- Create/cancel offers and buy orders
- Initiate/respond to negotiations
- Post advertisements
- Execute trades
❌ Blocked:
- All trading activities
- Creating new offers
- Starting negotiations
✅ Allowed:
- View marketplace (read-only)
- View production results
- Check notifications
❌ Almost all actions blocked ✅ Only viewing/reading allowed
The marketplace uses a 3-second cache for /api/marketplace/offers to improve performance. Frequent polling is acceptable.
Not yet implemented. Currently uses polling for real-time updates.
See the OpenAPI Specification for detailed schema definitions of:
- Offer
- BuyOrder
- Negotiation
- Advertisement
- And more...
Use the interactive Swagger UI to test endpoints directly in your browser:
- Navigate to
/api-docs.php - Click "Try it out" on any endpoint
- Fill in parameters
- Click "Execute"
- View the response
All endpoints validate:
- Required fields are present
- Data types are correct
- Chemical codes are valid (C, N, D, Q)
- Quantities and prices are positive
- Trading is allowed in current phase
The API returns descriptive error messages. Common errors:
"Not authenticated"- Session expired or not logged in"Trading not allowed"- Wrong game phase"Invalid chemical"- Chemical must be C, N, D, or Q"Insufficient inventory"- Don't have enough to sell"Cannot negotiate with yourself"- Need to trade with another team
For bugs or feature requests, contact the game administrator.
- v1.0.0 - Initial API documentation (2026-01-05)