APIリファレンス

下書きと添付ファイル

非公開の添付ファイルストレージを使って、メール作成のフローを構築します。

POST/drafts
APIキー

作成画面用の下書きを作成する

作成画面用の下書きを作成する

リクエスト
curl https://sendhq.cc/api/v1/drafts \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"from":"hello@example.com","to":["customer@example.net"],"subject":"Hello"}'
201 レスポンス
{
  "id": "dr_…",
  "attachments": []
}
GET/drafts
APIキー

作成画面用の下書きを一覧表示する

作成画面用の下書きを一覧表示する

リクエスト
curl https://sendhq.cc/api/v1/drafts \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 レスポンス
{
  "data": [],
  "count": 0
}
GET/drafts/:id
APIキー

下書きと添付ファイルを取得する

下書きと添付ファイルを取得する

リクエスト
curl https://sendhq.cc/api/v1/drafts/id_value \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 レスポンス
{
  "id": "dr_…",
  "attachments": []
}
PUT/drafts/:id
APIキー

下書きの内容を置き換える

下書きの内容を置き換える

リクエスト
curl https://sendhq.cc/api/v1/drafts/id_value \
  -X PUT \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"from":"hello@example.com","to":["customer@example.net"],"subject":"Updated subject","text":"Updated body"}'
200 レスポンス
{
  "id": "dr_…"
}
DELETE/drafts/:id
APIキー

下書きを破棄する

下書きを破棄する

リクエスト
curl https://sendhq.cc/api/v1/drafts/id_value \
  -X DELETE \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 レスポンス
{
  "ok": true
}
POST/drafts/:id/attachments
APIキー

下書きに添付ファイルをアップロードする

ファイルの生のバイト列をアップロードします。Content-TypeとX-Filenameを設定してください。1通のメッセージに含められるのは、最大10ファイル、合計10 MBまでです。

任意のヘッダーX-Filename
リクエスト
curl https://sendhq.cc/api/v1/drafts/id_value/attachments \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/pdf" \
  -H "X-Filename: invoice.pdf" \
  --data-binary @invoice.pdf
201 レスポンス
{
  "id": "att_…",
  "filename": "invoice.pdf",
  "sizeBytes": 48231,
  "available": true
}
GET/attachments/:id
APIキー

非公開の添付ファイルをダウンロードする

非公開の添付ファイルをダウンロードする

リクエスト
curl https://sendhq.cc/api/v1/attachments/id_value \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
DELETE/attachments/:id
APIキー

非公開の添付ファイルを削除する

非公開の添付ファイルを削除する

リクエスト
curl https://sendhq.cc/api/v1/attachments/id_value \
  -X DELETE \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 レスポンス
{
  "ok": true
}
GET/sending-identities
APIキー

検証済みの送信者IDを一覧表示する

検証済みの送信者IDを一覧表示する

リクエスト
curl https://sendhq.cc/api/v1/sending-identities \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 レスポンス
{
  "domains": [],
  "addresses": [],
  "localParts": []
}