定期請求

毎月の請求書の下書きを作る設定を読む・変える

GET/v1/recurring-invoices

定期請求の一覧

毎月下書きを作る設定(定期請求)を、次に作る日の近い順に返します。アーカイブしたものは status=archived を指定したときだけ返します。

クエリ

  • statusenum
    activepausedarchived
  • orderIdstring

    100文字まで

  • cursorstring

    100文字まで

  • limitinteger

    1〜100

返る項目data の中身 · 200

  • idstring
  • sourceInvoiceIdstring

    元にした請求書。毎回この中身を写す

  • orderIdstring
  • clientIdstring | null
  • frequency"monthly"
  • dayOfMonthinteger

    請求日(1〜31。月末より後は月末)

  • nextRunAtstring

    次に下書きを作る日(JST、YYYY-MM-DD)

  • paymentDueOffsetDaysinteger

    請求日から支払期限まで

  • notifyOnDraftCreatedboolean
  • statusenum
    activepausedarchived
  • recentDraftsobject[]

    最近作った下書き(新しい順、3件まで)

    中の項目 4
    • invoiceIdstring
    • invoiceNumberstring | null
    • documentStatusstring
    • billingDatestring (date-time) | null
  • createdAtstring (date-time)
  • updatedAtstring (date-time)

起こりうるエラー共通のエラー

  • 400invalid_request

    送った値が正しくない。message にどこが違うかが入ります

  • 403insufficient_scope

    キーにこの入口の権限(scope)が付いていない。requiredScopes に必要な権限が入ります

GET/v1/recurring-invoices
curl https://tooon.app/api/v1/recurring-invoices \
  -H "Authorization: Bearer $TOOON_API_KEY"
レスポンス
{
  "data": [
    {
      "id": "clx8k2m0a0001",
      "sourceInvoiceId": "clx8k2m0a0001",
      "orderId": "clx8k2m0a0001",
      "clientId": "clx8k2m0a0001",
      "frequency": "monthly",
      "dayOfMonth": 0,
      "nextRunAt": "2026-11-01T09:00:00.000Z",
      "paymentDueOffsetDays": 0,
      "notifyOnDraftCreated": true,
      "status": "active",
      "recentDrafts": [
        {
          "invoiceId": "clx8k2m0a0001",
          "invoiceNumber": "…",
          "documentStatus": "…",
          "billingDate": "2026-11-01T09:00:00.000Z"
        }
      ],
      "createdAt": "2026-11-01T09:00:00.000Z",
      "updatedAt": "2026-11-01T09:00:00.000Z"
    }
  ],
  "nextCursor": null
}
POST/v1/recurring-invoices

請求書から定期請求を作る

請求書を元に、毎月 dayOfMonth の日付で下書きを作る設定をします(画面の「定期請求」と同じ)。取引に入っていない請求書(API で作った下書きなど)は、発行のときと同じく取引に入れてから設定します。作られるのは下書きだけで、発行・送付は本人が画面で行います。同じ請求書の定期請求がアーカイブ以外であれば、その設定を上書きします。

送る項目JSON · 5項目

  • sourceInvoiceIdstring必須

    100文字まで

  • nextRunAtstring (date)必須

    最初に下書きを作る日(JST)

  • dayOfMonthinteger必須

    1〜31

  • paymentDueOffsetDaysinteger

    0〜120

  • notifyOnDraftCreatedboolean

返る項目data の中身 · 201

  • idstring
  • sourceInvoiceIdstring

    元にした請求書。毎回この中身を写す

  • orderIdstring
  • clientIdstring | null
  • frequency"monthly"
  • dayOfMonthinteger

    請求日(1〜31。月末より後は月末)

  • nextRunAtstring

    次に下書きを作る日(JST、YYYY-MM-DD)

  • paymentDueOffsetDaysinteger

    請求日から支払期限まで

  • notifyOnDraftCreatedboolean
  • statusenum
    activepausedarchived
  • recentDraftsobject[]

    最近作った下書き(新しい順、3件まで)

    中の項目 4
    • invoiceIdstring
    • invoiceNumberstring | null
    • documentStatusstring
    • billingDatestring (date-time) | null
  • createdAtstring (date-time)
  • updatedAtstring (date-time)

起こりうるエラー共通のエラー

  • 400invalid_request

    送った値が正しくない。message にどこが違うかが入ります

  • 403insufficient_scope

    キーにこの入口の権限(scope)が付いていない。requiredScopes に必要な権限が入ります

POST/v1/recurring-invoices
curl -X POST https://tooon.app/api/v1/recurring-invoices \
  -H "Authorization: Bearer $TOOON_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "sourceInvoiceId": "clx8k2m0a0001",
  "nextRunAt": "2026-11-30",
  "dayOfMonth": 1
}'
レスポンス
{
  "data": {
    "id": "clx8k2m0a0001",
    "sourceInvoiceId": "clx8k2m0a0001",
    "orderId": "clx8k2m0a0001",
    "clientId": "clx8k2m0a0001",
    "frequency": "monthly",
    "dayOfMonth": 0,
    "nextRunAt": "2026-11-01T09:00:00.000Z",
    "paymentDueOffsetDays": 0,
    "notifyOnDraftCreated": true,
    "status": "active",
    "recentDrafts": [
      {
        "invoiceId": "clx8k2m0a0001",
        "invoiceNumber": "…",
        "documentStatus": "…",
        "billingDate": "2026-11-01T09:00:00.000Z"
      }
    ],
    "createdAt": "2026-11-01T09:00:00.000Z",
    "updatedAt": "2026-11-01T09:00:00.000Z"
  }
}
GET/v1/recurring-invoices/{id}

