{"openapi":"3.1.0","info":{"title":"ColdStorage","version":"1.0.0","description":"Time-locked, encrypted text storage. The id is both retrieval and encryption key. Server clock decides when a text unlocks. Max 5000 characters."},"servers":[{"url":"https://cold.weslie.tk"}],"paths":{"/api/v1/notes":{"post":{"operationId":"createNote","summary":"Store a text and lock it","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Created"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/notes/{id}":{"get":{"operationId":"readNote","summary":"Read a text (423 while locked)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{32}$"}}],"responses":{"200":{"description":"Unlocked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Note"}}}},"423":{"description":"Still locked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Locked"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/notes/{id}/extend":{"post":{"operationId":"extendLock","summary":"Extend the lock (only while locked, only later)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{32}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendRequest"}}}},"responses":{"200":{"description":"Extended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Locked"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"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"}}}}}}}},"components":{"schemas":{"CreateRequest":{"type":"object","required":["text"],"properties":{"text":{"type":"string","maxLength":5000},"delay":{"type":"string","examples":["30d","12h"],"description":"<number><s|m|h|d|w|y>"},"delay_seconds":{"type":"integer","minimum":0,"maximum":315360000},"unlock_at":{"description":"Unix seconds or ISO-8601 timestamp","type":["integer","string"]}},"description":"Provide exactly one of delay, delay_seconds, unlock_at."},"ExtendRequest":{"type":"object","properties":{"add":{"type":"string","examples":["7d"]},"add_seconds":{"type":"integer","minimum":1},"unlock_at":{"type":["integer","string"]}},"description":"Provide exactly one of add, add_seconds, unlock_at."},"Created":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"created_at":{"type":"integer"},"unlock_at":{"type":"integer"},"server_time":{"type":"integer"}}},"Note":{"type":"object","properties":{"locked":{"const":false},"text":{"type":"string"},"created_at":{"type":"integer"},"unlock_at":{"type":"integer"},"server_time":{"type":"integer"}}},"Locked":{"type":"object","properties":{"locked":{"const":true},"remaining_seconds":{"type":"integer"},"unlock_at":{"type":"integer"},"server_time":{"type":"integer"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}