OpenAPI Specification¶
Polymathy provides an OpenAPI 3.0 specification for API integration.
Accessing the Specification¶
The OpenAPI specification is available at:
Using the Specification¶
Fetch with curl¶
Generate Client Code¶
Use tools like openapi-generator to create client libraries:
# Install OpenAPI Generator
npm install @openapitools/openapi-generator-cli -g
# Generate Python client
openapi-generator-cli generate \
-i http://localhost:8080/openapi.json \
-g python \
-o ./polymathy-python-client
# Generate TypeScript client
openapi-generator-cli generate \
-i http://localhost:8080/openapi.json \
-g typescript-fetch \
-o ./polymathy-ts-client
Interactive Documentation¶
Polymathy includes several interactive documentation UIs:
Swagger UI¶
Available at /swagger

Features: - Try out API calls directly in the browser - View request/response schemas - Explore all endpoints
ReDoc¶
Available at /redoc
Features: - Clean, three-panel design - Responsive layout - Markdown support in descriptions
RapiDoc¶
Available at /rapidoc
Features: - Modern, customizable interface - Dark/light themes - API console for testing
Scalar¶
Available at /scalar
Features: - Beautiful modern design - Code samples in multiple languages - Interactive request builder
Specification Example¶
{
"openapi": "3.0.0",
"info": {
"title": "Polymath API",
"description": "This is the polymath API",
"version": "0.1.0"
},
"servers": [
{
"url": "/"
}
],
"paths": {
"/v1/search": {
"get": {
"summary": "Process a query and return processed content",
"parameters": [
{
"name": "q",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}