{"openapi":"3.1.0","info":{"title":"AIPing Notification & Human-in-the-Loop API","version":"1.0.0","description":"Self-hosted, zero-cost API allowing any AI model or agent to send real-time notifications to the user's Android phone and optionally wait for a reply."},"servers":[{"url":"https://aiping.enigma-codes.co.uk","description":"Current AIPing server"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"security":[{"bearerAuth":[]}],"paths":{"/api/v1/notify":{"post":{"operationId":"sendNotificationToUser","summary":"Send a push notification to the user's Android phone","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title","message"],"properties":{"source_model":{"type":"string","description":"Name of the AI model or agent sending this message (e.g., Claude 3.7, GPT-4o, Gemini 2.5, Local Llama)"},"title":{"type":"string","description":"Short notification headline"},"message":{"type":"string","description":"Full message body shown to the user"},"urgency":{"type":"string","enum":["low","normal","high","critical"],"default":"normal","description":"low = silent inbox, normal = standard ping, high = heads-up, critical = alarm-style get-my-attention alert"},"actions":{"type":"array","items":{"type":"string"},"maxItems":4,"description":"Optional quick-reply action buttons shown right on the Android notification (e.g., ['Approve', 'Reject'])"},"tags":{"type":"array","items":{"type":"string"},"description":"Optional tags such as ['build', 'urgent', 'question']"},"expect_reply":{"type":"boolean","default":false,"description":"Whether the AI expects the user to reply from their phone"},"wait_for_reply_seconds":{"type":"integer","minimum":0,"maximum":300,"description":"Optional: hold the HTTP request open up to N seconds and return the user's reply directly in the response"},"image":{"type":"string","description":"Optional image (e.g. a screenshot) as base64 or a data URL. PNG, JPEG, WebP or GIF, up to 1.5 MB. Shown as a picture notification on the phone."}}}}}},"responses":{"201":{"description":"Notification delivered (and optional reply if wait_for_reply_seconds was set)"}}}},"/api/v1/messages/{id}":{"get":{"operationId":"getNotificationStatus","summary":"Retrieve a notification and any replies from the user","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Message details including replies array"}}}},"/api/v1/messages/{id}/image":{"get":{"operationId":"getNotificationImage","summary":"Download the image attached to a notification (admin key or the key that sent it)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The image bytes (image/png, image/jpeg, image/webp or image/gif)"},"404":{"description":"No image, or not visible to this key"}}}},"/api/v1/messages/{id}/replies/{replyId}/image":{"get":{"operationId":"getReplyImage","summary":"Download a photo the user sent with a reply (the reply's image.url points here)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"replyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The image bytes (usually image/jpeg)"},"404":{"description":"No image, or not visible to this key"}}}},"/api/v1/messages/{id}/wait":{"get":{"operationId":"waitForUserReply","summary":"Long-poll until the user replies from their Android phone","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"timeout","in":"query","schema":{"type":"integer","default":60,"maximum":300}}],"responses":{"200":{"description":"Returns replied=true and the reply object, or replied=false on timeout"}}}}}}