NAV
Shell

認証

以下のように Authorization ヘッダにセットしてください。

curl \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://*.relationapp.jp/..

<ACCESS_TOKEN> をアクセストークンに置き換えてください。

すべてのAPIの利用にアクセストークンが必要です。

Re:lation 画面左下ツールアイコン(システム設定)より、[API トークン] でアクセストークンを発行・確認することができます。

発行されたアクセストークンを Authorization ヘッダにセットしてください。 詳細は右のコードを参考にしてください。

アクセス制限(レートリミット)

アクセス制限関連ヘッダの具体例

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 1605233045

API は現在のところ1分あたり60回を上限としています。 API のレスポンスには、リクエスト制限情報を示す以下のヘッダが含まれます。

ヘッダ 内容
X-RateLimit-Limit 期間内(=1分)でリクエストできる最大回数
X-RateLimit-Remaining アクセスできる残り回数
X-RateLimit-Reset アクセス数がリセットされる時刻(unixtime)

文字コード

リクエストもレスポンスも文字コードは UTF-8 とします。

基本エンドポイント

https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

エラーレスポンス

レスポンスボディ(例)

{
  "message": "invalid token"
}
HTTP ステータスコード エラー内容
400 パラメータに誤りがある
401 アクセストークンが存在しない、または無効である
403 レートリミットを超えてアクセスしている
404 リソースまたはエンドポイントが存在しない
415 無効なフォーマット(Content-type に application/json が指定されていない)
500 サーバーエラー
503 メンテナンス中である

コンタクト (customer)

登録

curl -v -H "Content-type: application/json" \
 -H "Authorization: Bearer <ACCESS_TOKEN>" \
 -XPOST \
 https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/create \
 -d '{"last_name": "大阪", "first_name": "太郎",
  "last_name_kana": "おおさか", "first_name_kana": "たろう",
  "company_name": "株式会社インゲージ", "title": "執行役員",
  "url": "https://ingage.jp/", "gender_cd": 1,
  "emails":[
    { "email":"osaka@example.com" }
  ],
  "archived_emails":[
    { "email":"archived_osaka@example.com" }
  ],
  "tels":[
    { "tel": "09000000000" }
  ],
  "archived_tels":[
    { "tel": "09011111111" }
  ],
  "badge_ids":[
    1,
    2
  ],
  "system_id1": "EMP0001" }'

エンドポイント

POST https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/create

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
customer_group_id アドレス帳ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
last_name string
first_name string
last_name_kana string 姓ふりがな
first_name_kana string 名ふりがな
company_name string 会社名
department string 部署
title string 肩書き
postal_code string 郵便番号
region string 都道府県
city string 市区町村
address1 string 住所1
address2 string 住所2
gender_cd integer 性別
1: 男性、2: 女性、9: 不明。未指定の場合は自動的に 9 が設定されます。
url string URL
note string 自由テキスト
改行を含んでもよい。
system_id1 string 顧客コード
呼び出し元システムで一意となる文字列を想定。
なお、既に同じ顧客コードのアドレス帳が存在した場合は 400 Bad Request が返ります。
emails array[object] メールアドレス
JSON の構造に注意。最大6つまで指定可。
なお、既に同じメールアドレスを含むアドレス帳が存在した場合は 400 Bad Request が返ります。
archived_emails array[object] アーカイブメールするアドレス
JSON の構造に注意。最大6つまで指定可。
なお、既に同じメールアドレスを含むアドレス帳が存在した場合は 400 Bad Request が返ります。
tels array[object] 電話番号
JSON の構造に注意。最大3つまで指定可。
archived_tels array[object] アーカイブする電話番号
JSON の構造に注意。最大3つまで指定可。
badge_ids array[integer] バッジIDの配列
バッジを外す場合は空配列をセット。
custom_item1 string カスタム項目の1番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item2 string カスタム項目の2番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item3 string カスタム項目の3番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item4 string カスタム項目の4番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item5 string カスタム項目の5番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item6 string カスタム項目の6番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item7 string カスタム項目の7番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item8 string カスタム項目の8番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item9 string カスタム項目の9番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item10 string カスタム項目の10番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。

アドレス帳のカスタム項目については、マニュアルをご参照ください。

emails/archived_emails/tels/archived_tels の指定方法

:
"emails": [
  { "email": "abc@example.com" },
  { "email": "xyz@example.com" }
],
"archived_emails": [
  { "email": "efg@example.com" },
  { "email": "hij@example.com" }
],
"tels": [
  { "tel": "000-0000-0000" },
  { "tel": "1111111111" },
  { "tel": "222-222-2222" }
],
"archived_tels": [
  { "tel": "000-0000-1111" },
  { "tel": "1111112222" },
  { "tel": "222-222-3333" }
],
:

レスポンス

成功の場合、204 No Content が返ります。

レスポンスボディはありません。

更新 (system_id1 をキーに)

curl -v -H "Content-type: application/json" \
 -H "Authorization: Bearer <ACCESS_TOKEN>" \
 -XPUT \
 https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/system_id1/EMP0001 \
 -d '{"last_name": "大阪", "first_name": "太郎",
  "last_name_kana": "おおさか", "first_name_kana": "たろう",
  "company_name": "株式会社インゲージ", "title": "執行役員",
  "url": "https://ingage.jp/", "gender_cd": 1,
  "emails":[
    { "email":"osaka@example.com" }
  ],
  "archived_emails":[
    { "email":"archived_osaka@example.com" }
  ],
  "tels":[
    { "tel": "09000000000" }
  ],
  "archived_tels":[
    { "tel": "09011111111" }
  ],
  "badge_ids":[
    1,
    2
  ]}'

URI パラメータの system_id1 に指定された顧客コードをキーとし、Re:lation 内にレコードが存在した場合は上書き更新します。

エンドポイント

PUT https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/system_id1/<system_id1>

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
customer_group_id アドレス帳ID(数字)
system_id1 顧客コード

リクエストパラメータ (application/json)

名前 必須 内容
last_name string
first_name string
last_name_kana string 姓ふりがな
first_name_kana string 名ふりがな
company_name string 会社名
department string 部署
title string 肩書き
postal_code string 郵便番号
region string 都道府県
city string 市区町村
address1 string 住所1
address2 string 住所2
gender_cd integer 性別
1: 男性、2: 女性、9: 不明。
url string URL
note string 自由テキスト
改行を含んでもよい。
system_id1 string 顧客コード
呼び出し元システムで一意となる文字列を想定。
emails array[object] メールアドレス
JSON の構造に注意。最大6つまで指定可。
全て削除する場合は空配列をセット。
archived_emails array[object] アーカイブするメールアドレス
JSON の構造に注意。最大6つまで指定可。
全て削除する場合は空配列をセット。
tels array[object] 電話番号
JSON の構造に注意。最大3つまで指定可。
全て削除する場合は空配列をセット。
archived_tels array[object] アーカイブする電話番号
JSON の構造に注意。最大3つまで指定可。
全て削除する場合は空配列をセット。
badge_ids array[integer] バッジIDの配列
バッジを外す場合は空配列をセット。
custom_item1 string カスタム項目の1番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item2 string カスタム項目の2番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item3 string カスタム項目の3番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item4 string カスタム項目の4番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item5 string カスタム項目の5番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item6 string カスタム項目の6番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item7 string カスタム項目の7番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item8 string カスタム項目の8番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item9 string カスタム項目の9番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item10 string カスタム項目の10番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。

