A quick reference for understanding and maintaining the Dialgen OpenAPI specification.
- File Structure
- OpenAPI Specification Sections
- Common Tasks
- Schema Patterns
- Response Codes
- Validation
dialgen-docs/
βββ openapi.json # Main OpenAPI 3.0 specification
βββ docs.json # Mintlify configuration (references openapi.json)
βββ api-reference/
βββ introduction.mdx # API introduction page
{
"openapi": "3.0.3",
"info": {
"title": "Dialgen API",
"description": "API description",
"version": "1.0.0",
"contact": {
"name": "Dialgen Support",
"url": "https://sa.dialgen.ai"
}
}
}{
"servers": [
{
"url": "https://sa.dialgen.ai",
"description": "Production server"
}
]
}{
"security": [
{
"bearerAuth": []
}
],
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT",
"description": "Bearer token authentication"
}
}
}
}Defines all API endpoints:
{
"paths": {
"/api/v1/endpoint": {
"get": {
"summary": "Endpoint summary",
"description": "Detailed description",
"operationId": "uniqueOperationId",
"tags": ["Category"],
"parameters": [...],
"responses": {...}
}
}
}
}Reusable schemas, responses, and parameters:
{
"components": {
"schemas": {
"SchemaName": {...}
},
"responses": {
"ResponseName": {...}
},
"parameters": {
"ParameterName": {...}
}
}
}- Add to paths section:
{
"paths": {
"/api/v1/new-endpoint": {
"post": {
"summary": "New Endpoint",
"description": "Description here",
"operationId": "newEndpoint",
"tags": ["Category"],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewRequest"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewResponse"
}
}
}
}
}
}
}
}
}- Add schemas:
{
"components": {
"schemas": {
"NewRequest": {
"type": "object",
"required": ["field1"],
"properties": {
"field1": {
"type": "string",
"description": "Field description"
}
}
},
"NewResponse": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
}
}
}
}
}
}- Update docs.json navigation:
{
"navigation": {
"tabs": [
{
"tab": "API Reference",
"groups": [
{
"group": "Category",
"pages": [
"POST /api/v1/new-endpoint"
]
}
]
}
]
}
}{
"parameters": [
{
"name": "paramName",
"in": "query",
"description": "Parameter description",
"required": true,
"schema": {
"type": "string",
"example": "example-value"
}
}
]
}{
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RequestSchema"
},
"example": {
"field": "value"
}
}
}
}
}{
"responses": {
"200": {
"description": "Success description",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ResponseSchema"
},
"example": {
"success": true,
"data": {}
}
}
}
}
}
}{
"SchemaName": {
"type": "object",
"required": ["field1", "field2"],
"properties": {
"field1": {
"type": "string",
"description": "Field description"
},
"field2": {
"type": "number",
"minimum": 0,
"maximum": 100
}
}
}
}{
"ArraySchema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ItemSchema"
},
"minItems": 1,
"maxItems": 100
}
}{
"StatusSchema": {
"type": "string",
"enum": ["PENDING", "PROCESSING", "COMPLETED", "FAILED"],
"description": "Status of the operation"
}
}{
"ParentSchema": {
"type": "object",
"properties": {
"childObject": {
"type": "object",
"properties": {
"nestedField": {
"type": "string"
}
}
}
}
}
}{
"ComplexSchema": {
"type": "object",
"properties": {
"simpleField": {
"type": "string"
},
"referencedField": {
"$ref": "#/components/schemas/OtherSchema"
}
}
}
}{
"NullableSchema": {
"type": "object",
"properties": {
"optionalField": {
"type": "string",
"nullable": true,
"description": "Can be null"
}
}
}
}{
"FlexibleSchema": {
"type": "object",
"properties": {
"knownField": {
"type": "string"
}
},
"additionalProperties": true
}
}| Code | Name | Usage |
|---|---|---|
| 200 | OK | Successful GET request |
| 202 | Accepted | Async operation accepted (batches) |
| 400 | Bad Request | Invalid parameters or body |
| 401 | Unauthorized | Missing/invalid API key |
| 402 | Payment Required | Insufficient credits |
| 403 | Forbidden | Access denied |
| 404 | Not Found | Resource not found |
| 409 | Conflict | Resource conflict (duplicate call) |
| 500 | Internal Server Error | Server error |
{
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {...}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
}
}
}- Visit https://editor.swagger.io/
- Copy
openapi.jsoncontents - Paste into editor
- Check for errors in right panel
# Install Mintlify CLI
npm i -g mintlify
# Validate OpenAPI spec
mintlify openapi-check openapi.jsonMissing operationId
// β Wrong
{
"get": {
"summary": "Get Data"
}
}
// β
Correct
{
"get": {
"summary": "Get Data",
"operationId": "getData"
}
}Invalid $ref
// β Wrong
{
"$ref": "#/components/schemas/NonExistentSchema"
}
// β
Correct
{
"$ref": "#/components/schemas/ExistingSchema"
}Missing required fields
// β Wrong
{
"type": "object",
"required": ["field1"],
"properties": {
"field2": {
"type": "string"
}
}
}
// β
Correct
{
"type": "object",
"required": ["field1"],
"properties": {
"field1": {
"type": "string"
}
}
}Search for "tags": ["TagName"] in the paths section.
Look in components.schemas section.
Look in components.responses section.
Look in components.securitySchemes section.
- operationId: camelCase (e.g.,
getAgent,createBatch) - Schema names: PascalCase (e.g.,
Agent,CallStatus) - Properties: camelCase (e.g.,
agentId,phoneNumber)
- Always include descriptions for schemas and properties
- Use clear, concise language
- Include examples where helpful
- Provide realistic examples
- Include all required fields
- Show common use cases
- Use
$reffor repeated schemas - Create reusable response templates
- Define common parameters once
- Include version in info section
- Document breaking changes
- Maintain backward compatibility when possible
cd dialgen-docs
mintlify devmintlify openapi-check openapi.json# Using jq (if installed)
jq . openapi.json > openapi.formatted.json# Using grep (Git Bash or WSL)
grep -A 5 "/api/v1/agent" openapi.json-
Understand OpenAPI basics
- Read OpenAPI specification
- Explore example APIs
-
Study the Dialgen spec
- Review
openapi.json - Understand schema structure
- Review
-
Make small changes
- Update descriptions
- Add examples
-
Add new endpoints
- Follow existing patterns
- Validate changes
-
Advanced features
- Complex schemas
- Custom responses
- Webhooks
- Always validate after making changes
- Use consistent formatting (2-space indentation)
- Keep examples up to date
- Document all required fields
- Use meaningful operationIds
- Group related endpoints with tags
- Reuse schemas when possible
- Include error responses for all endpoints
- Check OpenAPI spec is referenced in
docs.json - Verify endpoint path in navigation matches OpenAPI
- Validate OpenAPI spec for errors
- Clear browser cache and restart dev server
- Check for syntax errors in schema definition
- Verify all
$refpaths are correct - Ensure required fields exist in properties
- Validate with Swagger Editor
- Add example to schema or response
- Check JSON syntax is valid
- Ensure example matches schema structure
- Total Endpoints: 11
- GET Endpoints: 6
- POST Endpoints: 5
- Schemas: 20+
- Tags: 3 (Agents, Calls, Batches)
- Response Codes: 8 (200, 202, 400, 401, 402, 403, 404, 409, 500)
This quick reference provides:
- β Common OpenAPI patterns
- β Schema examples
- β Validation methods
- β Best practices
- β Troubleshooting tips
- β Quick commands
Use this guide as a reference when working with the Dialgen OpenAPI specification.