{"apiVersion":"v1","spec":{"openapi":"3.1.0","info":{"title":"Context Canvas Agent API","version":"1.0.0","description":"Read-only API for external agents to list blueprints, inspect their graphs, validate Claude export readiness, read sanitized export previews, and read the audit log. Authenticate with an organization API key (Authorization: Bearer cck_...) or a signed-in session; results are limited to that organization."},"servers":[{"url":"/api/v1"}],"paths":{"/":{"get":{"summary":"API index","operationId":"getAgentApiIndex","responses":{"200":{"description":"Index metadata and endpoint links"}}}},"/openapi":{"get":{"summary":"OpenAPI document","operationId":"getOpenApi","responses":{"200":{"description":"OpenAPI 3.1 specification"}}}},"/docs":{"get":{"summary":"API docs bundle","operationId":"getAgentApiDocsBundle","responses":{"200":{"description":"Machine-readable docs bundle with endpoint details and OpenAPI spec"}}}},"/docs/markdown":{"get":{"summary":"API docs in markdown","operationId":"getAgentApiDocsMarkdown","responses":{"200":{"description":"Markdown API guide","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/templates":{"get":{"summary":"List blueprint templates","operationId":"listTemplates","responses":{"200":{"description":"Template summaries"}}}},"/blueprints":{"get":{"summary":"List blueprints in the caller's organization, newest first","operationId":"listBlueprints","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","required":false,"description":"nextCursor from the previous page","schema":{"type":"string"}}],"responses":{"200":{"description":"blueprints (id, name, nodeCount, versionCount, latestVersion, channels, links) and nextCursor"},"400":{"description":"limit is out of range"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"403":{"description":"The API key lacks the blueprints:read scope"}}}},"/blueprints/{id}":{"get":{"summary":"Get one blueprint with links to its graph, validation, versions and export preview","operationId":"getBlueprint","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The blueprint summary"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"403":{"description":"The API key lacks the blueprints:read scope"},"404":{"description":"Blueprint not found, not in the caller's organization, or id is not a UUID"}}}},"/policy":{"get":{"summary":"Get the organization policy the build gate applies","operationId":"getOrgPolicy","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"responses":{"200":{"description":"active, policy (enforcement and rules) and updatedAt"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"403":{"description":"The API key lacks the blueprints:read scope"}}}},"/audit":{"get":{"summary":"Read the organization's audit log, newest first","operationId":"listAuditEvents","security":[{"bearerApiKey":["audit:read"]},{"sessionCookie":[]}],"parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string","enum":["blueprint","node","edge","version","release","export","audit","api_key","org","member"]}},{"name":"targetId","in":"query","required":false,"schema":{"type":"string"}},{"name":"from","in":"query","required":false,"description":"Inclusive lower bound (ISO 8601)","schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","required":false,"description":"Exclusive upper bound (ISO 8601)","schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"events (id, createdAt, action, actor, target, metadata, ipAddress, userAgent) and nextCursor"},"400":{"description":"A filter is invalid"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"403":{"description":"The API key lacks the audit:read scope"}}}},"/blueprints/{id}/graph":{"get":{"summary":"Get a blueprint's sanitized graph","operationId":"getBlueprintGraph","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Blueprint graph with redacted setting values"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"404":{"description":"Blueprint not found, not in the caller's organization, or id is not a UUID"}}}},"/blueprints/{id}/validate":{"get":{"summary":"Validate graph and Claude export compliance","operationId":"validateBlueprint","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Validation result with errors and warnings"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"404":{"description":"Blueprint not found, not in the caller's organization, or id is not a UUID"}}}},"/blueprints/{id}/versions":{"get":{"summary":"List published blueprint versions, newest first","operationId":"listVersions","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Version summaries: number, contentHash, irVersion, compilerVersion, message, createdAt"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"404":{"description":"Blueprint not found, not in the caller's organization, or id is not a UUID"}}}},"/blueprints/{id}/versions/{versionId}":{"get":{"summary":"Get one immutable version with its IR and source snapshot (secrets redacted)","operationId":"getVersion","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"versionId","in":"path","required":true,"description":"The version number, the version's UUID, \"latest\", or a release channel (\"staging\", \"production\")","schema":{"type":"string"}}],"responses":{"200":{"description":"The version summary plus ir and source"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"404":{"description":"Version or blueprint not found, or not in the caller's organization"}}}},"/blueprints/{id}/export/preview":{"get":{"summary":"Get sanitized export file manifest","operationId":"getExportPreview","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"targets","in":"query","required":false,"description":"Comma-separated export targets (claude-code, agents-md). Default: claude-code.","schema":{"type":"string"}},{"name":"version","in":"query","required":false,"description":"A published version number, \"latest\", or a release channel (\"staging\", \"production\"). Default: the live draft.","schema":{"type":"string","pattern":"^([1-9][0-9]{0,8}|latest|staging|production)$"}}],"responses":{"200":{"description":"Sanitized export manifest"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"404":{"description":"Blueprint not found, not in the caller's organization, or id is not a UUID"}}}},"/packs/templates":{"get":{"summary":"List blueprint templates","operationId":"listTemplatesByPackPath","responses":{"200":{"description":"Template summaries"}},"deprecated":true,"description":"Deprecated alias of /templates: \"pack\" is the earlier name for a blueprint. Same request and response."}},"/packs/{id}/graph":{"get":{"summary":"Get a blueprint's sanitized graph","operationId":"getBlueprintGraphByPackPath","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Blueprint graph with redacted setting values"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"404":{"description":"Blueprint not found, not in the caller's organization, or id is not a UUID"}},"deprecated":true,"description":"Deprecated alias of /blueprints/{id}/graph: \"pack\" is the earlier name for a blueprint. Same request and response."}},"/packs/{id}/validate":{"get":{"summary":"Validate graph and Claude export compliance","operationId":"validateBlueprintByPackPath","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Validation result with errors and warnings"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"404":{"description":"Blueprint not found, not in the caller's organization, or id is not a UUID"}},"deprecated":true,"description":"Deprecated alias of /blueprints/{id}/validate: \"pack\" is the earlier name for a blueprint. Same request and response."}},"/packs/{id}/versions":{"get":{"summary":"List published blueprint versions, newest first","operationId":"listVersionsByPackPath","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Version summaries: number, contentHash, irVersion, compilerVersion, message, createdAt"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"404":{"description":"Blueprint not found, not in the caller's organization, or id is not a UUID"}},"deprecated":true,"description":"Deprecated alias of /blueprints/{id}/versions: \"pack\" is the earlier name for a blueprint. Same request and response."}},"/packs/{id}/versions/{versionId}":{"get":{"summary":"Get one immutable version with its IR and source snapshot (secrets redacted)","operationId":"getVersionByPackPath","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"versionId","in":"path","required":true,"description":"The version number, the version's UUID, \"latest\", or a release channel (\"staging\", \"production\")","schema":{"type":"string"}}],"responses":{"200":{"description":"The version summary plus ir and source"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"404":{"description":"Version or blueprint not found, or not in the caller's organization"}},"deprecated":true,"description":"Deprecated alias of /blueprints/{id}/versions/{versionId}: \"pack\" is the earlier name for a blueprint. Same request and response."}},"/packs/{id}/export/preview":{"get":{"summary":"Get sanitized export file manifest","operationId":"getExportPreviewByPackPath","security":[{"bearerApiKey":["blueprints:read"]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"targets","in":"query","required":false,"description":"Comma-separated export targets (claude-code, agents-md). Default: claude-code.","schema":{"type":"string"}},{"name":"version","in":"query","required":false,"description":"A published version number, \"latest\", or a release channel (\"staging\", \"production\"). Default: the live draft.","schema":{"type":"string","pattern":"^([1-9][0-9]{0,8}|latest|staging|production)$"}}],"responses":{"200":{"description":"Sanitized export manifest"},"401":{"description":"No API key or session, or the key is invalid, revoked or expired"},"404":{"description":"Blueprint not found, not in the caller's organization, or id is not a UUID"}},"deprecated":true,"description":"Deprecated alias of /blueprints/{id}/export/preview: \"pack\" is the earlier name for a blueprint. Same request and response."}}},"components":{"securitySchemes":{"bearerApiKey":{"type":"http","scheme":"bearer","description":"Organization API key (cck_...), created under Settings > API keys. Scopes: blueprints:read, audit:read. Keys are read-only."},"sessionCookie":{"type":"apiKey","in":"cookie","name":"__Secure-authjs.session-token","description":"Context Canvas sign-in session cookie (Auth.js). Local development uses authjs.session-token."}}}}}