{"openapi":"3.1.0","info":{"title":"CodeSec API","version":"1.4.0","description":"Security scanning APIs for developers. Integrate CodeSec into CI/CD pipelines, applications, and security workflows.","contact":{"name":"CodeSec Support","email":"developers@codesec.me"},"license":{"name":"Proprietary"}},"servers":[{"url":"https://api.codesec.me","description":"Production"}],"tags":[{"name":"Scans"},{"name":"Account"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Pass your API key as a bearer token: `Authorization: Bearer YOUR_API_KEY`."}}},"security":[{"bearerAuth":[]}],"paths":{"/v1/scans":{"post":{"operationId":"create-scan","summary":"Create a scan","description":"Queues a new security scan for the given target. Returns immediately with a scan id you can poll for status and results.","tags":["Scans"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"example":{"target":"https://example.com","scan_type":"full"}}}},"responses":{"201":{"description":"Scan queued","content":{"application/json":{"example":{"scan_id":"scan_123","status":"queued"}}}},"400":{"description":"Invalid target URL","content":{"application/json":{"example":{"error":"invalid_target","message":"`target` must be a valid URL"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"example":{"error":"unauthorized","message":"Invalid API key"}}}}}},"get":{"operationId":"list-scans","summary":"List scans","description":"Lists scans for the authenticated account, newest first.","tags":["Scans"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","required":false,"description":"Maximum number of scans to return (1–100).","schema":{"type":"integer","default":"20"}},{"name":"status","in":"query","required":false,"description":"Filter by scan status.","schema":{"type":"string","enum":["queued","running","completed","failed"]}}],"responses":{"200":{"description":"A page of scans","content":{"application/json":{"example":{"data":[{"scan_id":"scan_123","status":"completed"}],"has_more":false}}}}}}},"/v1/scans/{scan_id}":{"get":{"operationId":"get-scan","summary":"Get scan status","description":"Retrieves the current status and metadata for a scan.","tags":["Scans"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"scan_id","in":"path","required":true,"description":"The id returned when the scan was created.","schema":{"type":"string"}}],"responses":{"200":{"description":"Scan found","content":{"application/json":{"example":{"scan_id":"scan_123","status":"running","target":"https://example.com","progress":42,"created_at":"2026-06-03T10:00:00Z"}}}},"404":{"description":"Scan not found","content":{"application/json":{"example":{"error":"not_found","message":"No scan with that id"}}}}}}},"/v1/scans/{scan_id}/results":{"get":{"operationId":"get-scan-results","summary":"Get scan results","description":"Returns the findings discovered by a scan. Available incrementally while the scan runs and in full once it completes.","tags":["Scans"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"scan_id","in":"path","required":true,"description":"The scan id.","schema":{"type":"string"}},{"name":"severity","in":"query","required":false,"description":"Filter findings by minimum severity.","schema":{"type":"string","enum":["info","low","medium","high","critical"]}}],"responses":{"200":{"description":"Results","content":{"application/json":{"example":{"scan_id":"scan_123","status":"completed","score":87,"findings":[{"id":"fnd_1","title":"Missing Content-Security-Policy header","severity":"medium","confidence":"high","category":"headers"}]}}}}}}},"/v1/usage":{"get":{"operationId":"get-usage","summary":"Get usage","description":"Returns the current billing period's usage and remaining quota for the authenticated account.","tags":["Account"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Usage snapshot","content":{"application/json":{"example":{"plan":"pro","scans_used":128,"scans_limit":500,"period_start":"2026-06-01T00:00:00Z","period_end":"2026-07-01T00:00:00Z"}}}}}}}}}