mirror of
https://github.com/Ttungx/codex_auto_register.git
synced 2026-08-29 02:07:05 +08:00
Prepare public codex auto register repo
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*.pyo
|
||||
*.pyd
|
||||
.python-version
|
||||
.venv/
|
||||
venv/
|
||||
env/
|
||||
|
||||
.vscode/
|
||||
.idea/
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
config.json
|
||||
codex/config.json
|
||||
|
||||
registered_accounts.txt
|
||||
accounts.txt
|
||||
ak.txt
|
||||
rk.txt
|
||||
registered_accounts.csv
|
||||
|
||||
codex/accounts.txt
|
||||
codex/ak.txt
|
||||
codex/rk.txt
|
||||
codex/registered_accounts.csv
|
||||
|
||||
codex/codex_tokens/
|
||||
codex/codex_accounts_tokens/
|
||||
rename_tokens.py
|
||||
|
||||
*.log
|
||||
*.tmp
|
||||
|
||||
@@ -1,87 +1,123 @@
|
||||
# ChatGPT 批量自动注册工具
|
||||
# codex_auto_register
|
||||
|
||||
> 使用 DuckMail 临时邮箱,并发自动注册 ChatGPT 账号
|
||||
基于 DuckMail 的 ChatGPT / Codex 自动注册与 OAuth Token 生成工具集。
|
||||
|
||||
## 功能
|
||||
## 致谢
|
||||
|
||||
- 📨 自动创建临时邮箱 (DuckMail)
|
||||
- 📥 自动获取 OTP 验证码
|
||||
- ⚡ 支持并发注册多个账号
|
||||
- 🔄 自动处理 OAuth 登录
|
||||
- ☁️ 支持代理配置
|
||||
- 📤 支持上传账号到 Codex / CPA 面板
|
||||
本项目基于原项目 https://github.com/adminlove520/chatgpt_register 改造而来。
|
||||
|
||||
## 环境
|
||||
当前仓库的主要差异:
|
||||
|
||||
- 将注册codex邮箱服务从原先方案替换为 DuckMail API
|
||||
- 保留并扩展 Codex 协议 OAuth 流程
|
||||
- 输出 CLIProxyAPI v6 可识别的 Codex auth files
|
||||
- 增加更适合公开仓库的示例配置与忽略规则
|
||||
|
||||
## 包含内容
|
||||
|
||||
- `chatgpt_register.py`:根目录下的 DuckMail 注册脚本
|
||||
- `codex/protocol_keygen.py`:纯 HTTP 的 Codex OAuth 注册与 token 生成脚本
|
||||
- `duckmaildoc.md`:DuckMail API 参考文档(https://raw.githubusercontent.com/MoonWeSif/DuckMail/main/public/llm-api-docs.txt)
|
||||
|
||||
## 环境依赖
|
||||
|
||||
根目录脚本:
|
||||
|
||||
```bash
|
||||
pip install curl_cffi
|
||||
```
|
||||
|
||||
## 配置 (config.json)
|
||||
Codex 脚本:
|
||||
|
||||
```json
|
||||
{
|
||||
"total_accounts": 5,
|
||||
"duckmail_api_base": "https://api.duckmail.sbs",
|
||||
"duckmail_bearer": "你的 DuckMail API Token",
|
||||
"proxy": "http://127.0.0.1:7890",
|
||||
"output_file": "registered_accounts.txt",
|
||||
"enable_oauth": true,
|
||||
"oauth_redirect_uri": "http://localhost:1455/auth/callback",
|
||||
"ak_file": "ak.txt",
|
||||
"rk_file": "rk.txt"
|
||||
}
|
||||
```bash
|
||||
pip install requests urllib3
|
||||
```
|
||||
|
||||
| 配置项 | 说明 |
|
||||
|--------|------|
|
||||
| total_accounts | 注册账号数量 |
|
||||
| duckmail_bearer | DuckMail API Token |
|
||||
| proxy | 代理地址 (可选) |
|
||||
| output_file | 输出账号文件 |
|
||||
| enable_oauth | 启用 OAuth 登录 |
|
||||
| ak_file | Access Key 文件 |
|
||||
| rk_file | Refresh Key 文件 |
|
||||
## 配置方式
|
||||
|
||||
## CPA 面板集成
|
||||
仓库只提交示例配置,不提交真实配置。
|
||||
|
||||
注册完成后,可以自动上传账号到 CPA 面板:
|
||||
使用前复制:
|
||||
|
||||
| 配置项 | 说明 | 参考 |
|
||||
|--------|------|------|
|
||||
| upload_api_url | CPA 面板上传 API 地址 | https://help.router-for.me/cn/ |
|
||||
| upload_api_token | CPA 面板登录密码 | 你的 CPA 面板密码 |
|
||||
```bash
|
||||
copy config.example.json config.json
|
||||
copy codex\config.example.json codex\config.json
|
||||
```
|
||||
|
||||
> CPA 面板仓库: https://github.com/dongshuyan/CPA-Dashboard
|
||||
然后把你自己的 DuckMail、代理和 CPA 参数填进去。
|
||||
|
||||
## 使用
|
||||
## 根目录脚本
|
||||
|
||||
运行:
|
||||
|
||||
```bash
|
||||
python chatgpt_register.py
|
||||
```
|
||||
|
||||
## 输出
|
||||
对应示例配置见 `config.example.json`。
|
||||
|
||||
注册成功的账号会保存到 `registered_accounts.txt`
|
||||
主要配置项:
|
||||
|
||||
## 目录结构
|
||||
| 配置项 | 说明 |
|
||||
| ----------------- | ------------------------ |
|
||||
| total_accounts | 注册账号数量 |
|
||||
| duckmail_api_base | DuckMail API 地址 |
|
||||
| duckmail_bearer | DuckMail Bearer Token |
|
||||
| proxy | HTTP/HTTPS 代理 |
|
||||
| output_file | 注册结果输出文件 |
|
||||
| enable_oauth | 是否执行 OAuth |
|
||||
| oauth_required | 是否要求 OAuth 成功 |
|
||||
| upload_api_url | 可选,上传到 CPA 的接口 |
|
||||
| upload_api_token | 可选,CPA 管理接口 Token |
|
||||
|
||||
## Codex 协议脚本
|
||||
|
||||
运行:
|
||||
|
||||
```bash
|
||||
python codex\protocol_keygen.py
|
||||
```
|
||||
|
||||
对应示例配置见 `codex/config.example.json`。
|
||||
|
||||
该脚本会:
|
||||
|
||||
- 使用 DuckMail 创建临时邮箱
|
||||
- 完成 ChatGPT 注册流程
|
||||
- 执行 Codex OAuth 登录并换取 token
|
||||
- 生成 CLIProxyAPI v6 兼容文件名的 token JSON
|
||||
- 可选上传到 CPA 管理接口
|
||||
|
||||
## 输出说明
|
||||
|
||||
运行过程中通常会生成以下本地文件,这些都已加入 `.gitignore`,不会进入新仓库:
|
||||
|
||||
- `config.json`
|
||||
- `codex/config.json`
|
||||
- `registered_accounts.txt`
|
||||
- `codex/accounts.txt`
|
||||
- `codex/ak.txt`
|
||||
- `codex/rk.txt`
|
||||
- `codex/registered_accounts.csv`
|
||||
- `codex/codex_tokens/`
|
||||
- `codex/codex_accounts_tokens/`
|
||||
|
||||
## 仓库结构
|
||||
|
||||
```text
|
||||
chatgpt_register/
|
||||
├── chatgpt_register.py # 主程序
|
||||
├── config.json # 配置文件
|
||||
├── README.md # 本文档
|
||||
├── codex/ # Codex 协议密钥生成
|
||||
│ ├── config.json
|
||||
│ └── protocol_keygen.py
|
||||
├── registered_accounts.txt # 输出的账号
|
||||
├── ak.txt # Access Keys
|
||||
└── rk.txt # Refresh Keys
|
||||
├── chatgpt_register.py
|
||||
├── config.example.json
|
||||
├── duckmaildoc.md
|
||||
├── README.md
|
||||
└── codex/
|
||||
├── config.example.json
|
||||
├── protocol_keygen.py
|
||||
└── README.md
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
## 说明
|
||||
|
||||
- 需要有效的代理才能注册成功
|
||||
- DuckMail API Token 需要从 https://duckmail.sbs 获取
|
||||
- 建议使用代理避免 IP 被封
|
||||
- 使用 CPA 面板需要先部署面板服务
|
||||
- 需要可用代理,否则注册、OAuth 和 CPA 自动刷新都会失败
|
||||
- `config.json` 与 `codex/config.json` 仅保留在本地使用,不应提交
|
||||
- 如果你使用 CLIProxyAPI,建议保持 `refresh_token` 与 token JSON 文件完整保存
|
||||
|
||||
+51
-37
@@ -1,60 +1,74 @@
|
||||
# Codex 协议密钥生成工具
|
||||
|
||||
> 为 ChatGPT 注册生成 Codex 协议所需的 Access Key 和 Refresh Key
|
||||
该目录提供基于 DuckMail 的纯 HTTP Codex OAuth 注册与 token 生成脚本。
|
||||
|
||||
## 功能
|
||||
## 主要能力
|
||||
|
||||
- 🔑 自动生成 Access Key (ak)
|
||||
- 🔄 自动生成 Refresh Key (rk)
|
||||
- 📤 支持上传到 Codex / CPA 面板
|
||||
- ⚡ 支持并发生成
|
||||
- 纯 HTTP 注册 ChatGPT 账号
|
||||
- 通过 DuckMail API 创建邮箱并读取验证码
|
||||
- 获取 `access_token`、`refresh_token`、`id_token`
|
||||
- 生成 CLIProxyAPI v6 兼容的 token JSON 文件名
|
||||
- 可选上传到 CPA 管理接口
|
||||
|
||||
## 配置 (config.json)
|
||||
## 配置文件
|
||||
|
||||
只提交示例文件:
|
||||
|
||||
```bash
|
||||
copy config.example.json config.json
|
||||
```
|
||||
|
||||
示例配置字段:
|
||||
|
||||
```json
|
||||
{
|
||||
"total_accounts": 800,
|
||||
"concurrent_workers": 8,
|
||||
"total_accounts": 10,
|
||||
"concurrent_workers": 2,
|
||||
"headless": false,
|
||||
"proxy": "http://127.0.0.1:7890",
|
||||
"cf_worker_domain": "你的 Cloudflare Worker 域名",
|
||||
"cf_email_domain": "你的 Cloudflare 邮箱域名",
|
||||
"cf_admin_password": "你的 Cloudflare 管理密码",
|
||||
"upload_api_url": "https://你的CPA地址/v0/management/auth-files",
|
||||
"upload_api_token": "你的CPA密码",
|
||||
"cli_proxy_api_base": "你的CPA基础URL",
|
||||
"cli_proxy_management_url": "http://你的CPA地址/management.html#/oauth",
|
||||
"cli_proxy_password": "你的CPA密码"
|
||||
"proxy": "http://127.0.0.1:7897",
|
||||
"duckmail_api_base": "https://api.duckmail.sbs",
|
||||
"duckmail_api_key": "",
|
||||
"oauth_issuer": "https://auth.openai.com",
|
||||
"oauth_client_id": "app_EMoamEEZ73f0CkXaXp7hrann",
|
||||
"oauth_redirect_uri": "http://localhost:1455/auth/callback",
|
||||
"upload_api_url": "http://localhost:8317/v0/management/auth-files",
|
||||
"upload_api_token": "",
|
||||
"accounts_file": "accounts.txt",
|
||||
"csv_file": "registered_accounts.csv",
|
||||
"ak_file": "ak.txt",
|
||||
"rk_file": "rk.txt",
|
||||
"token_json_dir": "codex_accounts_tokens"
|
||||
}
|
||||
```
|
||||
|
||||
| 配置项 | 说明 |
|
||||
|--------|------|
|
||||
| total_accounts | 生成账号数量 |
|
||||
| concurrent_workers | 并发数 |
|
||||
| proxy | 代理地址 |
|
||||
| cf_worker_domain | Cloudflare Worker 域名 |
|
||||
| upload_api_url | CPA 上传 API |
|
||||
| cli_proxy_api_base | CPA CLI 代理 API |
|
||||
|
||||
## 使用
|
||||
|
||||
```bash
|
||||
python protocol_keygen.py
|
||||
```
|
||||
|
||||
## 输出
|
||||
## 输出文件
|
||||
|
||||
- `ak.txt` - Access Keys
|
||||
- `rk.txt` - Refresh Keys
|
||||
- `registered_accounts.csv` - CSV 格式账号
|
||||
运行后会在本地生成:
|
||||
|
||||
## 接入 CPA 面板
|
||||
- `accounts.txt`
|
||||
- `registered_accounts.csv`
|
||||
- `ak.txt`
|
||||
- `rk.txt`
|
||||
- `codex_accounts_tokens/` 或你配置的 token 输出目录
|
||||
|
||||
生成后可以自动上传到 CPA 面板:
|
||||
这些文件都应保留本地使用,不应提交到仓库。
|
||||
|
||||
1. 部署 CPA 面板: https://github.com/dongshuyan/CPA-Dashboard
|
||||
2. 配置 `upload_api_url` 和 `upload_api_token`
|
||||
3. 运行后自动上传
|
||||
## 与原项目的差异
|
||||
|
||||
> 文档: https://help.router-for.me/cn/
|
||||
相比上游项目,本目录的核心改动是将邮箱接收能力切换为 DuckMail:
|
||||
|
||||
- 使用 `POST /accounts` 创建临时邮箱
|
||||
- 使用 `POST /token` 获取 DuckMail Bearer Token
|
||||
- 使用 `GET /messages` 和 `GET /messages/{id}` 轮询验证码邮件
|
||||
|
||||
## CPA 使用说明
|
||||
|
||||
- 生成的 token JSON 适配 CLIProxyAPI v6 命名格式
|
||||
- `refresh_token` 会一并保存,供 CPA 自动刷新 access token
|
||||
- 如果配置了 `upload_api_url`,脚本会自动上传生成的 auth file
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"total_accounts": 10,
|
||||
"concurrent_workers": 2,
|
||||
"headless": false,
|
||||
"proxy": "http://127.0.0.1:7897",
|
||||
"duckmail_api_base": "https://api.duckmail.sbs",
|
||||
"duckmail_api_key": "",
|
||||
"oauth_issuer": "https://auth.openai.com",
|
||||
"oauth_client_id": "app_EMoamEEZ73f0CkXaXp7hrann",
|
||||
"oauth_redirect_uri": "http://localhost:1455/auth/callback",
|
||||
"upload_api_url": "",
|
||||
"upload_api_token": "",
|
||||
"accounts_file": "accounts.txt",
|
||||
"csv_file": "registered_accounts.csv",
|
||||
"ak_file": "ak.txt",
|
||||
"rk_file": "rk.txt",
|
||||
"token_json_dir": "codex_accounts_tokens"
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"total_accounts": 800,
|
||||
"concurrent_workers": 8,
|
||||
"headless": false,
|
||||
"proxy": "",
|
||||
"cf_worker_domain": "",
|
||||
"cf_email_domain": "",
|
||||
"cf_admin_password": "",
|
||||
"oauth_issuer": "https://auth.openai.com",
|
||||
"oauth_client_id": "app_EMoamEEZ73f0CkXaXp7hrann",
|
||||
"oauth_redirect_uri": "http://localhost:1455/auth/callback",
|
||||
"upload_api_url": "https://你的CPA地址/v0/management/auth-files",
|
||||
"upload_api_token": "你的CPA密码",
|
||||
"cli_proxy_api_base": "你的CPA基础URL",
|
||||
"cli_proxy_management_url": "http://你的CPA地址/management.html#/oauth",
|
||||
"cli_proxy_password": "你的CPA密码",
|
||||
"accounts_file": "accounts.txt",
|
||||
"csv_file": "registered_accounts.csv",
|
||||
"ak_file": "ak.txt",
|
||||
"rk_file": "rk.txt"
|
||||
}
|
||||
+493
-228
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"total_accounts": 3,
|
||||
"duckmail_api_base": "https://api.duckmail.sbs",
|
||||
"duckmail_bearer": "",
|
||||
"proxy": "http://127.0.0.1:7897",
|
||||
"output_file": "registered_accounts.txt",
|
||||
"enable_oauth": true,
|
||||
"oauth_required": true,
|
||||
"oauth_issuer": "https://auth.openai.com",
|
||||
"oauth_client_id": "app_EMoamEEZ73f0CkXaXp7hrann",
|
||||
"oauth_redirect_uri": "http://localhost:1455/auth/callback",
|
||||
"ak_file": "ak.txt",
|
||||
"rk_file": "rk.txt",
|
||||
"token_json_dir": "codex_tokens",
|
||||
"upload_api_url": "",
|
||||
"upload_api_token": ""
|
||||
}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"_comment": "ChatGPT(DuckMail)",
|
||||
|
||||
"total_accounts": 5,
|
||||
|
||||
"duckmail_api_base": "https://api.duckmail.sbs",
|
||||
"duckmail_bearer": "",
|
||||
|
||||
"proxy": "",
|
||||
|
||||
"output_file": "registered_accounts.txt",
|
||||
"enable_oauth": true,
|
||||
"oauth_required": true,
|
||||
"oauth_issuer": "https://auth.openai.com",
|
||||
"oauth_client_id": "app_EMoamEEZ73f0CkXaXp7hrann",
|
||||
"oauth_redirect_uri": "http://localhost:1455/auth/callback",
|
||||
"ak_file": "ak.txt",
|
||||
"rk_file": "rk.txt",
|
||||
"token_json_dir": "codex_tokens",
|
||||
"upload_api_url": "http://localhost:8317/v0/management/auth-files",
|
||||
"upload_api_token": "你的cpa面板登录密码"
|
||||
}
|
||||
+228
@@ -0,0 +1,228 @@
|
||||
```
|
||||
# DuckMail API Reference
|
||||
# Base URL: https://api.duckmail.sbs
|
||||
# Authentication: Bearer Token or API Key (dk_xxx)
|
||||
# This file is designed to be sent to AI assistants for integration help.
|
||||
|
||||
---
|
||||
|
||||
## Authentication
|
||||
|
||||
### Bearer Token
|
||||
Obtain a token via POST /token with email address and password.
|
||||
Include in requests: Authorization: Bearer <token>
|
||||
|
||||
### API Key (Optional)
|
||||
For private domain access. Obtain from https://domain.duckmail.sbs
|
||||
Format: dk_ prefix. Include in requests: Authorization: Bearer dk_xxx
|
||||
|
||||
---
|
||||
|
||||
## Endpoints
|
||||
|
||||
### [Domains] GET /domains
|
||||
Get available domain list. Returns private domains if API key is provided.
|
||||
Auth: Optional (API Key or Bearer Token)
|
||||
Query: page (default 1, 30 per page)
|
||||
Response:
|
||||
{
|
||||
"hydra:member": [
|
||||
{
|
||||
"id": "string",
|
||||
"domain": "example.com",
|
||||
"ownerId": "string | null",
|
||||
"isVerified": true,
|
||||
"verificationToken": "duckmail-verify-xxx",
|
||||
"createdAt": "2024-01-01T00:00:00Z",
|
||||
"updatedAt": "2024-01-01T00:00:00Z"
|
||||
}
|
||||
],
|
||||
"hydra:totalItems": 10,
|
||||
"hydra:view": {
|
||||
"@id": "/domains?page=1",
|
||||
"@type": "PartialCollectionView",
|
||||
"hydra:first": "/domains?page=1",
|
||||
"hydra:last": "/domains?page=1"
|
||||
}
|
||||
}
|
||||
Note: Only verified domains are returned. System domains (ownerId=null) are visible to all.
|
||||
|
||||
### [Accounts] POST /accounts
|
||||
Create a new email account. API key required for private domains.
|
||||
Auth: Optional (API Key or Bearer Token)
|
||||
Request:
|
||||
{
|
||||
"address": "user@duckmail.sbs",
|
||||
"password": "your_password"
|
||||
}
|
||||
Validation: address must contain @, username (before @) >= 3 chars, password >= 6 chars, domain must be verified.
|
||||
Response (201):
|
||||
{
|
||||
"id": "string",
|
||||
"address": "user@duckmail.sbs",
|
||||
"authType": "email",
|
||||
"createdAt": "2024-01-01T00:00:00Z",
|
||||
"updatedAt": "2024-01-01T00:00:00Z"
|
||||
}
|
||||
|
||||
### [Auth] POST /token
|
||||
Get authentication token using email and password.
|
||||
Auth: None
|
||||
Request:
|
||||
{
|
||||
"address": "user@duckmail.sbs",
|
||||
"password": "your_password"
|
||||
}
|
||||
Response:
|
||||
{
|
||||
"id": "account-id",
|
||||
"token": "eyJhbGc..."
|
||||
}
|
||||
|
||||
### [Accounts] GET /me
|
||||
Get current authenticated account info.
|
||||
Auth: Required (Bearer Token)
|
||||
Response:
|
||||
{
|
||||
"id": "string",
|
||||
"address": "user@duckmail.sbs",
|
||||
"authType": "email",
|
||||
"createdAt": "2024-01-01T00:00:00Z",
|
||||
"updatedAt": "2024-01-01T00:00:00Z"
|
||||
}
|
||||
|
||||
### [Accounts] DELETE /accounts/{id}
|
||||
Delete your own account by ID. You can only delete the currently logged-in account.
|
||||
Auth: Required (Bearer Token)
|
||||
Response: 204 No Content
|
||||
|
||||
### [Messages] GET /messages
|
||||
Get inbox message list (paginated, newest first).
|
||||
Auth: Required (Bearer Token)
|
||||
Query: page (default 1, 30 per page)
|
||||
Response:
|
||||
{
|
||||
"hydra:member": [
|
||||
{
|
||||
"id": "string",
|
||||
"msgid": "string",
|
||||
"accountId": "string",
|
||||
"from": { "name": "Sender", "address": "sender@example.com" },
|
||||
"to": [{ "name": "You", "address": "you@duckmail.sbs" }],
|
||||
"subject": "Email Subject",
|
||||
"seen": false,
|
||||
"isDeleted": false,
|
||||
"hasAttachments": false,
|
||||
"size": 1024,
|
||||
"downloadUrl": "/serve/mailbox/...",
|
||||
"createdAt": "2024-01-01T00:00:00Z",
|
||||
"updatedAt": "2024-01-01T00:00:00Z"
|
||||
}
|
||||
],
|
||||
"hydra:totalItems": 5,
|
||||
"hydra:view": { ... }
|
||||
}
|
||||
Note: List view does not include text/html body content.
|
||||
|
||||
### [Messages] GET /messages/{id}
|
||||
Get full message details including body and attachments.
|
||||
Auth: Required (Bearer Token)
|
||||
Response:
|
||||
{
|
||||
"id": "string",
|
||||
"msgid": "string",
|
||||
"accountId": "string",
|
||||
"from": { "name": "Sender", "address": "sender@example.com" },
|
||||
"to": [{ "name": "You", "address": "you@duckmail.sbs" }],
|
||||
"subject": "Email Subject",
|
||||
"text": "Plain text body",
|
||||
"html": ["<html>...</html>"],
|
||||
"seen": false,
|
||||
"isDeleted": false,
|
||||
"hasAttachments": true,
|
||||
"size": 2048,
|
||||
"downloadUrl": "/serve/mailbox/...",
|
||||
"attachments": [
|
||||
{
|
||||
"id": "0",
|
||||
"filename": "document.pdf",
|
||||
"contentType": "application/pdf",
|
||||
"disposition": "attachment",
|
||||
"transferEncoding": "",
|
||||
"related": false,
|
||||
"size": 1024,
|
||||
"downloadUrl": "/serve/mailbox/.../attach/0/document.pdf"
|
||||
}
|
||||
],
|
||||
"createdAt": "2024-01-01T00:00:00Z",
|
||||
"updatedAt": "2024-01-01T00:00:00Z"
|
||||
}
|
||||
|
||||
### [Messages] PATCH /messages/{id}
|
||||
Mark a message as read.
|
||||
Auth: Required (Bearer Token)
|
||||
Response: { "seen": true }
|
||||
|
||||
### [Messages] DELETE /messages/{id}
|
||||
Delete a message by ID.
|
||||
Auth: Required (Bearer Token)
|
||||
Response: 204 No Content
|
||||
|
||||
### [Messages] GET /sources/{id}
|
||||
Get raw email source (RFC 822 format).
|
||||
Auth: Required (Bearer Token)
|
||||
Response:
|
||||
{
|
||||
"id": "string",
|
||||
"downloadUrl": "/serve/mailbox/.../source",
|
||||
"data": "From: sender@example.com\nTo: ..."
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
## Error Response Format
|
||||
|
||||
{
|
||||
"error": "Error Type",
|
||||
"message": "Detailed error message"
|
||||
}
|
||||
|
||||
Status codes:
|
||||
- 400: Bad Request (invalid format)
|
||||
- 401: Unauthorized (missing or invalid token)
|
||||
- 403: Forbidden (no permission)
|
||||
- 404: Not Found
|
||||
- 409: Conflict (e.g. email address already exists)
|
||||
- 422: Unprocessable Entity (validation failed)
|
||||
- 500: Internal Server Error
|
||||
|
||||
---
|
||||
|
||||
## Quick Start Example
|
||||
|
||||
# 1. Create account
|
||||
curl -X POST https://api.duckmail.sbs/accounts \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"address": "test@duckmail.sbs", "password": "mypassword"}'
|
||||
|
||||
# 2. Get token
|
||||
curl -X POST https://api.duckmail.sbs/token \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"address": "test@duckmail.sbs", "password": "mypassword"}'
|
||||
|
||||
# 3. Read messages
|
||||
curl https://api.duckmail.sbs/messages \
|
||||
-H "Authorization: Bearer <your_token>"
|
||||
|
||||
# 4. Get message detail
|
||||
curl https://api.duckmail.sbs/messages/<message_id> \
|
||||
-H "Authorization: Bearer <your_token>"
|
||||
|
||||
# 5. Mark message as read
|
||||
curl -X PATCH https://api.duckmail.sbs/messages/<message_id> \
|
||||
-H "Authorization: Bearer <your_token>"
|
||||
|
||||
# 6. Get domains (with API key for private domains)
|
||||
curl https://api.duckmail.sbs/domains \
|
||||
-H "Authorization: Bearer dk_your_api_key"
|
||||
```
|
||||
Reference in New Issue
Block a user