48hr.email/api/routes/mail.api.md
ClaraCrazy fb3d8a60aa
[AI][Feat]: Add API
Also adding API docs <3
2026-01-05 10:29:12 +01:00

74 lines
1.3 KiB
Markdown

# Mail Operations API
## Overview
Endpoints for deleting emails and forwarding mail.
---
## Endpoints
### DELETE `/api/mail/inbox/:address/:uid`
Delete a single email by UID.
- **Auth:** Optional
- **Response:**
- Success message
- **Errors:**
- `VALIDATION_ERROR`, `NOT_FOUND`
### DELETE `/api/mail/inbox/:address`
Delete all emails in an inbox (requires `?confirm=true`).
- **Auth:** Optional
- **Response:**
- Success message, deleted count
- **Errors:**
- `CONFIRMATION_REQUIRED`, `NOT_FOUND`
### POST `/api/mail/forward`
Forward a single email.
- **Auth:** Required
- **Body:**
- `address`, `uid`, `to`
- **Response:**
- Success message
- **Errors:**
- `VALIDATION_ERROR`, `NOT_FOUND`, `FORWARD_FAILED`
### POST `/api/mail/forward-all`
Forward all emails in an inbox.
- **Auth:** Required
- **Body:**
- `address`, `to`
- **Response:**
- Success message
- **Errors:**
- `VALIDATION_ERROR`, `NOT_FOUND`, `FORWARD_FAILED`
---
## Response Format
```
{
success: true|false,
data: ...,
error?: ...,
code?: ...
}
```
## Error Codes
- `VALIDATION_ERROR`: Invalid input
- `NOT_FOUND`: Resource not found
- `CONFIRMATION_REQUIRED`: Confirmation required for bulk delete
- `FORWARD_FAILED`: Forwarding failed
---
## Example Response
```
{
"success": true,
"data": {
"message": "Email deleted successfully"
}
}
```