連絡先:カスタム項目

項目の一覧

アカウントのすべてのカスタム項目と、その型・選択肢(キー順)。

POSThttps://g.sendcorex.com/v1/contactscommand: list_fields

API keyにcontact:readスコープが必要です。

引数

このエンドポイントに引数はありません。

クイックスタート

import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/contacts',
  {
    commands: [
      {
        command: "list_fields"
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);

レスポンス

{
  "type": "SUCCESS",
  "results": [
    {
      "command": "list_fields",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 14,
      "data": {
        "fields": [
          {
            "key": "age",
            "name": "Age",
            "type": "number",
            "options": null,
            "created_at": "2026-10-01T10:00:00.000Z",
            "updated_at": "2026-10-01T10:00:00.000Z"
          },
          {
            "key": "plan",
            "name": "Plan",
            "type": "enum",
            "options": [
              "free",
              "pro",
              "business"
            ],
            "created_at": "2026-10-01T10:00:00.000Z",
            "updated_at": "2026-10-01T10:00:00.000Z"
          }
        ],
        "limit": 100
      }
    }
  ]
}

レスポンスの項目

  • fields[].key

    fields、where、sort(fields.<key>)で使うキー。

  • fields[].name

    表示名。

  • fields[].type

    text、number、date、bool、enum、multi_enum。

  • fields[].options

    enumとmulti_enum項目の許可される値。

  • limit

    アカウントで持てる項目数(100)。

エラー

HTTPレベルのエラーはtype、code、messageを返します。CMDと表示されたエラーは、HTTP 200でコマンドの結果内に返ります。

  • 401INVALID_API_KEY

    API keyが存在しないか、取り消されたか、ダッシュボードで無効化されています。

  • 429RATE_LIMITED

    同じIP + API keyで毎秒15リクエストまたは同時15件を超えました。Retry-Afterの秒数だけ待ってください。

  • CMDMISSING_SCOPE

    API keyにこのコマンドに必要なスコープがありません。リクエスト内のほかのコマンドは実行されます。

  • CMDINTERNAL

    サーバーエラー。詳細はサーバーのログにのみ記録されます。