アドレス帳のカスタム項目については、マニュアルをご参照ください。

emails/archived_emails/tels/archived_tels の指定方法

:
"emails": [
  { "email": "abc@example.com" },
  { "email": "xyz@example.com" }
],
"archived_emails": [
  { "email": "efg@example.com" },
  { "email": "hij@example.com" }
],
"tels": [
  { "tel": "000-0000-0000" },
  { "tel": "1111111111" },
  { "tel": "222-222-2222" }
],
"archived_tels": [
  { "tel": "000-0000-1111" },
  { "tel": "1111112222" },
  { "tel": "222-222-3333" }
],
:

レスポンス

成功の場合、204 No Content が返ります。

レスポンスボディはありません。

更新 (email をキーに)

curl -v -H "Content-type: application/json" \
 -H "Authorization: Bearer <ACCESS_TOKEN>" \
 -XPUT \
 https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/email/osaka%40example.com \
 -d '{"last_name": "大阪", "first_name": "太郎",
  "last_name_kana": "おおさか", "first_name_kana": "たろう",
  "company_name": "株式会社インゲージ", "title": "執行役員",
  "url": "https://ingage.jp/", "gender_cd": 1,
  "emails":[
    { "email":"osaka@example.com" }
  ],
  "archived_emails":[
    { "email":"archived_osaka@example.com" }
  ],
  "tels":[
    { "tel": "09000000000" }
  ],
  "archived_tels":[
    { "tel": "09011111111" }
  ],
  "badge_ids":[
    1,
    2
  ],
  "system_id1": "EMP0001" }'

URI パラメータの email に指定されたメールアドレスをキーとし、Re:lation 内にレコードが存在した場合は上書き更新します。

エンドポイント

PUT https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/email/<email>

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
customer_group_id アドレス帳ID(数字)
email メールアドレス

リクエストパラメータ (application/json)

名前 必須 内容
last_name string
first_name string
last_name_kana string 姓ふりがな
first_name_kana string 名ふりがな
company_name string 会社名
department string 部署
title string 肩書き
postal_code string 郵便番号
region string 都道府県
city string 市区町村
address1 string 住所1
address2 string 住所2
gender_cd integer 性別
1: 男性、2: 女性、9: 不明。
url string URL
note string 自由テキスト
改行を含んでもよい。
system_id1 string 顧客コード
呼び出し元システムで一意となる文字列を想定。
emails array[object] メールアドレス
JSON の構造に注意。最大6つまで指定可。
全て削除する場合は空配列をセット。
archived_emails array[object] アーカイブするメールアドレス
JSON の構造に注意。最大6つまで指定可。
全て削除する場合は空配列をセット。
tels array[object] 電話番号
JSON の構造に注意。最大3つまで指定可。
全て削除する場合は空配列をセット。
archived_tels array[object] アーカイブする電話番号
JSON の構造に注意。最大3つまで指定可。
全て削除する場合は空配列をセット。
badge_ids array[integer] バッジIDの配列
バッジを外す場合は空配列をセット。
custom_item1 string カスタム項目の1番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item2 string カスタム項目の2番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item3 string カスタム項目の3番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item4 string カスタム項目の4番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item5 string カスタム項目の5番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item6 string カスタム項目の6番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item7 string カスタム項目の7番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item8 string カスタム項目の8番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item9 string カスタム項目の9番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。
custom_item10 string カスタム項目の10番目の値
カスタム項目が定義されていない場合には無視されます。文字数制限は200文字です。

アドレス帳のカスタム項目については、マニュアルをご参照ください。

emails/archived_emails/tels/archived_tels の指定方法

:
"emails": [
  { "email": "abc@example.com" },
  { "email": "xyz@example.com" }
],
"archived_emails": [
  { "email": "efg@example.com" },
  { "email": "hij@example.com" }
],
"tels": [
  { "tel": "000-0000-0000" },
  { "tel": "1111111111" },
  { "tel": "222-222-2222" }
],
"archived_tels": [
  { "tel": "000-0000-1111" },
  { "tel": "1111112222" },
  { "tel": "222-222-3333" }
],
:

レスポンス

成功の場合、204 No Content が返ります。

レスポンスボディはありません。

取得 (system_id1 をキーに)

curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
 https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/system_id1/EMP0001

以下のような JSON が返ります。

{
  "customer_id": 1,
  "last_name": "大阪",
  "first_name": "太郎",
  "last_name_kana": "おおさか",
  "first_name_kana": "たろう",
  "company_name": "株式会社インゲージ",
  "department": null,
  "title": "執行役員",
  "postal_code": null,
  "region": null,
  "city": null,
  "address1": null,
  "address2": null,
  "gender_cd": 1,
  "url": "https://ingage.jp/",
  "system_id1": "EMP0001",
  "note": null,
  "custom_item1": null,
  "custom_item2": null,
  "custom_item3": null,
  "custom_item4": null,
  "custom_item5": null,
  "custom_item6": null,
  "custom_item7": null,
  "custom_item8": null,
  "custom_item9": null,
  "custom_item10": null,
  "emails": [
    {
      "email": "osaka@example.com"
    }
  ],
  "archived_emails": [
    {
      "email": "archived_osaka@example.com"
    }
  ],
  "tels": [
    {
      "tel": "09000000000"
    }
  ],
  "archived_tels": [
    {
      "tel": "09000000001"
    }
  ],
  "badge_ids": [
    1,
    2
  ],
  "default_assignee": null
}

system_id1 に指定された顧客コードをキーとして、アドレス帳から1件取得します。

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/system_id1/<system_id1>

リクエストヘッダ

なし

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
customer_group_id アドレス帳ID(数字)
system_id1 顧客コード

レスポンス (application/json)

名前 必須 内容
customer_id integer 内部ID
last_name string
first_name string
last_name_kana string 姓ふりがな
first_name_kana string 名ふりがな
company_name string 会社名
department string 部署
title string 肩書き
postal_code string 郵便番号
region string 都道府県
city string 市区町村
address1 string 住所1
address2 string 住所2
gender_cd integer 性別
1: 男性、2: 女性、9: 不明
url string URL
system_id1 string 顧客コード
default_assignee string 担当者のメンション名
note string 自由テキスト
改行可。
emails array[object] メールアドレス
JSON の構造に注意。最大6つ。
archived_emails array[object] アーカイブするメールアドレス
JSON の構造に注意。最大6つ。
tels array[object] 電話番号
JSON の構造に注意。最大3つ。
archived_tels array[object] アーカイブする電話番号
JSON の構造に注意。最大3つ。
badge_ids array[integer] バッジIDの配列
custom_01 string カスタム項目の1番目の値
custom_02 string カスタム項目の2番目の値
custom_03 string カスタム項目の3番目の値
custom_04 string カスタム項目の4番目の値
custom_05 string カスタム項目の5番目の値
custom_06 string カスタム項目の6番目の値
custom_07 string カスタム項目の7番目の値
custom_08 string カスタム項目の8番目の値
custom_09 string カスタム項目の9番目の値
custom_10 string カスタム項目の10番目の値

アドレス帳のカスタム項目については、マニュアルをご参照ください。

emails, tels は以下のフォーマットで返ります。

