Référence de l’API

Brouillons et pièces jointes

Construisez des parcours de rédaction avec un stockage privé des pièces jointes.

POST/drafts
Clé API

Créer un brouillon de rédaction

Créer un brouillon de rédaction

Requête
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"}'
Réponse 201
{
  "id": "dr_…",
  "attachments": []
}
GET/drafts
Clé API

Lister les brouillons de rédaction

Lister les brouillons de rédaction

Requête
curl https://sendhq.cc/api/v1/drafts \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
Réponse 200
{
  "data": [],
  "count": 0
}
GET/drafts/:id
Clé API

Récupérer un brouillon et ses pièces jointes

Récupérer un brouillon et ses pièces jointes

Requête
curl https://sendhq.cc/api/v1/drafts/id_value \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
Réponse 200
{
  "id": "dr_…",
  "attachments": []
}
PUT/drafts/:id
Clé API

Remplacer le contenu d’un brouillon

Remplacer le contenu d’un brouillon

Requête
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"}'
Réponse 200
{
  "id": "dr_…"
}
DELETE/drafts/:id
Clé API

Abandonner un brouillon

Abandonner un brouillon

Requête
curl https://sendhq.cc/api/v1/drafts/id_value \
  -X DELETE \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
Réponse 200
{
  "ok": true
}
POST/drafts/:id/attachments
Clé API

Téléverser une pièce jointe dans un brouillon

Téléversez les octets bruts du fichier. Définissez Content-Type et X-Filename. Un message peut contenir au maximum 10 fichiers et 10 Mo au total.

En-têtes facultatifsX-Filename
Requête
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
Réponse 201
{
  "id": "att_…",
  "filename": "invoice.pdf",
  "sizeBytes": 48231,
  "available": true
}
GET/attachments/:id
Clé API

Télécharger une pièce jointe privée

Télécharger une pièce jointe privée

Requête
curl https://sendhq.cc/api/v1/attachments/id_value \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
DELETE/attachments/:id
Clé API

Supprimer une pièce jointe privée

Supprimer une pièce jointe privée

Requête
curl https://sendhq.cc/api/v1/attachments/id_value \
  -X DELETE \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
Réponse 200
{
  "ok": true
}
GET/sending-identities
Clé API

Lister les identités d’envoi vérifiées

Lister les identités d’envoi vérifiées

Requête
curl https://sendhq.cc/api/v1/sending-identities \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
Réponse 200
{
  "domains": [],
  "addresses": [],
  "localParts": []
}