{"openapi":"3.1.0","info":{"title":"Open Prompt Store API","version":"0.1.0","description":"HTTP API for Open Prompt Store, a registry for prompt templates, versions, aliases, API keys, organizations, and projects.","license":{"name":"MIT","url":"https://github.com/uhryvacheuski/openpromptstore/blob/main/LICENSE"}},"servers":[{"url":"https://ops.wladek.dev","description":"Hosted production service"},{"url":"http://localhost:8000","description":"Local development"}],"security":[{"bearerAuth":[]}],"paths":{"/v1/health":{"get":{"summary":"Check service health","security":[],"responses":{"200":{"description":"Service is healthy.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/v1/organizations":{"get":{"summary":"List organizations","responses":{"200":{"description":"Organizations available to the signed-in user.","content":{"application/json":{"schema":{"type":"object","required":["organizations"],"properties":{"organizations":{"type":"array","items":{"$ref":"#/components/schemas/Organization"}}}}}}}}},"post":{"summary":"Create an organization","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganizationRequest"}}}},"responses":{"201":{"description":"Organization created.","content":{"application/json":{"schema":{"type":"object","required":["organization"],"properties":{"organization":{"$ref":"#/components/schemas/Organization"}}}}}}}}},"/v1/projects":{"get":{"summary":"List projects","parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"Projects in an organization.","content":{"application/json":{"schema":{"type":"object","required":["projects"],"properties":{"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project"}}}}}}}}},"post":{"summary":"Create a project","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectRequest"}}}},"responses":{"201":{"description":"Project created.","content":{"application/json":{"schema":{"type":"object","required":["project"],"properties":{"project":{"$ref":"#/components/schemas/Project"}}}}}}}},"patch":{"summary":"Rename a project","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameProjectRequest"}}}},"responses":{"200":{"description":"Project renamed.","content":{"application/json":{"schema":{"type":"object","required":["project"],"properties":{"project":{"$ref":"#/components/schemas/Project"}}}}}}}}},"/v1/prompts":{"get":{"summary":"List prompts","parameters":[{"$ref":"#/components/parameters/OrganizationId"},{"$ref":"#/components/parameters/ProjectId"}],"responses":{"200":{"description":"Prompt summaries in a project.","content":{"application/json":{"schema":{"type":"object","required":["prompts"],"properties":{"prompts":{"type":"array","items":{"$ref":"#/components/schemas/PromptSummary"}}}}}}}}},"post":{"summary":"Create a prompt","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePromptRequest"}}}},"responses":{"201":{"description":"Prompt created.","content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"$ref":"#/components/schemas/PromptSummary"}}}}}}}}},"/v1/prompts/{name}":{"get":{"summary":"Get prompt details","parameters":[{"$ref":"#/components/parameters/PromptName"},{"$ref":"#/components/parameters/OrganizationId"},{"$ref":"#/components/parameters/ProjectId"}],"responses":{"200":{"description":"Prompt details, versions, and aliases.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromptDetailResponse"}}}}}}},"/v1/prompts/{name}/versions":{"get":{"summary":"List prompt versions","parameters":[{"$ref":"#/components/parameters/PromptName"},{"$ref":"#/components/parameters/OrganizationId"},{"$ref":"#/components/parameters/ProjectId"}],"responses":{"200":{"description":"Prompt versions.","content":{"application/json":{"schema":{"type":"object","required":["versions"],"properties":{"versions":{"type":"array","items":{"$ref":"#/components/schemas/PromptVersion"}}}}}}}}},"post":{"summary":"Push a prompt version","parameters":[{"$ref":"#/components/parameters/PromptName"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePromptVersionRequest"}}}},"responses":{"201":{"description":"Prompt version created.","content":{"application/json":{"schema":{"type":"object","required":["version"],"properties":{"version":{"$ref":"#/components/schemas/PromptVersion"}}}}}}}}},"/v1/prompts/{name}/aliases":{"get":{"summary":"List prompt aliases","parameters":[{"$ref":"#/components/parameters/PromptName"},{"$ref":"#/components/parameters/OrganizationId"},{"$ref":"#/components/parameters/ProjectId"}],"responses":{"200":{"description":"Prompt aliases.","content":{"application/json":{"schema":{"type":"object","required":["aliases"],"properties":{"aliases":{"type":"array","items":{"$ref":"#/components/schemas/PromptAlias"}}}}}}}}},"post":{"summary":"Set a prompt alias","parameters":[{"$ref":"#/components/parameters/PromptName"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPromptAliasRequest"}}}},"responses":{"200":{"description":"Prompt alias set.","content":{"application/json":{"schema":{"type":"object","required":["alias"],"properties":{"alias":{"$ref":"#/components/schemas/PromptAlias"}}}}}}}}},"/v1/prompts/{ref}/render":{"get":{"summary":"Fetch a prompt template","parameters":[{"$ref":"#/components/parameters/PromptRef"},{"$ref":"#/components/parameters/OrganizationId"},{"$ref":"#/components/parameters/ProjectId"}],"responses":{"200":{"description":"Resolved template snapshot.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateSnapshot"}}}}}},"post":{"summary":"Render a prompt template","parameters":[{"$ref":"#/components/parameters/PromptRef"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenderPromptRequest"}}}},"responses":{"200":{"description":"Rendered prompt text.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenderPromptResponse"}}}}}}},"/v1/api-keys":{"get":{"summary":"List runtime API keys","parameters":[{"$ref":"#/components/parameters/OrganizationId"}],"responses":{"200":{"description":"Runtime API keys for an organization.","content":{"application/json":{"schema":{"type":"object","required":["apiKeys"],"properties":{"apiKeys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}}}}}}}},"post":{"summary":"Create a runtime API key","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyRequest"}}}},"responses":{"201":{"description":"Runtime API key created. The token is only returned once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyResponse"}}}}}},"delete":{"summary":"Delete a runtime API key","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteApiKeyRequest"}}}},"responses":{"200":{"description":"Runtime API key deleted.","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean"}}}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Use a runtime API key with the Authorization header."}},"parameters":{"OrganizationId":{"name":"organizationId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},"ProjectId":{"name":"projectId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},"PromptName":{"name":"name","in":"path","required":true,"schema":{"type":"string"}},"PromptRef":{"name":"ref","in":"path","required":true,"schema":{"type":"string","examples":["welcome@prod","welcome@latest","welcome@1"]}}},"schemas":{"HealthResponse":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean"}}},"Organization":{"type":"object","required":["id","name","createdAt"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"Project":{"type":"object","required":["id","organizationId","name","createdAt","updatedAt"],"properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"PromptSummary":{"type":"object","required":["id","name","description","latestVersion","aliases"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string"},"updatedAt":{"type":"string","format":"date-time"},"latestVersion":{"type":["integer","null"]},"aliases":{"type":"array","items":{"$ref":"#/components/schemas/PromptAlias"}}}},"PromptVersion":{"type":"object","required":["id","promptId","version","body","variables","message","createdAt"],"properties":{"id":{"type":"string","format":"uuid"},"promptId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"body":{"type":"string"},"variables":{"type":"array","items":{"type":"string"}},"message":{"type":"string"},"createdBy":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}}},"PromptAlias":{"type":"object","required":["id","promptId","name","version","createdAt","updatedAt"],"properties":{"id":{"type":"string","format":"uuid"},"promptId":{"type":"string","format":"uuid"},"name":{"type":"string"},"version":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"TemplateSnapshot":{"type":"object","required":["prompt","ref","version","body","variables"],"properties":{"prompt":{"type":"string"},"ref":{"type":"string"},"version":{"type":"integer"},"body":{"type":"string"},"variables":{"type":"array","items":{"type":"string"}}}},"ApiKey":{"type":"object","required":["id","name","prefix","last4","createdAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"last4":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"CreateOrganizationRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":2,"maxLength":80},"projectName":{"type":"string","minLength":2,"maxLength":80}}},"CreateProjectRequest":{"type":"object","required":["organizationId","name"],"properties":{"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":2,"maxLength":80}}},"RenameProjectRequest":{"type":"object","required":["organizationId","projectId","name"],"properties":{"organizationId":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":2,"maxLength":80}}},"CreatePromptRequest":{"type":"object","required":["name"],"properties":{"organizationId":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":500}}},"PromptDetailResponse":{"type":"object","required":["prompt","versions","aliases"],"properties":{"prompt":{"$ref":"#/components/schemas/PromptSummary"},"versions":{"type":"array","items":{"$ref":"#/components/schemas/PromptVersion"}},"aliases":{"type":"array","items":{"$ref":"#/components/schemas/PromptAlias"}}}},"CreatePromptVersionRequest":{"type":"object","required":["body"],"properties":{"organizationId":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"body":{"type":"string","minLength":1},"message":{"type":"string","maxLength":240}}},"SetPromptAliasRequest":{"type":"object","required":["alias","version"],"properties":{"organizationId":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"alias":{"type":"string","pattern":"^[a-z][a-z0-9_-]{0,31}$"},"version":{"type":"integer","minimum":1}}},"RenderPromptRequest":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"variables":{"type":"object","additionalProperties":true,"default":{}}}},"RenderPromptResponse":{"type":"object","required":["prompt","ref","version","text"],"properties":{"prompt":{"type":"string"},"ref":{"type":"string"},"version":{"type":"integer"},"text":{"type":"string"}}},"CreateApiKeyRequest":{"type":"object","required":["organizationId","name"],"properties":{"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":2,"maxLength":80}}},"CreateApiKeyResponse":{"type":"object","required":["apiKey","token"],"properties":{"apiKey":{"$ref":"#/components/schemas/ApiKey"},"token":{"type":"string"}}},"DeleteApiKeyRequest":{"type":"object","required":["organizationId","id"],"properties":{"organizationId":{"type":"string","format":"uuid"},"id":{"type":"string"}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}}