API
예약과 취소
나중에 보내기, 시각 옮기기, 중단하기.
PATCHapi.openemail.uk/emails/{id}
이 페이지의 2개 호출을 본인 키로 워크스페이스에 실제로 실행합니다.
예약
scheduledAt은 ISO-8601 시각이나 PT2H 같은 기간을 받으며 최대 1년 뒤까지 가능합니다. 예약된 메시지는 status: "scheduled"와 함께 202를 응답하고, 실제로 발송되기 직전까지 취소할 수 있습니다.
cancellableForSeconds는 즉시 발송에 대해 같은 역할을 합니다. 작성기의 발송 취소 시간을, API의 동작을 결정할 이유가 없는 사용자 설정에 하드코딩하는 대신 밖으로 드러낸 것입니다. 둘은 함께 쓸 수 없습니다. 예약된 메시지는 이미 취소 가능하기 때문입니다.
발송 예약하기
두 시간 뒤입니다. 응답에는 시각을 옮기거나 중단할 때 필요한 id가 담깁니다.
curl -X POST "$OE/emails" -H "$AUTH" -H "Content-Type: application/json" \ -d '{ "from": "[email protected]", "to": ["[email protected]"], "subject": "Your September invoice", "html": "<p>Invoice attached.</p>", "scheduledAt": "PT2H" }'HTTP/1.1 202 Accepted Location: /emails/msg_8cd0a316930b4482a8b8440b { "object": "email", "id": "msg_8cd0a316930b4482a8b8440b", "status": "scheduled", "scheduledAt": "2026-09-01T10:19:41.345Z", "cancellableUntil": "2026-09-01T10:19:41.345Z", "messageId": null, "transport": null, "sentAt": null }200이 아니라 202입니다. 아직 무언가가 더 일어나야 한다는 뜻입니다. 즉시 발송은 status: "sent"와 함께 200을 응답하므로, 호출자는 상태 코드만으로 분기할 수 있습니다.
시각 옮기기
PATCH /emails/{id}. 바꿀 수 있는 것은 scheduledAt뿐이며, 큐에 있거나 예약된 동안에만 가능합니다.
curl -X PATCH "$OE/emails/msg_8cd0a316930b4482a8b8440b" \ -H "$AUTH" -H "Content-Type: application/json" \ -d '{ "scheduledAt": "PT6H" }'{ "object": "email", "id": "msg_8cd0a316930b4482a8b8440b", "status": "scheduled", "scheduledAt": "2026-09-01T14:20:15.881Z" }중단하기
POST /emails/{id}/cancel.
curl -X POST "$OE/emails/msg_8cd0a316930b4482a8b8440b/cancel" -H "$AUTH"{ "object": "email", "id": "msg_8cd0a316930b4482a8b8440b", "status": "cancelled" }두 번 취소해도 오류가 아닙니다. 두 번째 호출은 이미 취소된 같은 메시지를 반환하므로 재시도는 안전합니다.
이미 나간 메시지를 취소하면 409 email_not_cancellable입니다. 되돌려 받을 수 없으며, 다르게 응답하는 것은 거짓말이 됩니다.