:
"emails": [
  { "email": "abc@example.com" },
  { "email": "xyz@example.com" }
],
"archived_emails": [
  { "email": "efg@example.com" },
  { "email": "hij@example.com" }
],
"tels": [
  { "tel": "000-0000-0000" },
  { "tel": "1111111111" },
  { "tel": "222-222-2222" }
],
"archived_tels": [
  { "tel": "000-0000-1111" },
  { "tel": "1111112222" },
  { "tel": "222-222-3333" }
],
:

取得 (email をキーに)

curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
 https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/email/osaka%40example.com

以下のような JSON が返ります。

{
  "customer_id": 1,
  "last_name": "大阪",
  "first_name": "太郎",
  "last_name_kana": "おおさか",
  "first_name_kana": "たろう",
  "company_name": "株式会社インゲージ",
  "department": null,
  "title": "執行役員",
  "postal_code": null,
  "region": null,
  "city": null,
  "address1": null,
  "address2": null,
  "gender_cd": 1,
  "url": "https://ingage.jp/",
  "system_id1": "EMP0001",
  "note": null,
  "custom_item1": null,
  "custom_item2": null,
  "custom_item3": null,
  "custom_item4": null,
  "custom_item5": null,
  "custom_item6": null,
  "custom_item7": null,
  "custom_item8": null,
  "custom_item9": null,
  "custom_item10": null,
  "emails": [
    {
      "email": "osaka@example.com"
    }
  ],
  "archived_emails": [
    {
      "email": "archived_osaka@example.com"
    }
  ],
  "tels": [
    {
      "tel": "09000000000"
    }
  ],
  "archived_tels": [
    {
      "tel": "09000000001"
    }
  ],
  "badge_ids": [
    1,
    2
  ],
  "default_assignee": null
}

email に指定されたメールアドレスをキーとして、アドレス帳から1件取得します。

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/email/<email>

リクエストヘッダ

なし

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
customer_group_id アドレス帳ID(数字)
email メールアドレス

レスポンス (application/json)

名前 必須 内容
customer_id integer 内部ID
last_name string
first_name string
last_name_kana string 姓ふりがな
first_name_kana string 名ふりがな
company_name string 会社名
department string 部署
title string 肩書き
postal_code string 郵便番号
region string 都道府県
city string 市区町村
address1 string 住所1
address2 string 住所2
gender_cd integer 性別
1: 男性、2: 女性、9: 不明
url string URL
system_id1 string 顧客コード
default_assignee string 担当者のメンション名
note string 自由テキスト
改行可。
emails array[object] メールアドレス
JSON の構造に注意。最大6つ。
archived_emails array[object] アーカイブするメールアドレス
JSON の構造に注意。最大6つ。
tels array[object] 電話番号
JSON の構造に注意。最大3つ。
archived_tels array[object] アーカイブする電話番号
JSON の構造に注意。最大3つ。
badge_ids array[integer] バッジIDの配列
custom_01 string カスタム項目の1番目の値
custom_02 string カスタム項目の2番目の値
custom_03 string カスタム項目の3番目の値
custom_04 string カスタム項目の4番目の値
custom_05 string カスタム項目の5番目の値
custom_06 string カスタム項目の6番目の値
custom_07 string カスタム項目の7番目の値
custom_08 string カスタム項目の8番目の値
custom_09 string カスタム項目の9番目の値
custom_10 string カスタム項目の10番目の値

アドレス帳のカスタム項目については、マニュアルをご参照ください。

emails, tels は以下のフォーマットで返ります。

:
"emails": [
  { "email": "abc@example.com" },
  { "email": "xyz@example.com" }
],
"archived_emails": [
  { "email": "efg@example.com" },
  { "email": "hij@example.com" }
],
"tels": [
  { "tel": "000-0000-0000" },
  { "tel": "1111111111" },
  { "tel": "222-222-2222" }
],
"archived_tels": [
  { "tel": "000-0000-1111" },
  { "tel": "1111112222" },
  { "tel": "222-222-3333" }
],

削除 (system_id1 をキーに)

curl -X DELETE -H 'Authorization: Bearer <ACCESS_TOKEN>' \
 https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/system_id1/EMP0001

system_id1 に指定された顧客コードをキーとして、アドレス帳から1件削除します。

エンドポイント

DELETE https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/system_id1<system_id1>

リクエストヘッダ

なし

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
customer_group_id アドレス帳ID(数字)
system_id1 顧客コード

レスポンス

成功の場合、204 No Content が返ります。

レスポンスボディはありません。

削除 (email をキーに)

curl -X DELETE -H 'Authorization: Bearer <ACCESS_TOKEN>' \
 https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/email/osaka%40example.com

email に指定されたメールアドレスをキーとして、アドレス帳から1件削除します。

エンドポイント

DELETE https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/customers/email/<email>

リクエストヘッダ

なし

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
customer_group_id アドレス帳ID(数字)
email メールアドレス

レスポンス

成功の場合、204 No Content が返ります。

レスポンスボディはありません。

アドレス帳 (customer_group)

一覧取得

curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
 https://<subdomain>.relationapp.jp/api/v2/customer_groups

以下のような JSON が返ります。

[
  {
    "customer_group_id": 1,
    "name": "アドレス帳1",
    "message_box_ids": [1],
    "last_updated_at": "2024-01-05T13:31:56Z"
  },
  {
    "customer_group_id": 2,
    "name": "アドレス帳2",
    "message_box_ids": [1, 2],
    "last_updated_at": "2024-01-12T16:07:26Z"
  },
  {
    "customer_group_id": 3,
    "name": "アドレス帳3",
    "message_box_ids": [],
    "last_updated_at": "2024-01-12T16:07:22Z"
  }
]

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/customer_groups

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン

レスポンス (application/json)

名前 必須 内容
customer_group_id integer アドレス帳ID
name string アドレス帳名
message_box_ids array[integer] 紐づいている受信箱IDの配列
last_updated_at string 更新日時(ISO 8601 形式)

チケット (ticket)

チケットのリクエストやレスポンスで使われる文字列

ステータスや色などは、文字列で指定し、また文字列で返ります。ここでは、使える文字列について列挙します。

ステータス (status_cd, status_cds)

文字列 意味
open 未対応
ongoing 保留
closed 対応完了
unwanted 対応不要
trash ゴミ箱
spam 迷惑メール

色 (color_cd, color_cds)

文字列 意味
red
orange オレンジ
yellow 黄色
blue
pink ピンク

種別(チャネル) (method_cd, method_cds)

文字列 意味
mail メール
tweet ツイート
twitter_dm Twitter DM
record 応対メモ
line LINE
chatplus ChatPlus
r_messe R-Messe
yahoo Yahoo!ショッピング
sms SMS
call 通話メモ

メッセージの状態 (action_cd, action_cds)

文字列 意味
received 受信
sent 送信済み
draft 下書き
requested 承認依頼
approved 承認済み
rejected 差し戻し
sending 送信中
scheduled 予約済み
send_error 送信エラー
conversation チャット中
end_conversation チャット終了

応対種別 (icon_cd)

文字列 意味
received_phone 受電
called_phone 架電
meeting 会議
sales 営業
postal 郵便物
note その他

コメントの種類 (comment_type)

文字列 意味
comment コメント
request 承認依頼
approve 承認
reject 差戻し
pullback 承認依頼キャンセル
assign 担当者設定
snooze スヌーズ
canceled_snooze スヌーズ(キャンセル済み)
curl -XPOST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/tickets/search \
  -d '{"status_cds":["open"]}'

