API Documentation Maintenance Guide
This guide explains how to maintain and update the GDELT Cloud API documentation using Mintlify.Overview
The API documentation is automatically generated from your Next.js API routes usingnext-openapi-gen, which reads JSDoc comments and Zod schemas to create an OpenAPI specification that Mintlify displays.
Architecture
Quick Update Workflow
When you make API changes:Adding a New API Endpoint
1. Create the API Route
Create your route file innextjs_/app/api/:
2. Define Zod Schemas
Add schemas tonextjs_/lib/openapi-schemas.ts:
3. Regenerate Documentation
Hiding Internal Endpoints
To exclude an endpoint from public documentation, use one of these methods:Method 1: Remove @openapi tag (per-endpoint)
Method 2: Add to ignoreRoutes (for entire route patterns)
Editnextjs_/next.openapi.json:
JSDoc Tags Reference
Required Tags
@description- Endpoint description@openapi- Include in OpenAPI spec (omit to hide)
Optional Tags
@tag- Group endpoints (e.g., “Alerts”, “Queries”)@auth- Authentication type:bearer,none@body- Request body schema name@response- Response format:{status}:{SchemaName}:{description}@responseSet- Error response set:common,auth,public
Example with All Tags
Authentication Headers
All authenticated endpoints should document the Authorization header:Schema Best Practices
1. Use Descriptive Field Names
2. Provide Default Examples
3. Mark Optional Fields
Response Sets Configuration
Response sets define common error responses innext.openapi.json:
@responseSet auth
Testing Documentation Changes
1. Local Preview
2. Verify Changes
Check that:- New endpoints appear correctly
- Request/response schemas are accurate
- Authentication requirements are documented
- Examples are helpful
- Internal endpoints are hidden
3. Check for Errors
Look for:- Invalid schema references
- Missing descriptions
- Broken links
- Incorrect default values
Common Issues
Issue: Endpoint doesn’t appear in docs
Solution: Check that:- JSDoc has
@openapitag - Route is not in
ignoreRoutes - Schema names match exactly
- You ran
npm run update-docs
Issue: Schema validation errors
Solution:- Ensure schema is exported from
openapi-schemas.ts - Check schema name matches JSDoc reference
- Verify Zod syntax is correct
Issue: Changes not reflected
Solution:- Clear Mintlify cache:
rm -rf gdelt-cloud-docs/.mintlify - Regenerate:
npm run update-docs - Restart dev server
Production Deployment
Mintlify Deployment
Mintlify automatically deploys from your git repository when you push changes togdelt-cloud-docs/api-reference/openapi.json.
Workflow
- Make API changes in
nextjs_/ - Run
npm run update-docs - Review changes in
gdelt-cloud-docs/ - Commit both repositories:
- Push to trigger Mintlify deployment
Troubleshooting
Clear all caches
Validate OpenAPI spec
Additional Resources
Support
For issues with:- API functionality: Check Next.js logs and API route files
- Documentation rendering: Check Mintlify docs and
docs.json - Schema generation: Check
openapi-schemas.tsand JSDoc comments - Deployment: Check git commits and Mintlify dashboard

