{"openapi":"3.1.0","info":{"title":"Blenku","version":"1.0","description":"Blenku is a personal task tracker shown as a video-game quest log. Everything\nthe user tracks is a quest: kind \"story\" for the big goals in their life, \"side\" for\neverything else (\"let's make a side quest for this\"). A quest has objectives (its steps, in\norder), can require other quests (it is locked until they are complete) and unlocks the\nquests that require it. Updates form a quest's journal: what happened, plus the next move\n(call, wait, buy, go, write, do, note), which becomes the quest's icon in the log. One quest\nat a time can be tracked. Times are UTC."},"servers":[{"url":"https://blenku-production.up.railway.app/api"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"A personal API key from Blenku's Account page (blk_…), or a connector access token"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false},"NextMove":{"type":"object","properties":{"move":{"type":"string","enum":["call","wait","buy","go","write","do","note"],"description":"call, wait, buy, go (go somewhere), write, do (do it yourself), note"},"text":{"type":"string"},"at":{"type":"string","format":"date-time"}},"required":[],"additionalProperties":false},"QuestSummary":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"kind":{"type":"string","enum":["story","side"]},"status":{"type":"string","enum":["open","complete","dropped"]},"locked":{"type":"boolean","description":"waiting for a required quest"},"tracked":{"type":"boolean"},"newly_unlocked":{"type":"boolean"},"next_move":{"oneOf":[{"$ref":"#/components/schemas/NextMove"},{"type":"null"}],"description":"the latest update, while the quest is open"},"line":{"type":"string","description":"the line the log shows under the title"},"objectives_done":{"type":"integer"},"objectives_total":{"type":"integer"}},"required":[],"additionalProperties":false},"Quest":{"allOf":[{"$ref":"#/components/schemas/QuestSummary"},{"type":"object","properties":{"notes":{"type":"string"},"created_at":{"type":"string"},"closed_at":{"type":["string","null"]},"objectives":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"state":{"type":"string","enum":["open","done","dropped"]}},"required":[],"additionalProperties":false}},"requires":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"status":{"type":"string"}},"required":[],"additionalProperties":false}},"unlocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"status":{"type":"string"}},"required":[],"additionalProperties":false}},"journal":{"type":"array","description":"newest first, up to 30","items":{"type":"object","properties":{"at":{"type":"string"},"kind":{"type":"string","enum":["update","milestone"]},"label":{"type":"string"},"text":{"type":"string"},"update_id":{"type":"integer"},"next_move":{"type":"string","enum":["call","wait","buy","go","write","do","note"],"description":"call, wait, buy, go (go somewhere), write, do (do it yourself), note"}},"required":[],"additionalProperties":false}}},"required":[],"additionalProperties":false}]},"Log":{"type":"object","properties":{"story":{"type":"array","items":{"$ref":"#/components/schemas/QuestSummary"}},"side":{"type":"array","items":{"$ref":"#/components/schemas/QuestSummary"}},"completed":{"type":"array","items":{"$ref":"#/components/schemas/QuestSummary"}},"tracked":{"type":["integer","null"]},"player":{"type":"object","properties":{"level":{"type":"integer"},"quests_completed":{"type":"integer"},"this_week":{"type":"integer"}},"required":[],"additionalProperties":false}},"required":[],"additionalProperties":false}}},"paths":{"/quests":{"get":{"operationId":"listQuests","summary":"The quest log: open story and side quests with their next moves","parameters":[{"name":"section","in":"query","required":false,"schema":{"type":"string","enum":["open","story","side","completed","all"],"default":"open"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Log"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"startQuest","summary":"Start a quest","parameters":[],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"kind":{"type":"string","enum":["story","side"],"default":"side"},"notes":{"type":"string"},"objectives":{"type":"array","items":{"type":"string"},"description":"steps, in order"},"requires":{"type":"array","items":{"type":"integer"},"description":"ids of quests that must be complete first"},"track":{"type":"boolean"}},"required":["title"],"additionalProperties":false}}}}}},"/quests/{id}":{"get":{"operationId":"getQuest","summary":"A quest in full: objectives, requirements, journal","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"editQuest","summary":"Rename, change notes or kind, track or untrack","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"notes":{"type":"string"},"kind":{"type":"string","enum":["story","side"]},"tracked":{"type":"boolean"}},"required":[],"additionalProperties":false}}}}},"delete":{"operationId":"deleteQuest","summary":"Delete a quest with its objectives and journal, for good","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"}},"required":[],"additionalProperties":false}},"required":[],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quests/{id}/advance":{"post":{"operationId":"advanceQuest","summary":"Mark the next open objective done; with none left, complete the quest","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"finished":{"type":"string","enum":["objective","quest"]},"quest":{"$ref":"#/components/schemas/Quest"}},"required":[],"additionalProperties":false}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quests/{id}/complete":{"post":{"operationId":"completeQuest","summary":"Complete a quest (refused while it is locked or has open objectives)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quests/{id}/drop":{"post":{"operationId":"dropQuest","summary":"Give up a quest, keeping its history","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quests/{id}/reopen":{"post":{"operationId":"reopenQuest","summary":"Reopen a completed or dropped quest","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quests/{id}/updates":{"post":{"operationId":"logUpdate","summary":"Add to a quest's journal: what happened and the next move","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"201":{"description":"Logged","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1},"next_move":{"type":"string","enum":["call","wait","buy","go","write","do","note"],"description":"call, wait, buy, go (go somewhere), write, do (do it yourself), note","default":"note"}},"required":["text"],"additionalProperties":false}}}}}},"/quests/{id}/updates/{update_id}":{"delete":{"operationId":"deleteUpdate","summary":"Delete one journal update","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"update_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quests/{id}/objectives":{"post":{"operationId":"addObjective","summary":"Add an objective at the end","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"201":{"description":"Added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500}},"required":["title"],"additionalProperties":false}}}}}},"/quests/{id}/objectives/{objective_id}":{"patch":{"operationId":"editObjective","summary":"Rename an objective or set it done, open or dropped","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"objective_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"state":{"type":"string","enum":["open","done","dropped"]}},"required":[],"additionalProperties":false}}}}},"delete":{"operationId":"deleteObjective","summary":"Delete an objective","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"objective_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quests/{id}/requirements/{required_id}":{"put":{"operationId":"addRequirement","summary":"The quest requires another quest first (refused if it makes a cycle)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"required_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"removeRequirement","summary":"Remove a requirement","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"required_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quest"}}}},"400":{"description":"Refused, with the reason (e.g. a quest is still locked)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The API key is read-only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such quest, objective or update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}