API 레퍼런스

라벨 및 분류 규칙

발신 및 수신 메일을 자동 또는 수동으로 폴더에 정리합니다.

POST/emails/:id/labels
API 키

이메일에 라벨 추가 또는 제거

이름 또는 lbl_ ID로 라벨을 추가하고 제거합니다. `add`에 있는 알 수 없는 이름은 `create`가 false가 아닌 한 새로 생성됩니다. 이메일 한 통에는 라벨을 최대 10개까지 붙일 수 있습니다.

요청
curl https://sendhq.cc/api/v1/emails/id_value/labels \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"add":["Billing"],"remove":["Support"]}'
200 응답
{
  "id": "em_…",
  "labels": [
    {
      "id": "lbl_…",
      "name": "Billing",
      "color": "#188038"
    }
  ]
}
GET/labels
API 키

메시지 수와 분류 규칙이 포함된 라벨 목록 조회

메시지 수와 분류 규칙이 포함된 라벨 목록 조회

요청
curl https://sendhq.cc/api/v1/labels \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 응답
{
  "data": [],
  "count": 0,
  "mailbox": {
    "inboxUnread": 0,
    "updatesUnread": 0,
    "spamTotal": 0,
    "importantUnread": 0,
    "resortPending": 0
  }
}
POST/labels
API 키

라벨 생성(자동 분류 규칙 선택 지정 가능)

폴더 형태의 라벨을 생성합니다. `skip_inbox: true`를 설정하면 버킷이 됩니다. 이 라벨이 붙는 수신 메일(규칙, 해당 라벨로 보낸 대화에 대한 답장, 수동 추가 중 어느 경우든)은 보관 처리되어 라벨에만 표시되고 받은편지함에는 나타나지 않습니다. 선택 항목인 `rules`는 새로 발송하거나 수신한 메일을 자동으로 분류합니다. 규칙에 설정한 모든 조건(inbox_id, direction, 대소문자를 구분하지 않는 from/to/subject 부분 문자열)이 일치해야 합니다. 보관 중인 메일도 분류하려면 `apply_to_existing`을 설정하세요.

요청
curl https://sendhq.cc/api/v1/labels \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Agent/Orders","color":"#188038","skip_inbox":true,"rules":[{"inbox_id":"inb_…"}],"apply_to_existing":true}'
201 응답
{
  "id": "lbl_…",
  "name": "Agent/Orders",
  "color": "#188038",
  "skipInbox": true,
  "totalCount": 0,
  "unreadCount": 0,
  "rules": []
}
GET/labels/:id
API 키

ID 또는 이름으로 라벨 조회

ID 또는 이름으로 라벨 조회

요청
curl https://sendhq.cc/api/v1/labels/id_value \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 응답
{
  "id": "lbl_…",
  "name": "Billing",
  "color": "#188038",
  "skipInbox": false,
  "totalCount": 0,
  "unreadCount": 0,
  "rules": []
}
PATCH/labels/:id
API 키

라벨 이름 변경, 색상 변경 또는 버킷으로 전환

`name`, `color`, `skip_inbox`를 변경합니다. `skip_inbox`를 켜면 `apply_to_existing`이 false가 아닌 한 이미 라벨에 있는 수신 메일도 보관 처리됩니다.

요청
curl https://sendhq.cc/api/v1/labels/id_value \
  -X PATCH \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Finance/Billing","color":"#1a73e8","skip_inbox":true}'
200 응답
{
  "id": "lbl_…",
  "name": "Finance/Billing",
  "color": "#1a73e8",
  "skipInbox": true
}
DELETE/labels/:id
API 키

이메일은 삭제하지 않고 라벨만 삭제

이메일은 삭제하지 않고 라벨만 삭제

요청
curl https://sendhq.cc/api/v1/labels/id_value \
  -X DELETE \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 응답
{
  "ok": true
}
POST/labels/:id/rules
API 키

라벨에 자동 분류 규칙 추가

라벨에 자동 분류 규칙 추가

요청
curl https://sendhq.cc/api/v1/labels/id_value/rules \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"direction":"in","from":"@stripe.com","subject":"invoice","skip_inbox":true,"apply_to_existing":false}'
201 응답
{
  "id": "lrule_…",
  "labelId": "lbl_…",
  "direction": "in",
  "inboxId": null,
  "from": "@stripe.com",
  "to": null,
  "subject": "invoice",
  "skipInbox": true
}
DELETE/labels/:id/rules/:rule_id
API 키

자동 분류 규칙 삭제

자동 분류 규칙 삭제

요청
curl https://sendhq.cc/api/v1/labels/id_value/rules/rule_id_value \
  -X DELETE \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
200 응답
{
  "ok": true
}