{"openapi":"3.1.0","info":{"title":"Draftlane Control API","version":"1.1.0","description":"Versioned API for agent-driven and white-label control of projects, generations, and generated files in Draftlane. The /api/v1 surface is protected by a fixed-window rate limit and returns HTTP 429 when callers exceed the configured request budget."},"servers":[{"url":"https://autosite.dynamicendpoints.com/api/v1"}],"components":{"securitySchemes":{"bearerSessionAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token from a signed-in Clerk session."},"agentKeyAuth":{"type":"apiKey","in":"header","name":"X-Draftlane-Agent-Key","description":"Server-to-server key for agent and white-label automation."}},"parameters":{"projectId":{"name":"projectId","in":"path","required":true,"schema":{"type":"string"}},"filesFormat":{"name":"format","in":"query","required":false,"schema":{"type":"string","enum":["json","zip"],"default":"json"},"description":"Return the default JSON response or a downloadable ZIP archive. Takes precedence over the Accept header."},"filesAccept":{"name":"Accept","in":"header","required":false,"schema":{"type":"string","enum":["application/json","application/zip"]},"description":"Request application/zip to download the generated project bundle when the format query parameter is omitted."},"whiteLabelBrand":{"name":"X-Draftlane-Brand","in":"header","required":false,"schema":{"type":"string"}},"whiteLabelExternalUserId":{"name":"X-Draftlane-External-User-Id","in":"header","required":false,"schema":{"type":"string"}}}},"paths":{"/":{"get":{"summary":"API overview","responses":{"200":{"description":"Overview returned"}}}},"/workspace":{"get":{"summary":"Get current actor and workspace access","security":[{"bearerSessionAuth":[]},{"agentKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/whiteLabelBrand"},{"$ref":"#/components/parameters/whiteLabelExternalUserId"}],"responses":{"200":{"description":"Workspace returned"}}}},"/health":{"get":{"summary":"Health check for the Draftlane control API","responses":{"200":{"description":"API health returned"}}}},"/projects":{"get":{"summary":"List projects for the current actor","security":[{"bearerSessionAuth":[]},{"agentKeyAuth":[]}],"responses":{"200":{"description":"Projects returned"}}},"post":{"summary":"Create a project","security":[{"bearerSessionAuth":[]},{"agentKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"description":{"type":"string"},"name":{"type":"string"},"sourceUrl":{"type":"string","format":"uri"}}}}}},"responses":{"201":{"description":"Project created"}}}},"/projects/{projectId}":{"get":{"summary":"Get project detail and latest generation","security":[{"bearerSessionAuth":[]},{"agentKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"Project returned"}}}},"/projects/{projectId}/files":{"get":{"summary":"List generated files for a project","security":[{"bearerSessionAuth":[]},{"agentKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"$ref":"#/components/parameters/filesFormat"},{"$ref":"#/components/parameters/filesAccept"}],"responses":{"200":{"description":"Files returned as JSON or a ZIP archive.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"files":{"type":"array","items":{"type":"object"}},"project":{"type":"object"}}},"meta":{"type":"object"}}}},"application/zip":{"schema":{"type":"string","format":"binary"}}}},"422":{"description":"Unsupported files response format"}}}},"/projects/{projectId}/generations":{"get":{"summary":"List all generations for a project, ordered newest first, including revision and readiness metadata","security":[{"bearerSessionAuth":[]},{"agentKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"List of generation records returned, each may include planJson, revisionJson, and readinessJson fields."}}}},"/projects/{projectId}/generation":{"get":{"summary":"Get the latest generation for a project, including revision and readiness metadata when available","security":[{"bearerSessionAuth":[]},{"agentKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"Generation returned. Completed generations may include planJson, revisionJson, and readinessJson fields."}}},"post":{"summary":"Run generation for a project through the local multi-turn agent loop and persist generated files, revision metadata, and readiness checks. Auto-publish and downstream Vercel deployments are gated by build readiness: blocked runs skip publish, review runs proceed with a warning.","security":[{"bearerSessionAuth":[]},{"agentKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string"},"sourceUrl":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"Generation completed"}}}},"/workspace/billing-events":{"get":{"summary":"List recent billing events for the authenticated workspace","security":[{"bearerSessionAuth":[]}],"responses":{"200":{"description":"List of billing events returned, including payment and subscription events."}}}},"/workspace/subscription":{"get":{"summary":"Get subscription summary for the authenticated workspace","security":[{"bearerSessionAuth":[]}],"responses":{"200":{"description":"Subscription summary returned, including plan, status, and billing period."}}}},"/projects/{projectId}/generation/{generationId}/agent-session":{"get":{"summary":"Get the latest persisted turn snapshot for a generation's local multi-turn agent loop","security":[{"bearerSessionAuth":[]},{"agentKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"generationId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Agent session returned with current turn, max turns, and status."}}}}}}