{"openapi":"3.1.0","info":{"title":"Derek (Bot) API","version":"1.0.0","description":"Send Teams messages from WRLD's systems as Derek (Bot)."},"servers":[{"url":"https://teams.wchi.app/api/v1"}],"security":[{"key":[]}],"components":{"securitySchemes":{"key":{"type":"http","scheme":"bearer","description":"tb_test_… or tb_live_…"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message","docs"],"properties":{"code":{"type":"string","enum":["invalid_key","idempotency_key_required","invalid_request","recipient_not_found","test_recipient_not_allowed","not_found","request_in_progress","idempotency_key_reused","rate_limited","teams_rejected","teams_unavailable","sending_paused","teams_app_not_ready","internal"]},"message":{"type":"string"},"detail":{"type":"string"},"docs":{"type":"string","format":"uri"},"message_id":{"type":"string","format":"uuid"}}}}},"Message":{"type":"object","required":["id","status","mode","to","created_at","status_at"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued","sent","failed","updated","deleted"]},"mode":{"type":"string","enum":["test","live"]},"to":{"type":"object","properties":{"person":{"type":"string","format":"email"}}},"created_at":{"type":"string","format":"date-time"},"status_at":{"type":["string","null"],"format":"date-time"},"error":{"type":"object","properties":{"code":{"type":"string"},"detail":{"type":["string","null"]}}}}},"SendRequest":{"type":"object","required":["to"],"additionalProperties":false,"properties":{"to":{"type":"object","required":["person"],"additionalProperties":false,"properties":{"person":{"type":"string","format":"email"}}},"text":{"type":"string","maxLength":20000,"description":"Teams markdown. Give text or card, not both."},"card":{"type":"object","description":"An Adaptive Card, version 1.6 or lower. Derek adds the integration's name above it."},"preview":{"type":"string","maxLength":150,"description":"What the notification shows; defaults to the text."}}}}},"paths":{"/messages":{"post":{"summary":"Send a message","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendRequest"}}}},"responses":{"200":{"description":"Already handled under this Idempotency-Key; nothing was sent again"},"201":{"description":"Sent","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message"}}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Bad key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Same Idempotency-Key still in progress","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Idempotency-Key reused with a different request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Teams refused or didn't answer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Sending paused or Derek not ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/messages/{id}":{"get":{"summary":"Get a message","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The message","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message"}}}}}},"404":{"description":"Not this integration's message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}