openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: Pluvus Strategy Document Generator API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: documents description: Strategy document generation and management paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /documents: get: operationId: listDocuments tags: [documents] summary: List all documents description: Returns all saved strategy documents responses: "200": description: List of documents content: application/json: schema: type: array items: $ref: "#/components/schemas/DocumentSummary" /documents/generate: post: operationId: generateDocument tags: [documents] summary: Generate a strategy document from a brand URL description: Fetches brand info, assembles prompt, calls Claude, parses output into structured doc requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GenerateDocumentBody" responses: "201": description: Document generated successfully content: application/json: schema: $ref: "#/components/schemas/Document" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "429": description: Rate limit exceeded content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "500": description: Generation failed content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /documents/{id}: get: operationId: getDocument tags: [documents] summary: Get a document by ID parameters: - in: path name: id required: true schema: type: string responses: "200": description: Document found content: application/json: schema: $ref: "#/components/schemas/Document" "404": description: Document not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /documents/{id}/sections/{sectionKey}/revise: post: operationId: reviseSection tags: [documents] summary: Revise a specific section of a document parameters: - in: path name: id required: true schema: type: string - in: path name: sectionKey required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ReviseSectionBody" responses: "200": description: Section revised content: application/json: schema: $ref: "#/components/schemas/SectionRevisionResult" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Document or section not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "429": description: Rate limit exceeded content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /documents/{id}/questions: post: operationId: askQuestion tags: [documents] summary: Ask a contextual question about the document parameters: - in: path name: id required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AskQuestionBody" responses: "200": description: Answer provided content: application/json: schema: $ref: "#/components/schemas/QuestionAnswerResult" "400": description: Invalid input content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "404": description: Document not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "429": description: Rate limit exceeded content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /documents/{id}/apply-revision/{revisionId}: post: operationId: applyRevision tags: [documents] summary: Apply a pending section revision to the document parameters: - in: path name: id required: true schema: type: string - in: path name: revisionId required: true schema: type: string responses: "200": description: Revision applied content: application/json: schema: $ref: "#/components/schemas/Document" "404": description: Document or revision not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /documents/{id}/export.pdf: get: operationId: exportDocumentPdf tags: [documents] summary: Export document as PDF description: Returns the strategy document as a PDF file for download parameters: - in: path name: id required: true schema: type: string responses: "200": description: PDF file content: application/pdf: schema: type: string format: binary "404": description: Document not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "429": description: Rate limit exceeded content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" components: schemas: HealthStatus: type: object properties: status: type: string required: - status ErrorResponse: type: object properties: error: type: string required: - error GenerateDocumentBody: type: object properties: url: type: string description: The brand URL to research and generate a strategy for geoTargeting: type: ["string", "null"] description: Optional geographic targeting context creatorTypesToAvoid: type: ["string", "null"] description: Optional creator types to exclude from strategy notes: type: ["string", "null"] description: Optional freeform notes for the generation required: - url ContentBlock: type: object properties: type: type: string enum: [paragraph, table, heading] text: type: ["string", "null"] rows: type: ["array", "null"] items: type: array items: type: string headers: type: ["array", "null"] items: type: string required: - type DocumentSection: type: object properties: sectionKey: type: string title: type: string contentBlocks: type: array items: $ref: "#/components/schemas/ContentBlock" sortOrder: type: integer updatedAt: type: string format: date-time required: - sectionKey - title - contentBlocks - sortOrder - updatedAt Document: type: object properties: id: type: string url: type: string brandName: type: string status: type: string enum: [generating, draft, edited, error] title: type: string sections: type: array items: $ref: "#/components/schemas/DocumentSection" createdAt: type: string format: date-time updatedAt: type: string format: date-time geoTargeting: type: ["string", "null"] creatorTypesToAvoid: type: ["string", "null"] notes: type: ["string", "null"] required: - id - url - brandName - status - title - sections - createdAt - updatedAt DocumentSummary: type: object properties: id: type: string url: type: string brandName: type: string status: type: string enum: [generating, draft, edited, error] title: type: string createdAt: type: string format: date-time updatedAt: type: string format: date-time required: - id - url - brandName - status - title - createdAt - updatedAt ReviseSectionBody: type: object properties: instruction: type: string description: The revision instruction for this section required: - instruction SectionRevisionResult: type: object properties: revisionId: type: string sectionKey: type: string proposedSection: $ref: "#/components/schemas/DocumentSection" applied: type: boolean required: - revisionId - sectionKey - proposedSection - applied AskQuestionBody: type: object properties: question: type: string description: The question to ask about the document sectionKey: type: ["string", "null"] description: Optional section key to scope the question to required: - question QuestionAnswerResult: type: object properties: answer: type: string sectionKey: type: ["string", "null"] suggestRevision: type: boolean required: - answer - suggestRevision