{"openapi":"3.1.0","info":{"title":"Ahmad Ghozali — Portfolio API","version":"0.1.0","description":"Small read-only and sandbox endpoints used by the on-site API playground. Requests are rate limited per client IP using a sliding-window counter."},"servers":[{"url":"https://ahmadghozali.my.id"}],"tags":[{"name":"Health","description":"Liveness and dependency status"},{"name":"Content","description":"Public project metadata"},{"name":"Sandbox","description":"Safe request/response demonstration"}],"paths":{"/api/health":{"get":{"tags":["Health"],"summary":"Liveness probe","description":"Returns quickly when the Node process is able to serve requests.","responses":{"200":{"description":"Process is alive","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/api/v1/status":{"get":{"tags":["Health"],"summary":"Service status","description":"Checks the application and any targets configured through the STATUS_TARGETS environment variable. Results are cached briefly and deduplicated in-flight.","responses":{"200":{"description":"Current status snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/projects":{"get":{"tags":["Content"],"summary":"List public projects","parameters":[{"name":"tag","in":"query","required":false,"schema":{"type":"string","maxLength":32},"description":"Case-insensitive stack tag filter"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":12,"default":12}}],"responses":{"200":{"description":"Project metadata","headers":{"x-ratelimit-remaining":{"schema":{"type":"integer"},"description":"Requests left in the current window"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/echo":{"post":{"tags":["Sandbox"],"summary":"Echo a validated JSON payload","description":"Accepts a small JSON object and returns it with request metadata. Demonstrates validation, size limits, full-origin checks, and sliding-window rate limiting.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EchoRequest"},"example":{"message":"Hello from the playground","count":3}}}},"responses":{"200":{"description":"Validated payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EchoResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/openapi.json":{"get":{"tags":["Health"],"summary":"This document","responses":{"200":{"description":"OpenAPI 3.1 document","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"components":{"schemas":{"Health":{"type":"object","required":["status","uptimeSeconds","version","timestamp"],"properties":{"status":{"type":"string","const":"ok"},"uptimeSeconds":{"type":"integer","minimum":0},"version":{"type":"string"},"timestamp":{"type":"string","format":"date-time"}}},"Project":{"type":"object","required":["slug","title","summary","role","timeframe","stack"],"properties":{"slug":{"type":"string"},"title":{"type":"string"},"summary":{"type":"string"},"role":{"type":"string"},"timeframe":{"type":"string"},"stack":{"type":"array","items":{"type":"string"}},"repoUrl":{"type":"string","format":"uri"},"liveUrl":{"type":"string","format":"uri"}}},"ProjectList":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Project"}},"meta":{"type":"object","required":["count","total"],"properties":{"count":{"type":"integer"},"total":{"type":"integer"}}}}},"TargetStatus":{"type":"object","required":["name","status"],"properties":{"name":{"type":"string"},"host":{"type":"string"},"status":{"type":"string","enum":["up","degraded","down"]},"statusCode":{"type":"integer"},"latencyMs":{"type":"integer"}}},"Status":{"type":"object","required":["status","checkedAt","uptimeSeconds","cached","targets"],"properties":{"status":{"type":"string","enum":["operational","degraded","down"]},"checkedAt":{"type":"string","format":"date-time"},"uptimeSeconds":{"type":"integer"},"cached":{"type":"boolean"},"targets":{"type":"array","items":{"$ref":"#/components/schemas/TargetStatus"}}}},"EchoRequest":{"type":"object","additionalProperties":false,"required":["message"],"properties":{"message":{"type":"string","minLength":1,"maxLength":500},"count":{"type":"integer","minimum":1,"maximum":100,"default":1}}},"EchoResponse":{"type":"object","required":["received","requestId","timestamp"],"properties":{"received":{"$ref":"#/components/schemas/EchoRequest"},"requestId":{"type":"string"},"timestamp":{"type":"string","format":"date-time"}}},"Error":{"type":"object","required":["error","requestId"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object"}}}},"requestId":{"type":"string"}}}},"responses":{"BadRequest":{"description":"Malformed request or query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"Cross-origin or invalid Origin header rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"PayloadTooLarge":{"description":"Body exceeds the 8 KB limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"UnsupportedMediaType":{"description":"Content-Type is not JSON","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ValidationFailed":{"description":"Schema validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"Per-IP rate limit exceeded","headers":{"retry-after":{"schema":{"type":"integer"},"description":"Seconds until the window resets"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}