API 레퍼런스

호스팅 템플릿

재사용 가능한 콘텐츠를 초안 작성, 렌더링, 테스트, 버전 관리, 게시, 발송합니다.

GET/templates
API 키

호스팅 템플릿 목록 조회

호스팅 템플릿 목록 조회

쿼리 매개변수lifecyclequery
요청
curl https://sendhq.cc/api/v1/templates \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 응답
{
  "data": [],
  "count": 0
}
POST/templates
API 키

호스팅 템플릿 생성

호스팅 템플릿 생성

요청
curl https://sendhq.cc/api/v1/templates \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Account welcome","key":"account-welcome","starter":"welcome"}'
201 응답
{
  "template": {
    "id": "tmpl_…",
    "key": "account-welcome"
  }
}
GET/templates/:id
API 키

초안, 릴리스, 사용 현황 조회

초안, 릴리스, 사용 현황 조회

요청
curl https://sendhq.cc/api/v1/templates/id_value \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 응답
{
  "template": {
    "id": "tmpl_…"
  },
  "versions": [],
  "draft": null,
  "activeVersion": null,
  "usage": []
}
PUT/templates/:id/draft
API 키

템플릿 초안 자동 저장

템플릿 초안 자동 저장

요청
curl https://sendhq.cc/api/v1/templates/id_value/draft \
  -X PUT \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"revision":1,"name":"Account welcome","subjectTemplate":"Welcome, {{first_name}}","htmlTemplate":"<h1>Welcome, {{first_name}}</h1>","textTemplate":"Welcome, {{first_name}}","variables":[{"key":"first_name","type":"string","required":true}],"sampleData":{"first_name":"Asha"}}'
200 응답
{
  "draft": {
    "id": "tmplv_…",
    "revision": 2
  }
}
POST/templates/:id/draft
API 키

게시된 릴리스에서 새 초안 생성

게시된 릴리스에서 새 초안 생성

요청
curl https://sendhq.cc/api/v1/templates/id_value/draft \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
201 응답
{
  "draft": {
    "id": "tmplv_…",
    "revision": 1
  }
}
POST/templates/:id/render
API 키

서버가 실제로 출력하는 결과 렌더링

서버가 실제로 출력하는 결과 렌더링

요청
curl https://sendhq.cc/api/v1/templates/id_value/render \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data":{"first_name":"Asha"}}'
200 응답
{
  "subject": "Welcome, Asha",
  "html": "<h1>Welcome, Asha</h1>",
  "text": "Welcome, Asha",
  "findings": []
}
POST/templates/:id/test
API 키

테스트 스냅샷 발송

테스트 스냅샷 발송

요청
curl https://sendhq.cc/api/v1/templates/id_value/test \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":["owner@example.com"],"from":"hello@example.com","data":{"first_name":"Asha"}}'
201 응답
{
  "id": "em_…",
  "isTest": true
}
POST/templates/:id/publish
API 키

변경 불가능한 템플릿 릴리스 게시

변경 불가능한 템플릿 릴리스 게시

요청
curl https://sendhq.cc/api/v1/templates/id_value/publish \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
201 응답
{
  "version": {
    "id": "tmplv_…",
    "state": "published"
  }
}
POST/templates/:id/archive
API 키

템플릿 보관 처리

템플릿 보관 처리

요청
curl https://sendhq.cc/api/v1/templates/id_value/archive \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 응답
{
  "template": {
    "id": "tmpl_…",
    "lifecycle": "archived"
  }
}
POST/templates/:id/restore
API 키

보관된 템플릿 복원

보관된 템플릿 복원

요청
curl https://sendhq.cc/api/v1/templates/id_value/restore \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 응답
{
  "template": {
    "id": "tmpl_…",
    "lifecycle": "active"
  }
}