{"components":{"schemas":{"AppRef":{"properties":{"id":{"minimum":1,"type":"integer"},"name":{"type":"string"},"slug":{"type":"string"}},"type":"object"},"Error":{"properties":{"error":{"type":"string"}},"required":["error"],"type":"object"},"MeResponse":{"properties":{"app":{"$ref":"#/components/schemas/AppRef"},"session":{"properties":{"expires_at":{"format":"date-time","type":"string"}},"type":"object"},"user":{"$ref":"#/components/schemas/User"}},"type":"object"},"Record":{"properties":{"app_id":{"minimum":1,"type":"integer"},"created_at":{"format":"date-time","type":"string"},"data":{"description":"Any valid JSON value."},"id":{"minimum":1,"type":"integer"},"type":{"type":"string"},"updated_at":{"format":"date-time","type":"string"},"user_id":{"minimum":1,"type":"integer"}},"required":["id","app_id","user_id","type","data","created_at","updated_at"],"type":"object"},"RecordCreateRequest":{"properties":{"data":{"description":"Any valid JSON value."},"type":{"maxLength":120,"type":"string"}},"required":["type","data"],"type":"object"},"RecordListResponse":{"properties":{"records":{"items":{"$ref":"#/components/schemas/Record"},"type":"array"}},"type":"object"},"RecordUpdateRequest":{"properties":{"data":{"description":"Any valid JSON value."},"type":{"maxLength":120,"type":"string"}},"type":"object"},"User":{"properties":{"avatar_url":{"type":"string"},"email":{"type":"string"},"id":{"minimum":1,"type":"integer"},"name":{"type":"string"}},"type":"object"}},"securitySchemes":{"cookieAuth":{"description":"ohmesh sets app-specific HttpOnly cookies for app sessions and a separate admin cookie for ohmesh admin sessions.","in":"cookie","name":"ohmesh_session_app_\u003capp_id\u003e","type":"apiKey"}}},"info":{"description":"Cookie-authenticated OAuth sessions and user-scoped JSON record storage for static apps.","title":"ohmesh API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/api/apps/{slug}/records":{"get":{"operationId":"listRecords","parameters":[{"description":"Registered app slug.","in":"path","name":"slug","required":true,"schema":{"type":"string"}},{"description":"Optional record type filter.","in":"query","name":"type","required":false,"schema":{"type":"string"}},{"description":"Maximum records to return. Default 100, max 500.","in":"query","name":"limit","required":false,"schema":{"minimum":0,"type":"integer"}},{"description":"Pagination offset. Default 0.","in":"query","name":"offset","required":false,"schema":{"minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordListResponse"}}},"description":"Record list."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Login required."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Session is not valid for this app."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"App not found."}},"security":[{"cookieAuth":[]}],"summary":"List records for the current user and app","tags":["Records"]},"post":{"operationId":"createRecord","parameters":[{"description":"Registered app slug.","in":"path","name":"slug","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordCreateRequest"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}},"description":"Created record."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid JSON body, missing type, or invalid data."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Login required."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Session is not valid for this app, or the app record limit was reached."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"App not found."}},"security":[{"cookieAuth":[]}],"summary":"Insert a user-scoped JSON record","tags":["Records"]}},"/api/apps/{slug}/records/{id}":{"delete":{"operationId":"deleteRecord","parameters":[{"description":"Registered app slug.","in":"path","name":"slug","required":true,"schema":{"type":"string"}},{"description":"Record id.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Login required."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Session is not valid for this app."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"App or record not found."}},"security":[{"cookieAuth":[]}],"summary":"Delete one user-scoped record","tags":["Records"]},"get":{"operationId":"getRecord","parameters":[{"description":"Registered app slug.","in":"path","name":"slug","required":true,"schema":{"type":"string"}},{"description":"Record id.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}},"description":"Record."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Login required."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Session is not valid for this app."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"App or record not found."}},"security":[{"cookieAuth":[]}],"summary":"Get one user-scoped record","tags":["Records"]},"patch":{"operationId":"updateRecord","parameters":[{"description":"Registered app slug.","in":"path","name":"slug","required":true,"schema":{"type":"string"}},{"description":"Record id.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordUpdateRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}},"description":"Updated record."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid JSON body, type, or data."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Login required."},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Session is not valid for this app."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"App or record not found."}},"security":[{"cookieAuth":[]}],"summary":"Update a record type and/or JSON data","tags":["Records"]}},"/auth/logout":{"post":{"description":"Without app query parameters this returns 204. With app and redirect_url it redirects back with ohmesh_logout=success.","operationId":"logout","parameters":[{"description":"Registered app slug for app logout redirect.","in":"query","name":"app","required":false,"schema":{"type":"string"}},{"description":"Registered URL to return to after logout.","in":"query","name":"redirect_url","required":false,"schema":{"type":"string"}}],"responses":{"204":{"description":"Session cleared."},"303":{"description":"Session cleared and redirected to app redirect_url."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid or unregistered redirect_url."}},"security":[{"cookieAuth":[]}],"summary":"Clear the ohmesh session cookie","tags":["Auth"]}},"/auth/me":{"get":{"operationId":"getCurrentSession","parameters":[{"description":"Registered app slug. Recommended for app clients so ohmesh can choose the correct app session cookie.","in":"query","name":"app","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}},"description":"Current session."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Login required."}},"security":[{"cookieAuth":[]}],"summary":"Get current authenticated user and app session","tags":["Auth"]}},"/login":{"get":{"description":"Navigate the browser here with app and redirect_url. ohmesh completes OAuth, sets an HttpOnly session cookie, then returns to redirect_url.","operationId":"startAppLogin","parameters":[{"description":"Registered app slug.","in":"query","name":"app","required":true,"schema":{"type":"string"}},{"description":"Registered URL to return to after login.","in":"query","name":"redirect_url","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Login provider selection page."},"303":{"description":"Already logged in for this app; redirects to redirect_url."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid or unregistered redirect_url."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"App not found."}},"summary":"Start app OAuth login","tags":["Auth"]}},"/logout":{"get":{"operationId":"logoutAppViaBrowser","parameters":[{"description":"Registered app slug.","in":"query","name":"app","required":true,"schema":{"type":"string"}},{"description":"Registered URL to return to after logout.","in":"query","name":"redirect_url","required":true,"schema":{"type":"string"}}],"responses":{"303":{"description":"Session cleared and redirected to app redirect_url with ohmesh_logout=success."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid or unregistered redirect_url."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"App not found."}},"summary":"Clear the session and redirect back to the app","tags":["Auth"]}}},"servers":[{"url":"https://ohmesh.okgo.click"}],"tags":[{"description":"OAuth session and cookie endpoints.","name":"Auth"},{"description":"User-scoped JSON records for a registered app.","name":"Records"}]}