以下のような JSON が返ります。

[
  {
    "ticket_id": 12,
    "assignee": null,
    "status_cd": "open",
    "created_at": "2020-10-23T05:07:25Z",
    "last_updated_at": "2020-10-23T05:07:25Z",
    "title": "subj9",
    "color_cd": null,
    "case_category_ids": [1, 2],
    "label_ids": [1, 2]
  },
  {
    "ticket_id": 10,
    "assignee": null,
    "status_cd": "open",
    "created_at": "2020-10-23T01:57:55Z",
    "last_updated_at": "2020-10-23T02:55:01Z",
    "title": "subj2",
    "color_cd": null,
    "case_category_ids": [],
    "label_ids": []
  }
]

いくつかの条件でチケットを検索し、新しいものから最大50件を返します。キーワード検索はできません。
ページネーションがあり、1ページの表示最大件数は50件までです。

エンドポイント

POST https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/tickets/search

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
ticket_ids array[integer] チケットID
配列で複数指定可。
label_ids array[integer] ラベルID
こちらからご取得いただけます。
配列で複数指定可。
複数指定時の条件は AND 検索となります。
status_cds array[string] ステータス
以下の中から指定。
配列で複数指定可。
color_cds array[string]
以下の中から指定。
配列で複数指定可。
assignee string 担当者のメンション名
message_ids array[integer] メッセージID
配列で複数指定可。メールの Message-Id: とは無関係。
has_attachments boolean true の場合、添付ファイルありを検索
method_cds array[string] チャンネル
以下の中から指定
配列で複数指定可。
action_cds array[string] メッセージの状態
以下の中から指定。
配列で複数指定可。
since string メッセージの送信日時の開始。
ISO 8601 形式。
until string メッセージの送信日時の終了。
ISO 8601 形式。
date string メッセージの送信日時の終了。
ISO 8601 形式。
within string メッセージの送信日時の期間。
1days〜99days または 1months〜99months が指定可能。
per_page integer 1ページに表示する件数(デフォルト: 50, 最大値: 50)
page integer ページ番号(デフォルト: 1)

since と until を使うと、メッセージの送信日時が since と until の間にあるチケットを検索できます。

date と within を使うと、date の時刻部分は無視され、メッセージの送信日時が date から within 日前までの間にあるチケットを検索できます。

label_ids に [-1] を指定すると、ラベルなしを検索できます。

color_cds に [""] (空文字列) を指定すると、色なしを検索できます。

assignee に "" (空文字列) を指定すると、担当者なしを検索できます。

レスポンス (application/json)

以下を配列で最大50件返します。

名前 必須 内容
ticket_id integer チケットID
assignee string 担当者のメンション名
status_cd string ステータス
created_at string 作成日時
ISO 8601 形式
last_updated_at string 最終更新日時
ISO 8601 形式
title string タイトル
color_cd string
case_category_ids array[integer] チケット分類のIDの配列
label_ids array[integer] ラベルのIDの配列

チケット1件取得

curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/tickets/12

以下のような JSON が返ります。

{
  "ticket_id": 12,
  "assignee": "admin",
  "status_cd": "closed",
  "created_at": "2020-10-23T05:07:25Z",
  "last_updated_at": "2020-11-13T01:39:38Z",
  "title": "応対メモ",
  "color_cd": null,
  "messages": [
    {
      "message_id": 31,
      "from": null,
      "to": null,
      "cc": null,
      "bcc": null,
      "sent_at": "2020-11-13T01:39:22Z",
      "title": "応対メモ",
      "body": "<div>これは応対メモです。</div>\n<div>&nbsp;</div>",
      "method_cd": "record",
      "action_cd": "sent",
      "is_html": true,
      "created_at": "2020-11-13T01:39:26Z",
      "last_updated_at": "2020-11-13T01:39:38Z",
      "comments": [
        {
          "commenter": "y.suzuki",
          "comment_type": "request",
          "comment": "承認よろしくお願いします。",
          "commented_at": "2020-11-13T00:30:12Z"
        },
        {
          "commenter": "k.watanabe",
          "comment_type": "approve",
          "comment": "承認しましたので送信してくたさい。",
          "commented_at": "2020-11-13T00:44:35Z"
        }
      ],
      "attachments": [
        {
          "attachment_id": 13,
          "file_name": "ProductCatalog_2023.xlsx"
        },
        {
          "attachment_id": 16,
          "file_name": "チーム会議_議事録_2023_08_01.txt"
        }
      ]
    },
    {
      "message_id": 28,
      "from": null,
      "to": null,
      "cc": null,
      "bcc": null,
      "sent_at": "2020-10-23T03:00:00Z",
      "title": "subj9",
      "body": "body9",
      "method_cd": "record",
      "action_cd": "sent",
      "is_html": false,
      "created_at": "2020-10-23T05:07:25Z",
      "last_updated_at": "2020-10-23T05:07:25Z",
      "comments": [],
      "attachments": []
    }
  ],
  "case_category_ids": [1, 2],
  "label_ids": [1, 2]
}

チケットを1件取得します。

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/tickets/<ticket_id>

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)
ticket_id チケットID(数字)

レスポンス (application/json)

名前 必須 意味
ticket_id integer チケットID
assignee string 担当者のメンション名
status_cd string ステータス
created_at string 作成日時
ISO 8601 形式。
last_updated_at string 最終更新日時
ISO 8601 形式。
title string タイトル
color_cd string
messages array[object] メッセージの配列
case_category_ids array[integer] チケット分類IDの配列
label_ids array[integer] ラベルIDの配列

messages(メッセージの配列)は以下の配列です。

名前 必須 意味
message_id integer メッセージID
メールの Message-Id: とは無関係。
from string メールの From:
to string メールの To:
cc string メールの Cc:
bcc string メールの Bcc:
sent_at string 送信日時
ISO 8601 形式。
title string 件名
body string 本文
method_cd string チャンネル
action_cd string メッセージの状態
is_html boolean HTML かどうか
created_at string 作成日時
ISO 8601 形式。
last_updated_at string 最終更新日時
ISO 8601 形式。
comments array[object] コメントの配列
attachments array[object] 添付ファイルの配列

from, to の内容はチャンネルによります。

comments(コメントの配列)は以下の配列です。

名前 必須 意味
commenter string コメント投稿者のメンション名
comment_type string コメントの種類
comment string コメント内容
commented_at string コメント日時
ISO 8601 形式。

attachments(添付ファイルの配列)は以下の配列です。

名前 必須 意味
attachment_id integer 添付ファイルID
(メッセージ添付ファイル取得 API で使用)
file_name string ファイル名

応対メモ作成

curl -XPOST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/records \
  -d '{"subject":"応対メモ","status_cd":"open",
       "operated_at":"2020-11-13T10:34:56+09:00","operator":"admin",
       "duration":300,"body":"応対メモ本文","icon_cd":"sales"}'

以下のような JSON が返ります。

{
  "message_id": 33,
  "ticket_id": 16
}

応対メモを作成します。既存チケット内、または新規チケットとして作成します。

エンドポイント

POST https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/records

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
ticket_id integer チケットID
subject string 件名
status_cd string ステータス
省略時、closed。
operated_at string 応対日時
ISO 8601 形式。過去の日時のみ。
operator string 応対者のメンション名。
duration integer 応対時間
0〜1440の数値。分単位。
body string 本文
customer_email string 顧客メールアドレス
customer_tel string 顧客電話番号
icon_cd string 応対種別
省略時、received_phone。
is_html boolean HTML かどうか
省略時は false。
assignee string 新規チケットとして登録された場合の担当者のメンション名。

