{"openapi":"3.1.0","info":{"title":"Arise.tw API","version":"1.0.0","description":"Arise 銳緒創意設計工作室的認證、產品、訂閱、授權與諮詢 API。","contact":{"url":"https://arise.tw/contact/"}},"servers":[{"url":"https://arise.tw","description":"Arise.tw production API"}],"externalDocs":{"description":"Arise.tw developer resources","url":"https://arise.tw/developers/"},"tags":[{"name":"Auth","description":"Session authentication and current-user operations."},{"name":"Admin","description":"Protected site administration operations."},{"name":"Products","description":"Public product catalog operations."},{"name":"Subscriptions","description":"Authenticated subscription operations."},{"name":"Licenses","description":"License generation and validation operations."},{"name":"Leads","description":"Contact and AI diagnosis inquiry submissions."}],"paths":{"/api/admin/design-theme":{"get":{"tags":["Admin"],"summary":"Get the active site design theme","operationId":"getDesignTheme","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"Available design themes and the active theme.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DesignThemeResponse"}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The current user is not an administrator.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Admin"],"summary":"Set the active site design theme","operationId":"setDesignTheme","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DesignThemeRequest"}}}},"responses":{"200":{"description":"The site design theme was updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DesignThemeResponse"}}}},"400":{"description":"The requested theme is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The current user is not an administrator or the request is cross-origin.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server processing or database migration error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/admin/blog":{"get":{"tags":["Admin"],"summary":"List managed Brain-log posts","operationId":"listBlogPosts","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"D1-backed blog posts.","content":{"application/json":{"schema":{"type":"object","required":["available","posts"],"properties":{"available":{"type":"boolean"},"posts":{"type":"array","items":{"$ref":"#/components/schemas/BlogPost"}}}}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The current user is not an administrator.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"tags":["Admin"],"summary":"Create a managed Brain-log post","operationId":"createBlogPost","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPostRequest"}}}},"responses":{"201":{"description":"The blog post was created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"The blog post payload is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The current user is not an administrator or the request is cross-origin.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The slug already exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/admin/blog/{id}":{"get":{"tags":["Admin"],"summary":"Get a managed Brain-log post","operationId":"getBlogPost","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Managed blog post.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPostResponse"}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The current user is not an administrator.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Post not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"put":{"tags":["Admin"],"summary":"Update a managed Brain-log post","operationId":"updateBlogPost","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPostRequest"}}}},"responses":{"200":{"description":"The blog post was updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"The blog post payload is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The current user is not an administrator or the request is cross-origin.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The slug already exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["Admin"],"summary":"Delete a managed Brain-log post","operationId":"deleteBlogPost","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The blog post was deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The current user is not an administrator or the request is cross-origin.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/auth/login":{"post":{"tags":["Auth"],"summary":"Create a session","operationId":"loginUser","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}}},"responses":{"200":{"description":"Authenticated user and session token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"400":{"description":"Missing credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Credentials are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server configuration or processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/auth/logout":{"post":{"tags":["Auth"],"summary":"Clear the current session","operationId":"logoutUser","responses":{"200":{"description":"Session cleared.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/api/auth/me":{"get":{"tags":["Auth"],"summary":"Get the current user","operationId":"getCurrentUser","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"Current authenticated user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurrentUserResponse"}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"The session user no longer exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/products/list":{"get":{"tags":["Products"],"summary":"List available products","operationId":"listProducts","responses":{"200":{"description":"Available products.","content":{"application/json":{"schema":{"type":"object","required":["products"],"properties":{"products":{"type":"array","items":{"$ref":"#/components/schemas/Product"}}}}}}},"500":{"description":"Server processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/contact/submit":{"post":{"tags":["Leads"],"summary":"Submit a contact inquiry","operationId":"submitContactInquiry","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactRequest"}}}},"responses":{"201":{"description":"Inquiry accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Required fields or verification are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Turnstile verification failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server configuration or processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/ai-diagnosis/submit":{"post":{"tags":["Leads"],"summary":"Submit an AI diagnosis inquiry","operationId":"submitAiDiagnosisInquiry","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiDiagnosisRequest"}}}},"responses":{"201":{"description":"Diagnosis inquiry accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Required fields or verification are invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Turnstile verification failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server configuration or processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/subscriptions/list":{"get":{"tags":["Subscriptions"],"summary":"List the current user subscriptions","operationId":"listSubscriptions","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"User subscriptions.","content":{"application/json":{"schema":{"type":"object","required":["subscriptions"],"properties":{"subscriptions":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}}}}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/subscriptions/create":{"post":{"tags":["Subscriptions"],"summary":"Create a subscription","operationId":"createSubscription","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductIdRequest"}}}},"responses":{"201":{"description":"Subscription and license created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSubscriptionResponse"}}}},"400":{"description":"Product ID is missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Product was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/subscriptions/cancel":{"post":{"tags":["Subscriptions"],"summary":"Cancel a subscription","operationId":"cancelSubscription","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionIdRequest"}}}},"responses":{"200":{"description":"Subscription cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Subscription ID is missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Subscription belongs to another user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Subscription was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/license/list":{"get":{"tags":["Licenses"],"summary":"List the current user licenses","operationId":"listLicenses","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"User license keys.","content":{"application/json":{"schema":{"type":"object","required":["license_keys"],"properties":{"license_keys":{"type":"array","items":{"$ref":"#/components/schemas/License"}}}}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/license/generate":{"post":{"tags":["Licenses"],"summary":"Generate a license for a subscription","operationId":"generateLicense","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionIdRequest"}}}},"responses":{"201":{"description":"License generated.","content":{"application/json":{"schema":{"type":"object","required":["success","license_key"],"properties":{"success":{"const":true},"license_key":{"$ref":"#/components/schemas/License"}}}}}},"400":{"description":"Subscription ID is missing or inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"No valid session was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Subscription belongs to another user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Subscription was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/license/validate":{"post":{"tags":["Licenses"],"summary":"Validate a license key","operationId":"validateLicense","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseValidationRequest"}}}},"responses":{"200":{"description":"Validation result. Invalid licenses are represented by valid=false.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseValidationResponse"}}}},"400":{"description":"License key is missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Server processing error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}},"components":{"securitySchemes":{"cookieAuth":{"type":"apiKey","in":"cookie","name":"arise_session","description":"Session cookie set by the login endpoint."}},"schemas":{"ApiError":{"type":"object","required":["error","code","message","hint"],"properties":{"error":{"type":"string","description":"Backward-compatible short error message."},"code":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"hint":{"type":"string","description":"Actionable resolution guidance."}}},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","const":true},"message":{"type":"string"}},"required":["success"]},"LoginRequest":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":1}}},"AuthResponse":{"type":"object","required":["success","user","token"],"properties":{"success":{"type":"boolean","const":true},"user":{"$ref":"#/components/schemas/User"},"token":{"type":"string"}}},"CurrentUserResponse":{"type":"object","required":["user"],"properties":{"user":{"$ref":"#/components/schemas/User"}}},"DesignThemeRequest":{"type":"object","required":["theme"],"properties":{"theme":{"type":"string","enum":["studio","legacy"]}}},"DesignThemeResponse":{"type":"object","required":["theme","themes"],"properties":{"theme":{"type":"string","enum":["studio","legacy"]},"themes":{"type":"array","items":{"type":"string","enum":["studio","legacy"]}},"success":{"type":"boolean"}}},"BlogPostRequest":{"type":"object","required":["slug","title","description","pubDate","image","category","keywords","bodyMarkdown","status"],"properties":{"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"pubDate":{"type":"string","format":"date"},"modifiedDate":{"type":"string","format":"date"},"image":{"type":"string"},"category":{"type":"string","enum":["導入決策","營運流程","建置與維運"]},"readerIntent":{"type":"string"},"audience":{"type":"string"},"keywords":{"type":"array","items":{"type":"string"}},"bodyMarkdown":{"type":"string"},"status":{"type":"string","enum":["draft","published"]}}},"BlogPost":{"allOf":[{"$ref":"#/components/schemas/BlogPostRequest"},{"type":"object","required":["id","created_at","updated_at"],"properties":{"id":{"type":"string"},"created_at":{"type":"integer"},"updated_at":{"type":"integer"},"published_at":{"type":["integer","null"]}}}]},"BlogPostResponse":{"type":"object","required":["post"],"properties":{"post":{"$ref":"#/components/schemas/BlogPost"}}},"User":{"type":"object","required":["id","email","name"],"properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string"}}},"Product":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"price":{"type":"number"},"billing_cycle":{"type":"string"}}},"ProductIdRequest":{"type":"object","required":["product_id"],"properties":{"product_id":{"type":"string"}}},"SubscriptionIdRequest":{"type":"object","required":["subscription_id"],"properties":{"subscription_id":{"type":"string"}}},"Subscription":{"type":"object","properties":{"id":{"type":"string"},"product_id":{"type":"string"},"status":{"type":"string"},"start_date":{"type":"integer"},"end_date":{"type":"integer"}}},"License":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"expires_at":{"type":["integer","null"]},"status":{"type":"string"}}},"ContactRequest":{"type":"object","required":["name","email","message"],"properties":{"name":{"type":"string"},"email":{"type":"string","format":"email"},"message":{"type":"string"},"phone":{"type":"string"},"source":{"type":"string"},"turnstileToken":{"type":"string"},"website":{"type":"string"}}},"AiDiagnosisRequest":{"type":"object","required":["companyName","contactName","email","turnstileToken"],"properties":{"companyName":{"type":"string"},"contactName":{"type":"string"},"email":{"type":"string","format":"email"},"phoneLine":{"type":"string"},"industry":{"type":"string"},"companySize":{"type":"string"},"websiteUrl":{"type":"string"},"tools":{"type":"array","items":{"type":"string"}},"painPoints":{"type":"array","items":{"type":"string"}},"biggestPain":{"type":"string"},"currentAiExperience":{"type":"string"},"budgetRange":{"type":"string"},"expectedTimeline":{"type":"string"},"turnstileToken":{"type":"string"}}},"LicenseValidationRequest":{"type":"object","required":["key"],"properties":{"key":{"type":"string"}}},"LicenseValidationResponse":{"type":"object","required":["valid"],"properties":{"valid":{"type":"boolean"},"error":{"type":"string"},"license_key":{"$ref":"#/components/schemas/License"}}},"CreateSubscriptionResponse":{"type":"object","required":["success","subscription"],"properties":{"success":{"type":"boolean","const":true},"subscription":{"type":"object"}}}}}}