{"openapi":"3.1.0","info":{"title":"CareClinic API","version":"1.0.0","description":"Read and save CareClinic symptom, mood, medication and sleep entries for the signed-in account. Reads cover at most the last 90 days and up to 5,000 rows per type, oldest first."},"servers":[{"url":"https://api.careclinic.io/v1"}],"components":{"securitySchemes":{"careclinic":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://api.careclinic.io/oauth/authorize","tokenUrl":"https://api.careclinic.io/oauth/token","refreshUrl":"https://api.careclinic.io/oauth/token","scopes":{"careclinic.wellness.read":"View selected wellness information","careclinic.symptoms.write":"Save symptom check-ins","careclinic.mood.write":"Save mood check-ins","careclinic.medications.write":"Save medication events","careclinic.sleep.write":"Save sleep check-ins"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}},"Symptom":{"type":"object","required":["name","severity","occurredAt"],"properties":{"name":{"type":"string"},"severity":{"type":"integer","minimum":0,"maximum":10},"occurredAt":{"type":"string","format":"date-time"},"durationMinutes":{"type":"integer"}}},"Mood":{"type":"object","required":["valence","occurredAt"],"properties":{"label":{"type":"string"},"valence":{"type":"integer","minimum":-5,"maximum":5},"energy":{"type":"integer","minimum":0,"maximum":10},"occurredAt":{"type":"string","format":"date-time"}}},"Medication":{"type":"object","required":["medicationName","action","occurredAt"],"properties":{"medicationName":{"type":"string"},"action":{"enum":["taken","skipped"]},"occurredAt":{"type":"string","format":"date-time"},"dose":{"type":"string"}}},"Sleep":{"type":"object","required":["sleepType","startAt","endAt","durationMinutes"],"properties":{"sleepType":{"enum":[0,1,2,4]},"startAt":{"type":"string","format":"date-time"},"endAt":{"type":"string","format":"date-time"},"durationMinutes":{"type":"integer","minimum":0,"maximum":1440},"quality":{"type":"integer","minimum":1,"maximum":5}}}}},"paths":{"/me":{"get":{"operationId":"getMe","summary":"Account id and plan","security":[{"careclinic":["careclinic.wellness.read"]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["id","plan","isPremium"],"properties":{"id":{"type":"string"},"plan":{"enum":["free","premium"]},"isPremium":{"type":"boolean"}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/wellness":{"get":{"operationId":"getWellness","summary":"Recent symptom, mood, medication and sleep entries","security":[{"careclinic":["careclinic.wellness.read"]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":90,"default":30}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["from","to","symptoms","moods","medications","sleep"],"properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"symptoms":{"type":"array","items":{"$ref":"#/components/schemas/Symptom"}},"moods":{"type":"array","items":{"$ref":"#/components/schemas/Mood"}},"medications":{"type":"array","items":{"$ref":"#/components/schemas/Medication"}},"sleep":{"type":"array","items":{"$ref":"#/components/schemas/Sleep"}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/catalog/search":{"get":{"operationId":"searchCatalog","summary":"Find an owned symptom, medication or sleep care plan handle","security":[{"careclinic":["careclinic.wellness.read"]}],"parameters":[{"name":"domain","in":"query","required":true,"schema":{"enum":["symptom","medication","sleep"]}},{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":80,"description":"For sleep, * returns the default care plan."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","maxItems":20,"items":{"type":"object","required":["id","name","domain"],"properties":{"id":{"type":"string","minLength":32,"maxLength":1024,"pattern":"^cc1\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"},"name":{"type":"string"},"domain":{"enum":["symptom","medication","sleep"]},"secondaryLabel":{"type":"string"}}}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reminders/today":{"get":{"operationId":"getTodayReminders","summary":"Today's medication and supplement occurrences","security":[{"careclinic":["careclinic.wellness.read"]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","maxItems":100,"items":{"type":"object","required":["occurrenceId","medicationId","medicationName","scheduledAt","status"],"properties":{"occurrenceId":{"type":"string"},"medicationId":{"type":"string","minLength":32,"maxLength":1024,"pattern":"^cc1\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"},"medicationName":{"type":"string"},"scheduledAt":{"type":"string","format":"date-time"},"status":{"enum":["upcoming","taken","skipped","snoozed"]},"dose":{"type":"string"},"unit":{"type":"string"},"doseForm":{"type":"string"},"reminderId":{"type":"string","minLength":32,"maxLength":1024,"pattern":"^cc1\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"},"reminderIndex":{"type":"integer"}}}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/entries":{"get":{"operationId":"listEntries","summary":"Entries since a time, newest first, with content-derived ids","security":[{"careclinic":["careclinic.wellness.read"]}],"parameters":[{"name":"since","in":"query","schema":{"type":"string","format":"date-time","description":"At most 88 days ago. Default: the last 30 days."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","required":["id","domain","occurredAt"],"properties":{"id":{"type":"string","description":"Derived from the entry content. Identical entries get distinct ids by order."},"domain":{"enum":["symptom","mood","medication","sleep"]},"occurredAt":{"type":"string","format":"date-time","description":"For sleep, the stage end."},"loggedAt":{"type":"string","format":"date-time","description":"When the entry was first saved. Can be later than occurredAt. Editing an entry in the app gives it a new id but can keep this time. Absent for some older entries."}},"additionalProperties":true}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createEntry","summary":"Save a symptom, mood, medication or sleep entry","security":[{"careclinic":["careclinic.wellness.read"]}],"parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":1,"maxLength":255},"description":"Reusing a key with the same entry returns the original receipt with 200. Reusing it with a different entry returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","required":["domain","symptomId","name","severity","occurredAt"],"properties":{"domain":{"const":"symptom"},"symptomId":{"type":"string","minLength":32,"maxLength":1024,"pattern":"^cc1\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"},"name":{"type":"string","maxLength":120},"severity":{"type":"integer","minimum":1,"maximum":10},"occurredAt":{"type":"string","format":"date-time"},"durationMinutes":{"type":"integer","minimum":0,"maximum":43200},"note":{"type":"string","maxLength":300}}},{"type":"object","required":["domain","valence","occurredAt"],"properties":{"domain":{"const":"mood"},"label":{"type":"string","maxLength":120},"valence":{"type":"integer","minimum":-5,"maximum":5},"energy":{"type":"integer","minimum":0,"maximum":10},"occurredAt":{"type":"string","format":"date-time"},"note":{"type":"string","maxLength":300}}},{"type":"object","required":["domain","medicationId","medicationName","action","occurredAt","reminderId","reminderIndex"],"properties":{"domain":{"const":"medication"},"medicationId":{"type":"string","minLength":32,"maxLength":1024,"pattern":"^cc1\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"},"medicationName":{"type":"string","maxLength":120},"action":{"enum":["taken","skipped"]},"occurredAt":{"type":"string","format":"date-time"},"reminderId":{"type":"string","minLength":32,"maxLength":1024,"pattern":"^cc1\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"},"reminderIndex":{"type":"integer","minimum":0,"maximum":1000},"note":{"type":"string","maxLength":300}}},{"type":"object","required":["domain","occurrenceId","action"],"additionalProperties":false,"description":"A dose from GET /v1/reminders/today by its occurrenceId. The medication, time and reminder come from today's schedule.","properties":{"domain":{"const":"medication"},"occurrenceId":{"type":"string","minLength":1,"maxLength":1024},"action":{"enum":["taken","skipped"]},"note":{"type":"string","maxLength":300}}},{"type":"object","required":["domain","occurredAt","stages"],"properties":{"domain":{"const":"sleep"},"planId":{"type":"string","minLength":32,"maxLength":1024,"pattern":"^cc1\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"},"planName":{"type":"string","maxLength":120},"occurredAt":{"type":"string","format":"date-time","description":"The latest stage end."},"stages":{"type":"array","minItems":1,"maxItems":4,"items":{"type":"object","required":["sleepType","startAt","endAt","durationMinutes"],"properties":{"sleepType":{"enum":[0,1,2,4]},"startAt":{"type":"string","format":"date-time"},"endAt":{"type":"string","format":"date-time"},"durationMinutes":{"type":"integer","minimum":0,"maximum":1440}}}},"quality":{"type":"integer","minimum":1,"maximum":5},"note":{"type":"string","maxLength":250}}}]}}}},"responses":{"200":{"description":"Already saved with this Idempotency-Key","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"const":false}}}}}},"201":{"description":"Saved","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"domain":{"enum":["symptom","mood","medication","sleep"]},"occurredAt":{"type":"string","format":"date-time"},"created":{"const":true}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}