定期請求を1件読む

パスの値

  • idstring必須

    100文字まで

返る項目data の中身 · 200

  • idstring
  • sourceInvoiceIdstring

    元にした請求書。毎回この中身を写す

  • orderIdstring
  • clientIdstring | null
  • frequency"monthly"
  • dayOfMonthinteger

    請求日(1〜31。月末より後は月末)

  • nextRunAtstring

    次に下書きを作る日(JST、YYYY-MM-DD)

  • paymentDueOffsetDaysinteger

    請求日から支払期限まで

  • notifyOnDraftCreatedboolean
  • statusenum
    activepausedarchived
  • recentDraftsobject[]

    最近作った下書き(新しい順、3件まで)

    中の項目 4
    • invoiceIdstring
    • invoiceNumberstring | null
    • documentStatusstring
    • billingDatestring (date-time) | null
  • createdAtstring (date-time)
  • updatedAtstring (date-time)

起こりうるエラー共通のエラー

  • 403insufficient_scope

    キーにこの入口の権限(scope)が付いていない。requiredScopes に必要な権限が入ります

  • 404not_found

    対象がない、またはこのワークスペースのものではない

GET/v1/recurring-invoices/{id}
curl https://tooon.app/api/v1/recurring-invoices/clx8k2m0a0001 \
  -H "Authorization: Bearer $TOOON_API_KEY"
レスポンス
{
  "data": {
    "id": "clx8k2m0a0001",
    "sourceInvoiceId": "clx8k2m0a0001",
    "orderId": "clx8k2m0a0001",
    "clientId": "clx8k2m0a0001",
    "frequency": "monthly",
    "dayOfMonth": 0,
    "nextRunAt": "2026-11-01T09:00:00.000Z",
    "paymentDueOffsetDays": 0,
    "notifyOnDraftCreated": true,
    "status": "active",
    "recentDrafts": [
      {
        "invoiceId": "clx8k2m0a0001",
        "invoiceNumber": "…",
        "documentStatus": "…",
        "billingDate": "2026-11-01T09:00:00.000Z"
      }
    ],
    "createdAt": "2026-11-01T09:00:00.000Z",
    "updatedAt": "2026-11-01T09:00:00.000Z"
  }
}
PATCH/v1/recurring-invoices/{id}

定期請求の日にちを変える・止める・再開する

指定した項目だけ変えます。status=paused で止め、active で再開、archived で片づけます(作った下書きは残ります)。

パスの値

  • idstring必須

    100文字まで

送る項目JSON · 5項目

  • nextRunAtstring (date)
  • dayOfMonthinteger

    1〜31

  • paymentDueOffsetDaysinteger

    0〜120

  • notifyOnDraftCreatedboolean
  • statusenum
    activepausedarchived

返る項目data の中身 · 200

  • idstring
  • sourceInvoiceIdstring

    元にした請求書。毎回この中身を写す

  • orderIdstring
  • clientIdstring | null
  • frequency"monthly"
  • dayOfMonthinteger

    請求日(1〜31。月末より後は月末)

  • nextRunAtstring

    次に下書きを作る日(JST、YYYY-MM-DD)

  • paymentDueOffsetDaysinteger

    請求日から支払期限まで

  • notifyOnDraftCreatedboolean
  • statusenum
    activepausedarchived
  • recentDraftsobject[]

    最近作った下書き(新しい順、3件まで)

    中の項目 4
    • invoiceIdstring
    • invoiceNumberstring | null
    • documentStatusstring
    • billingDatestring (date-time) | null
  • createdAtstring (date-time)
  • updatedAtstring (date-time)

起こりうるエラー共通のエラー

  • 400invalid_request

    送った値が正しくない。message にどこが違うかが入ります

  • 403insufficient_scope

    キーにこの入口の権限(scope)が付いていない。requiredScopes に必要な権限が入ります

  • 404not_found

    対象がない、またはこのワークスペースのものではない

PATCH/v1/recurring-invoices/{id}
curl -X PATCH https://tooon.app/api/v1/recurring-invoices/clx8k2m0a0001 \
  -H "Authorization: Bearer $TOOON_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "nextRunAt": "2026-11-30",
  "dayOfMonth": 1,
  "paymentDueOffsetDays": 0
}'
レスポンス
{
  "data": {
    "id": "clx8k2m0a0001",
    "sourceInvoiceId": "clx8k2m0a0001",
    "orderId": "clx8k2m0a0001",
    "clientId": "clx8k2m0a0001",
    "frequency": "monthly",
    "dayOfMonth": 0,
    "nextRunAt": "2026-11-01T09:00:00.000Z",
    "paymentDueOffsetDays": 0,
    "notifyOnDraftCreated": true,
    "status": "active",
    "recentDrafts": [
      {
        "invoiceId": "clx8k2m0a0001",
        "invoiceNumber": "…",
        "documentStatus": "…",
        "billingDate": "2026-11-01T09:00:00.000Z"
      }
    ],
    "createdAt": "2026-11-01T09:00:00.000Z",
    "updatedAt": "2026-11-01T09:00:00.000Z"
  }
}