Add rate limit headers to OpenAPI generation script
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Failing after 2m11s

- Update generate-openapi.mjs to include header components
- Ensure public/openapi.json has rate limit headers
- Update rate limits description in generation script
This commit is contained in:
OpenClaw Subagent 2026-03-18 11:08:05 +01:00
parent 70eb6908e3
commit f0cb83a901
2 changed files with 63 additions and 1 deletions

View file

@ -3,7 +3,7 @@
"info": {
"title": "DocFast API",
"version": "1.0.0",
"description": "Convert HTML, Markdown, and URLs to pixel-perfect PDFs. Built-in invoice & receipt templates.\n\n## Authentication\nAll conversion and template endpoints require an API key via `Authorization: Bearer <key>` or `X-API-Key: <key>` header.\n\n## Demo Endpoints\nTry the API without signing up! Demo endpoints are public (no API key needed) but rate-limited to 5 requests/hour per IP and produce watermarked PDFs.\n\n## Rate Limits\n- Demo: 5 PDFs/hour per IP (watermarked)\n- Pro tier: 5,000 PDFs/month, 30 req/min\n\n## Getting Started\n1. Try the demo at `POST /v1/demo/html` — no signup needed\n2. Subscribe to Pro at [docfast.dev](https://docfast.dev/#pricing) for clean PDFs\n3. Use your API key to convert documents",
"description": "Convert HTML, Markdown, and URLs to pixel-perfect PDFs. Built-in invoice & receipt templates.\n\n## Authentication\nAll conversion and template endpoints require an API key via `Authorization: Bearer <key>` or `X-API-Key: <key>` header.\n\n## Demo Endpoints\nTry the API without signing up! Demo endpoints are public (no API key needed) but rate-limited to 5 requests/hour per IP and produce watermarked PDFs.\n\n## Rate Limits\n- Demo: 5 PDFs/hour per IP (watermarked)\n- Pro tier: 5,000 PDFs/month, 30 req/min\n\nAll rate-limited endpoints return `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` headers. On `429`, a `Retry-After` header indicates seconds until the next allowed request.\n\n## Getting Started\n1. Try the demo at `POST /v1/demo/html` — no signup needed\n2. Subscribe to Pro at [docfast.dev](https://docfast.dev/#pricing) for clean PDFs\n3. Use your API key to convert documents",
"contact": {
"name": "DocFast",
"url": "https://docfast.dev",
@ -56,6 +56,36 @@
"description": "API key via X-API-Key header"
}
},
"headers": {
"X-RateLimit-Limit": {
"description": "The maximum number of requests allowed in the current time window",
"schema": {
"type": "integer",
"example": 30
}
},
"X-RateLimit-Remaining": {
"description": "The number of requests remaining in the current time window",
"schema": {
"type": "integer",
"example": 29
}
},
"X-RateLimit-Reset": {
"description": "Unix timestamp (seconds since epoch) when the rate limit window resets",
"schema": {
"type": "integer",
"example": 1679875200
}
},
"Retry-After": {
"description": "Number of seconds to wait before retrying the request (returned on 429 responses)",
"schema": {
"type": "integer",
"example": 60
}
}
},
"schemas": {
"PdfOptions": {
"type": "object",