ticket_id を指定した場合、そのチケット内に作成されます。 ticket_id を省略した場合、新規チケットとなります。

レスポンス (application/json)

名前 必須 意味
message_id integer メッセージID
メールの Message-Id: とは無関係。
ticket_id integer チケットID

更新

curl -H "Content-Type: application/json" \
 -H "Authorization: Bearer <ACCESS_TOKEN>" \
 -X PUT \
 https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/tickets/1 \
 -d '{
  "status_cd": "ongoing",
  "pending_reason_id": 1,
  "snooze_time": "2021-01-05T13:31:56+09:00",
  "snooze_comment": "snooze comment.",
  "notification_mention_name": "notification mention name",
  "label_ids": [1,2],
  "assignee": "mention name",
  "approval_required": true,
  "assign_comment": "assign comment",
  "color_cd": "red",
  "case_category_ids": [1,2]
}'

設定解除サンプル

curl -H "Content-type: application/json" \
 -H "Authorization: Bearer <ACCESS_TOKEN>" \
 -X PUT \
 https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/tickets/1 \
 -d '{
  "status_cd": "ongoing",
  "pending_reason_id": null,
  "label_ids": [],
  "assignee": null,
  "color_cd": null,
  "case_category_ids": []
}'

URI パラメータの ticket_id に指定された id をキーとし、Re:lation 内にレコードが存在した場合は上書き更新します。

エンドポイント

PUT https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/tickets/<ticket_id>

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)
ticket_id チケットID

リクエストパラメータ (application/json)

名前 必須 内容
status_cd string ステータス
pending_reason_id integer 保留理由ID
こちらからご取得いただけます。
snooze_term string スヌーズから復帰する日時(定義済み)
snooze_time string スヌーズから復帰する日時(任意設定)
ISO 8601 形式
snooze_comment string スヌーズのコメント
文字数制限は1000文字
notification_mention_name string スヌーズ復帰時に通知するユーザのメンション名
スヌーズのコメントが通知されます
label_ids array[integer] ラベルIDの配列
こちらからご取得いただけます。
ラベルを外す場合は空配列をセット
assignee string 担当者のメンション名
こちらからご取得いただけます。
担当者を外す場合はnullをセット
approval_required boolean 送信操作で上長の承認を必須とするか (要承認)
省略時は false
assign_comment string 担当者設定時のコメント
担当者をセットした場合、セット可
文字数制限は1000文字
color_cd string
色を外す場合はnullをセット
case_category_ids array[integer] チケット分類IDの配列
こちらからご取得いただけます。
チケット分類を外す場合は空配列をセット
ticket classificationsとエラーメッセージに表示されることがありますが本項目のことです

ステータス保留にする場合に利用可能なパラメータと機能

・保留理由IDについて

ステータスを保留にする場合、保留理由IDを設定することができます。
保留理由一覧取得APIより取得したIDをセットしてください。
セットしない場合、保留理由なしが設定されます。

・スヌーズの設定について

スヌーズを設定すると、設定されている日時で未対応チケットになります。
保留理由にスヌーズが設定されている場合(保留理由一覧取得APIから取得した保留理由の is_snoozedtrue)、スヌーズから復帰する日時を設定できます。
スヌーズから復帰する日時の設定方法は2種類あります。設定しない場合、保留理由のデフォルトスヌーズ時間が設定されます。

・snooze_term を使用した設定

スヌーズから復帰する日時(定義済み)をセットしてください。

・snooze_time を使用した設定

ISO 8601 形式の任意の日時をセットしてください。

・スヌーズ時のコメントについて

スヌーズを設定する場合、コメントを設定することができます。 snooze_commentにコメントをセットしてください。

・スヌーズ復帰時の通知について

notification_mention_nameに通知したいユーザのメンション名を設定すると、復帰時にコメントの内容と共に通知できます。

レスポンス

成功の場合、204 No Content が返ります。

レスポンスボディはありません。

受信箱 (message_box)

受信箱一覧取得

curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
 https://<subdomain>.relationapp.jp/api/v2/message_boxes

以下のような JSON が返ります。

[
  {
    "name": "受信箱1",
    "color": "green",
    "message_box_id": 1,
    "last_updated_at": "2021-01-05T13:31:56Z",
    "customer_group_id": 1,
  },
  {
    "name": "受信箱2",
    "color": "orange",
    "message_box_id": 2,
    "last_updated_at": "2021-01-12T16:07:26Z",
    "customer_group_id": 2,
  },
  {
    "name": "受信箱3",
    "color": "blue",
    "message_box_id": 3,
    "last_updated_at": "2021-01-12T16:07:22Z",
    "customer_group_id": 3,
  }
]

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/message_boxes

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン

レスポンス (application/json)

名前 必須 内容
message_box_id integer 受信箱ID
name string 受信箱名
color string 受信箱の色 (red, orange, green, blue, purple, brown)
last_updated_at string 更新日時
(ISO 8601 形式)
customer_group_id integer アドレス帳ID

保留理由 (pending_reason)

リクエストやレスポンスで使われる文字列

スヌーズから復帰する日時(定義済み)は文字列で返ります。ここでは使える文字列について列挙します。

スヌーズから復帰する日時(定義済み)

文字列 意味
no_term 設定なし
today 今日の17時
tomorrow 明日の8時
weekend 今週末の8時
next_monday 来週月曜の8時
next_week 1週間後の8時
next_month 来月1日の8時
after_month 1ヶ月後の8時

保留理由一覧取得

curl -X GET \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/pending_reasons

以下のような JSON が返ります。

[
  {
    "name": "スヌーズ中",
    "snooze_term": "today",
    "pending_reason_id": 1,
    "is_snoozed": true
  },
  {
    "name": "確認待ち",
    "snooze_term": "no_term",
    "pending_reason_id": 2,
    "is_snoozed": false
  }
]

画面上のソート順に返します。出力上限および検索条件やページネーションはありません。

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/pending_reasons

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

レスポンス (application/json)

以下を配列で返します。

名前 必須 内容
pending_reason_id integer 保留理由ID
name string 保留理由名
is_snoozed boolean スヌーズするかどうか
snooze_term string スヌーズから復帰する日時(定義済み)

ユーザー (user)

レスポンスで使われる文字列

ユーザ状態は文字列で返ります。ここでは使われる文字列について列挙します。

ユーザ状態 (status_cd)

文字列 意味
available 有効
confirming 本登録処理中
locked アカウントロック中
deleted 削除済み

ユーザー一覧取得

curl -X GET \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  https://<subdomain>.relationapp.jp/api/v2/users

以下のような JSON が返ります。

[
  {
    "mention_name": "taro",
    "status_cd": "available",
    "first_name": "太郎",
    "last_name" : "大阪",
    "department_name": "本社",
    "employee_no": "100001",
    "email": "abc@example.com",
    "is_tenant_admin": true,
    "is_otp_required": false,
    "last_page_loaded_at": "2024-01-09T05:18:36Z",
  },
  {
    "mention_name": "hanako",
    "status_cd": "available",
    "first_name": "花子",
    "last_name" : "梅田",
    "department_name": "本社",
    "employee_no": "100002",
    "email": "efg@example.com",
    "is_tenant_admin": false,
    "is_otp_required": true,
    "last_page_loaded_at": "2024-01-09T05:20:36Z",
  }
]

登録順に返します。 ページネーションがあり、1ページに表示できる最大件数は100件です。

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/users

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン

リクエストパラメータ (application/json)

名前 必須 内容
per_page integer 1ページに表示する件数(デフォルト30, 最大値: 100)
page integer ページ番号(デフォルト1)

レスポンス (application/json)

以下を配列で返します。

名前 必須 内容
mention_name string メンション名
status_cd string ユーザ状態
first_name string
last_name string
department_name string 部署名
employee_no string 社員番号
email string メールアドレス
is_tenant_admin boolean テナント管理者かどうか
is_otp_required boolean 多要素認証が有効かどうか
last_page_loaded_at string 最終アクセス日時
ISO 8601 形式

チケット分類 (case_category)

チケット分類一覧取得

curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/case_categories

以下のような JSON が返ります。

[
  {
    "case_category_id": 1,
    "name": "お問い合わせ",
    "parent_id": null,
    "archived": false
  },
  {
    "case_category_id": 2,
    "name": "お問い合わせ > 顧客",
    "parent_id": 1,
    "archived": true
  },
  {
    "case_category_id": 3,
    "name": "お問い合わせ > 顧客 > メール",
    "parent_id": 2,
    "archived": true
  },
  {
    "case_category_id": 4,
    "name": "取引先",
    "parent_id": null,
    "archived": true
  }
]

チケット分類の一覧を取得します。
ページネーションがあり、1ページの表示最大件数は100件までです。

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/case_categories

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
per_page integer 1ページに表示する件数(デフォルト: 30, 最大値: 100)
page integer ページ番号(デフォルト: 1)
curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/case_categories?page=2&per_page=3

以下のような JSON が返ります。

[
  {
    "case_category_id": 4,
    "name": "お問い合わせ",
    "parent_id": null,
    "archived": false
  },
  {
    "case_category_id": 5,
    "name": "お問い合わせ > 顧客",
    "parent_id": 4,
    "archived": true
  },
  {
    "case_category_id": 6,
    "name": "お問い合わせ > 顧客 > メール",
    "parent_id": 5,
    "archived": true
  }
]

レスポンス (application/json)

以下を配列で返します。

名前 必須 内容
case_category_id integer チケット分類ID
name string チケット分類名( 親 > 子 > 孫 の形式で表記)
parent_id integer 親チケット分類ID
archived boolean アーカイブされているかどうか

チケット分類登録

curl -v -H "Content-type: application/json" \
 -H "Authorization: Bearer <ACCESS_TOKEN>" \
 -XPOST \
 https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/case_categories \
 -d '{"name": "チケット分類の名前", "parent_id": 1}'

以下のような JSON が返ります。

{
  "case_category_id": 1
}

受信箱にチケット分類を作成します。

エンドポイント

POST https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/case_categories

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
name string チケット分類名(最大値: 255文字)
parent_id integer 親となるチケット分類のID
自身が1階層目の場合は不要
アーカイブされたチケット分類のIDは指定不可

レスポンス (application/json)

名前 必須 意味
case_category_id integer チケット分類ID

チケット分類更新

curl -v -H "Content-type: application/json" \
 -H "Authorization: Bearer <ACCESS_TOKEN>" \
 -XPUT \
 https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/case_categories/1 \
 -d '{"name": "チケット分類の名前", "parent_id": 1, "archived": true }'

受信箱のチケット分類を更新します。

エンドポイント

PUT https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/case_categories/<case_category_id>

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)
case_category_id チケット分類ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
name string チケット分類名(最大値: 255文字)
parent_id integer 親となるチケット分類のID
自身が1階層目の場合は不要
親をなしにしたい場合、nullを渡してください
archived boolean アーカイブするかどうか

レスポンス (application/json)

成功の場合、204 No Content が返ります。

レスポンスボディはありません。

ラベル (label)

ラベルのリクエストやレスポンスで使われる文字列

色 (color)

(色)_(明度) の形式で表されます。(例: gray_01, red_03
明度は 0104 まであり、01 が明るく 04 が暗い色であることを示します。
色の一覧は以下のとおりです。

文字列 意味
gray グレー
brown 茶色
red
orange オレンジ
green
blue
purple

ラベル一覧取得

curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/labels

以下のような JSON が返ります。

[
  {
    "label_id": 1,
    "name": "お問い合わせ",
    "color": "red_01",
    "parent_id": null
  },
  {
    "label_id": 2,
    "name": "お問い合わせ/顧客",
    "color": "red_02",
    "parent_id": 1
  },
  {
    "label_id": 3,
    "name": "お問い合わせ/顧客/メール",
    "color": "red_03",
    "parent_id": 2
  },
  {
    "label_id": 4,
    "name": "取引先",
    "color": "green_01",
    "parent_id": null
  }
]

ラベルの一覧を取得します。
ページネーションがあり、1ページの表示最大件数は100件までです。

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/labels

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
per_page integer 1ページに表示する件数(デフォルト: 30, 最大値: 100)
page integer ページ番号(デフォルト: 1)
curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/labels?page=2&per_page=3

以下のような JSON が返ります。

[
  {
    "label_id": 1,
    "name": "お問い合わせ",
    "color": "red_01",
    "parent_id": null
  },
  {
    "label_id": 2,
    "name": "お問い合わせ/顧客",
    "color": "red_02",
    "parent_id": 1
  },
  {
    "label_id": 3,
    "name": "お問い合わせ/顧客/メール",
    "color": "red_03",
    "parent_id": 2
  }
]

レスポンス (application/json)

以下を配列で返します。

名前 必須 内容
label_id integer ラベルID
name string ラベル名( 親/子/孫 の形式で表記)
color string
parent_id integer 親ラベルID

ラベル登録

curl -v -H "Content-type: application/json" \
 -H "Authorization: Bearer <ACCESS_TOKEN>" \
 -XPOST \
 https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/labels \
 -d '{"name": "ラベルの名前", "color": "gray_01", "parent_id": 1}'

以下のような JSON が返ります。

{
  "label_id": 1
}

受信箱にラベルを作成します。

エンドポイント

POST https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/labels

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
name string ラベル名(最大値: 255文字)
color string
parent_id integer 親となるラベルのID
自身が親の場合は不要

レスポンス (application/json)

名前 必須 意味
label_id integer 作成されたラベルID

ラベル更新

受信箱のラベルを更新します。

curl -v -H "Content-type: application/json" \
 -H "Authorization: Bearer <ACCESS_TOKEN>" \
 -XPUT \
 https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/labels/<label_id> \
 -d '{"name": "ラベルの名前", "color": "gray_01", "parent_id": 1}'

エンドポイント

PUT https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/labels/<label_id>

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)
label_id ラベルID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
name string ラベル名(最大値: 255文字)
color string
parent_id integer 親となるラベルのID

レスポンス (application/json)

成功の場合、204 No Content が返ります。

レスポンスボディはありません。

バッジ (badge)

バッジ一覧取得

curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp//api/v2/customer_groups/<customer_group_id>/badges

以下のような JSON が返ります。

[
  {
    "badge_id": 1,
    "name": "VIP"
  },
  {
    "badge_id": 2,
    "name": "要注意",
  }
]

バッジの一覧を取得します。
ページネーションがあり、1ページの表示最大件数は100件までです。

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/badges

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
customer_group_id アドレス帳ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
per_page integer 1ページに表示する件数(デフォルト: 30, 最大値: 100)
page integer ページ番号(デフォルト: 1)
curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp/api/v2/customer_groups/<customer_group_id>/badges?page=2&per_page=3

以下のような JSON が返ります。

[
  {
    "badge_id": 1,
    "name": "VIP"
  },
  {
    "badge_id": 2,
    "name": "要注意",
  }
]

レスポンス (application/json)

以下を配列で返します。

名前 必須 内容
badge_id integer バッジID
name string バッジ名

送信メール設定 (mail_account)

送信メール設定一覧取得

curl -X GET \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/mail_accounts

以下のような JSON が返ります。

[
  {
    "mail_account_id": 1,
    "name": "カスタマーサポートセンター",
    "email": "info1@example.com"
  },
  {
    "mail_account_id": 2,
    "name": "株式会社xxx",
    "email": "info2@example.com"
  },
  {
    "mail_account_id": 3,
    "name": "xxx CO.,LTD",
    "email": "info3@example.com"
  },
  {
    "mail_account_id": 4,
    "name": "お客様対応窓口",
    "email": "info4@example.com"
  }
]

画面上のソート順に返します。
ページネーションがあり、1ページに表示できる最大件数は100件です。

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/mail_accounts

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
per_page integer 1ページに表示する件数(デフォルト30, 最大値: 100)
page integer ページ番号(デフォルト1)
curl -X GET \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/mail_accounts?page=2&per_page=3

以下のような JSON が返ります。

[
  {
    "mail_account_id": 4,
    "name": "カスタマーサポートセンター",
    "email": "info1@example.com"
  },
  {
    "mail_account_id": 5,
    "name": "株式会社xxx",
    "email": "info2@example.com"
  },
  {
    "mail_account_id": 6,
    "name": "xxx CO.,LTD",
    "email": "info3@example.com"
  }
]

レスポンス (application/json)

以下を配列で返します。

名前 必須 内容
mail_account_id integer メールアカウントID
name string メールアカウント名
email string メールアカウントEmail

メール

メール送信

TEXT 形式・ステータス:未対応のサンプル

curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/mails \
  -d '{"status_cd":"open",
       "mail_account_id":1,
       "to":"abc@example.com","cc":"def@example.com","bcc":"ghi@example.com",
       "subject":"メール送信件名","body":"メール送信本文です。\n2行目\n3行目","is_html":false}'

以下のような JSON が返ります。

{
    "message_id": 111,
    "ticket_id": 222
}

HTML 形式・ステータス:保留のサンプル

curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/mails \
  -d '{"status_cd":"ongoing","pending_reason_id":1,"mail_account_id":1,
       "to":"abc@example.com, def@example.com",
       "cc":"ghi@example.com,jkl@example.com","bcc":"mno@example.com, pqr@example.com",
       "subject":"メール送信件名","body":"<p>メール送信本文です。</p><p>2行目<br>3行目</p>","is_html":true}'

以下のような JSON が返ります。

{
    "message_id": 111,
    "ticket_id": 222
}

メールを送信し、新規チケットを作成します。

エンドポイント

POST https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/mails

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
status_cd integer ステータス
pending_reason_id integer 保留理由ID
こちらからご取得いただけます。
mail_account_id integer メールアカウントID
こちらからご取得いただけます。
to string メールの To:
cc string メールの Cc:
bcc string メールの Bcc:
subject string 件名
body string 本文
is_html boolean HTML かどうか

保留理由IDを設定する場合は、ステータス「ongoing」を設定してください。
保留理由にスヌーズが設定されていた場合、その初期値に設定されている日時でスヌーズから復帰します。

レスポンス (application/json)

名前 必須 内容
message_id integer メッセージID
メールの Message-Id: とは無関係。
ticket_id integer チケットID

メール返信

TEXT 形式・ステータス:未対応のサンプル

curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/mails/reply \
  -d '{"message_id":1,
       "status_cd":"open",
       "mail_account_id":1,
       "to":"abc@example.com","cc":"efg@example.com","bcc":"ghi@example.com",
       "subject":"メール送信件名","body":"メール送信本文です。\n2行目\n3行目","is_html":false}'

以下のような JSON が返ります。

{
    "message_id": 111,
    "ticket_id": 222
}

HTML 形式・ステータス:保留のサンプル

curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/mails/reply \
  -d '{"message_id":1,"status_cd":"ongoing",
       "pending_reason_id":1,"mail_account_id":1,
       "to":"abc@example.com, def@example.com",
       "cc":"ghi@example.com,jkl@example.com","bcc":"mno@example.com, pqr@example.com",
       "subject":"メール送信件名","body":"<p>メール送信本文です。</p><p>2行目<br>3行目</p>","is_html":true}'

以下のような JSON が返ります。

{
    "message_id": 111,
    "ticket_id": 222
}

メールを返信し、メッセージを作成します。

エンドポイント

POST https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/mails/reply

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
message_id integer 返信したいメッセージのID
status_cd integer ステータス
pending_reason_id integer 保留理由ID
こちらからご取得いただけます。
mail_account_id integer メールアカウントID
こちらからご取得いただけます。
to string メールの To:
cc string メールの Cc:
bcc string メールの Bcc:
subject string 件名
body string 本文
is_html boolean HTML かどうか

保留理由IDを設定する場合は、ステータス「ongoing」を設定してください。
保留理由にスヌーズが設定されていた場合、その初期値に設定されている日時でスヌーズから復帰します。

レスポンス (application/json)

名前 必須 内容
message_id integer メッセージID
メールの Message-Id: とは無関係。
ticket_id integer チケットID

テンプレート (template)

テンプレート一覧取得

curl -X GET \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/templates

以下のような JSON が返ります。

[
  {
    "template_id": 1,
    "template_category_name": "テンプレートカテゴリ名",
    "template_name": "テンプレート名",
    "from": "sample_from@sample.com",
    "to": "\"サンプルTo_1\" <sample_to_1@sample.com>,\"サンプルTo_2\" <sample_to_2@sample.com>",
    "cc": "\"サンプルCc_1\" <sample_cc_1@sample.com>,\"サンプルCc_2\" <sample_cc_2@sample.com>",
    "bcc": "\"サンプルBcc_1\" <sample_bcc_1@sample.com>,\"サンプルBcc_2\" <sample_bcc_2@sample.com>",
    "title": "件名",
    "html_body": "<!-- html ignored --><div>本文です</div>",
    "text_body": "本文です",
    "case_category_ids": [
        1,
        2
    ],
    "label_ids": [
        1,
        2
    ],
    "questionnaire_name": "アンケートメール名"
  },
  {
    "template_id": 2,
    "template_category_name": "テンプレートカテゴリ名",
    "template_name": "テンプレート名",
    "from": null,
    "to": null,
    "cc": null,
    "bcc": null,
    "title": "",
    "html_body": "",
    "text_body": "",
    "case_category_ids": [],
    "label_ids": [],
    "questionnaire_name": null
  }
]

画面上のソート順に返します。 ページネーションがあり、1ページに表示できる最大件数は30件です。

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/templates

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
per_page integer 1ページに表示する件数(デフォルト10, 最大値: 30)
page integer ページ番号(デフォルト1)

レスポンス (application/json)

以下を配列で最大30件返します。

名前 必須 内容
template_id integer テンプレートID
template_category_name string テンプレートカテゴリ名
template_name string テンプレート名
from string メールの From:
to string メールの To:
cc string メールの Cc:
bcc string メールの Bcc:
title string 件名
html_body string HTML形式の本文
text_body string TEXT形式の本文
case_category_ids array[integer] チケット分類IDの配列
こちらからご取得いただけます。
label_ids array[integer] ラベルIDの配列
こちらからご取得いただけます。
questionnaire_name string アンケートメール名
curl -XPOST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/templates/search \
  -d '{template_category_name:"テンプレートカテゴリ名"}'

以下のような JSON が返ります。

[
  {
    "template_id": 1,
    "template_category_name": "テンプレートカテゴリ名",
    "template_name": "テンプレート名",
    "from": "sample_from@sample.com",
    "to": "\"サンプルTo_1\" <sample_to_1@sample.com>,\"サンプルTo_2\" <sample_to_2@sample.com>",
    "cc": "\"サンプルCc_1\" <sample_cc_1@sample.com>,\"サンプルCc_2\" <sample_cc_2@sample.com>",
    "bcc": "\"サンプルBcc_1\" <sample_bcc_1@sample.com>,\"サンプルBcc_2\" <sample_bcc_2@sample.com>",
    "title": "件名",
    "html_body": "<!-- html ignored --><div>本文です</div>",
    "text_body": "本文です",
    "case_category_ids": [
        1,
        2
    ],
    "label_ids": [
      1,
      2
    ],
    "questionnaire_name": "アンケートメール名"
  },
  {
    "template_id": 2,
    "template_category_name": "テンプレートカテゴリ名",
    "template_name": "テンプレート名",
    "from": null,
    "to": null,
    "cc": null,
    "bcc": null,
    "title": "",
    "html_body": "",
    "text_body": "",
    "case_category_ids": [],
    "label_ids": [],
    "questionnaire_name": null
  }
]

画面上のソート順に返します。 ページネーションがあり、1ページに表示できる最大件数は30件です。

エンドポイント

POST https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/templates/search

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
template_category_name string カテゴリー名(完全一致)
per_page integer 1ページに表示する件数(デフォルト10, 最大値: 30)
page integer ページ番号(デフォルト1)

レスポンス (application/json)

以下を配列で最大30件返します。

名前 必須 内容
template_id integer テンプレートID
template_category_name string テンプレートカテゴリ名
template_name string テンプレート名
from string メールの From:
to string メールの To:
cc string メールの Cc:
bcc string メールの Bcc:
title string 件名
html_body string HTML形式の本文
text_body string TEXT形式の本文
case_category_ids array[integer] チケット分類IDの配列
こちらからご取得いただけます。
label_ids array[integer] ラベルIDの配列
こちらからご取得いただけます。
questionnaire_name string アンケートメール名

コメント (comment)

コメント作成

curl -XPOST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/comments \
  -d '{"message_id": 1,"comment":"コメントの内容"}'

メッセージに対してコメントを作成します。

エンドポイント

POST https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/comments

リクエストヘッダ

ヘッダ 必須 内容
Content-Type application/json を指定します

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)

リクエストパラメータ (application/json)

名前 必須 内容
message_id integer メッセージID
comment string コメント内容(最大文字数: 1000)

レスポンス

成功の場合、201 Created が返ります。

レスポンスボディはありません。

添付ファイル

メッセージ添付ファイルダウンロードURL発行

curl -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/messages/attachments/<attachment_id>

以下のような JSON が返ります。

{
  "url": "https://example.com/presigned-url",
  "file_name": "sample.pdf",
  "expires_in_sec": 30
}

メッセージに添付されているファイル1件をダウンロードできる URL を発行します。
発行された URL に別途 GET アクセスしてファイルダウンロードしてください。
URL には有効期限があるので期限内にダウンロードリクエストを開始してください(ダウンロードレスポンス終了までの期限ではありません)。

エンドポイント

GET https://<subdomain>.relationapp.jp/api/v2/<message_box_id>/messages/attachments/<attachment_id>

URI パラメータ

名前 内容
subdomain ご利用のサブドメイン
message_box_id 受信箱ID(数字)
attachment_id メッセージ添付ファイルID(数字)

レスポンス

名前 必須 内容
url string 発行された添付ファイルダウンロード用URL
GET アクセスでファイルをダウンロードできます
file_name string 添付ファイル名
expired_in_sec integer ダウンロード可能な有効期間(秒)
この期限までにダウンロードリクエストを開始してください

更新履歴

日付 変更内容
2022/12/22 送信メール設定一覧を取得できるようになりました。
2023/02/02 チャネル項目に Yahoo!ショッピングを追加
2023/02/16 アドレス帳ID版のコンタクト系API(登録・更新・削除・取得)を追加しました。
旧(受信箱ID版)API でパラメータ名にぶれがあったもの([email_addresses]と[addresses])を、上記アドレス帳ID版APIでは[emails]に統一しました。
アドレス帳ID版のバッジAPIを追加しました。
2023/03/30 アドレス帳ID版のコンタクト系API(登録・更新・取得)に次の項目を追加しました。
・アーカイブメールアドレス
・アーカイブ電話番号
2023/03/30 以下のAPIについて、「リソースまたはエンドポイントが存在しない」場合でも、ドキュメントと異なり、HTTP ステータスコード「404」ではなく「400」を返していたため、修正しました。
・更新 (system_id1 をキーに)(アドレス帳ID版)
・更新 (email をキーに)(アドレス帳ID版)
・取得 (system_id1 をキーに)(アドレス帳ID版)
・取得 (email をキーに)(アドレス帳ID版)
・削除 (system_id1 をキーに)(アドレス帳ID版)
・削除 (email をキーに)(アドレス帳ID版)
2023/09/01 以下のAPIを追加しました。
・チケットAPI(更新)
・メールAPI(送信・返信)
2023/09/05 以下のAPIを廃止に伴い削除しました。
・旧(受信箱ID版)コンタクト系API(登録・更新・削除・取得)
・旧(受信箱ID版)バッジAPI(取得)
2023/09/08 テンプレート一覧取得APIを追加しました。
2023/09/15 以下のAPIに機能を追加しました。
・チケット検索の条件にラベルを追加
・チケット1件取得の結果にコメントと添付ファイルを追加
以下のAPIを追加しました。
・添付ファイルAPI(メッセージ添付ファイルダウンロードURL発行)
2023/10/26 種別(チャネル)の記述に SMS、通話メモを追記しました。
2023/11/09 テンプレート検索APIを追加しました。
2023/11/30 ユーザー一覧取得APIに、メールアドレス、テナント管理者かどうか、多要素認証が有効になっているかどうかを追加しました。
チケット分類一覧取得APIに、アーカイブされているかどうかを追加しました。
2024/01/18 ユーザー一覧取得APIに最終アクセス日時を追加しました。
2024/03/04 チケット分類登録・更新APIを追加しました。
ラベル登録・更新APIを追加しました。
コメント作成APIを追加しました。
アドレス帳一覧取得APIを追加しました。
受信箱一覧取得APIのレスポンスに、アドレス帳IDを追加しました。
2024/04/11 チケット更新APIのリクエストに、スヌーズ復帰時に通知するユーザのメンション名を追加しました。