注文検索

呼び出し元のショップの注文を検索し、一覧で取得します。

注文日の範囲、注文状態、決済手段、注文の種類、キーワードで絞り込めます。 指定した並び順とページングで返し、注文日の範囲を省略すると直近 3 ヶ月が対象になります。

注文日の範囲は最長 1 年です。 終了日には開始日の 1 年後の前日まで指定できます(開始日が 2025-09-18 なら終了日は 2026-09-17 まで)。

各注文は概要を返します。 注文明細、部分発送履歴、決済トランザクション、売上残高ログなどの詳細は、GET /api/orders/{unique_key} で取得することができます。 取得による注文情報の変更や通知の送信はありません。

POST /api/orders/search
スコープ orders.read

リクエスト例

curl
curl -X POST "https://apiv2.thebase.com/api/orders/search" \
  -H "Authorization: Bearer <your-token>" \
  -H "Content-Type: application/json" \
  -d '{
  "keyword": "サンプル商品"
}'

リクエストボディ application/json

  • keywordstring任意255 文字以下
    キーワード。注文番号・購入者情報・商品名・注文メモなどを対象に絞り込みます。
  • ordered_from_datestring (date)任意
    注文日の範囲開始(YYYY-MM-DD, JST)。この日の 0 時以降が対象です。省略時は終了日の 3 ヶ月前です。終了日より後の日付は指定できません。
  • ordered_to_datestring (date)任意
    注文日の範囲終了(YYYY-MM-DD, JST)。この日の終わりまでが対象です。省略時は当日です。開始日の 1 年後以降の日付は指定できません。
  • statuses"ordered" | "dispatched" | "cancelled"[]任意
    注文状態での絞り込み。複数指定した場合はいずれかに一致する注文が対象です。未指定の場合は全状態が対象です。
  • payments"creditcard" | "cvs" | "base_bt" | "atobarai" | "bnpl" | "bt" | "cod" | "carrier" | "paypal" | "amazon_pay" | "paypay"[]任意
    決済手段での絞り込み(例: creditcard / cvs / paypay)。複数指定した場合はいずれかに一致する注文が対象です。未指定の場合は全決済手段が対象です。
  • order_types"normal" | "pre" | "subscription" | "digital" | "lottery" | "takeout"[]任意
    注文の種類での絞り込み。複数指定した場合はいずれかに一致する注文が対象です。未指定の場合は全種類が対象です。
  • properties"has_order_remark" | "has_remark" | "has_delivery_date" | "has_option_property" | "has_reserved_kantan_delivery"[]任意
    その他条件での絞り込み。複数指定した場合はいずれかに一致する注文が対象です。has_order_remark=ショップメモあり、has_remark=購入者備考あり、has_delivery_date=配送希望日指定あり、has_option_property=商品オプションあり、has_reserved_kantan_delivery=かんたん発送予約あり
  • sort"ordered_desc" | "ordered_asc" | "scheduled_date_asc" | "delivery_date_asc" | "payment_date_asc"任意
    並び順。ordered_desc=注文日時の新しい順、ordered_asc=古い順、scheduled_date_asc=予約商品の発送予定日が近い順、delivery_date_asc=配送希望日が近い順、payment_date_asc=入金日(発送可能日)が近い順
  • limitinteger任意≥ 1 / ≤ 200
    1 ページあたりの取得件数(1〜200)
  • pageinteger任意≥ 1 / ≤ 500
    取得するページ番号(1 始まり、最大 500)

レスポンス

200 検索成功。条件に一致した注文の概要一覧とページング情報を返します。

200 のレスポンスボディ(application/json):

  • ordersOrderSummary[]必須
    検索条件に一致した注文の一覧。並び順は sort に従います。該当が無い場合は空配列です。
    • unique_keystring必須
      注文の一意キー。注文詳細の取得に使う識別子です。
    • statusstring必須
      注文状態を表す文字列。値は固定された列挙ではありません。現在の仕様で返る主な値は 'ordered'(発送待ち)、'unpaid'(入金待ち)、'unshippable'(対応開始前)、'dispatched'(発送済み)、'cancelled'(キャンセル済み)、'shipping'、'arrived' です。今後の機能追加により、新しい値が返る場合があります。
    • ordered_atstring (date-time)必須
      注文日時(RFC 3339, 秒精度 UTC)
    • cancelled_atstring (date-time)必須nullable
      キャンセル日時(RFC 3339, 秒精度 UTC)。未キャンセルは null です。
    • modified_atstring (date-time)必須
      注文の最終更新日時(RFC 3339, 秒精度 UTC)
    • viastring必須
      注文経路。記録が無い場合は 'default' です。
    • remarkstring必須nullable
      購入者が入力した備考
    • add_commentstring必須nullable
      ショップから注文者へのメッセージ
    • shop_memoOrderShopMemo必須
      • textstring必須
        ショップメモ本文。未入力の場合は空文字列です。
    • mail_magazine_opt_inboolean必須nullable
      メールマガジン購読の同意。購入時に同意を取得していない注文は null です。
    • customerOrderCustomer必須
      • nameOrderCustomerName必須
        • firststring必須
          名
        • laststring必須
          姓
        • first_kanastring必須nullable
          名(カナ)。未登録時は null です。
        • last_kanastring必須nullable
          姓(カナ)。未登録時は null です。
      • mail_addressstring必須
        購入時に登録されたメールアドレス。未登録時は空文字です。
      • addressOrderCustomerAddress必須
        • countrystring必須
          国名。日本国内であれば 'Japan' です。
        • country_codestring必須nullable
          国コード(ISO 3166-1 alpha-2)。国コードを特定できない場合は null です。
        • zip_codestring必須
          郵便番号。ハイフンの有無は保存時のままです。
        • prefecturestring必須
          都道府県
        • addressstring必須
          市区町村・番地
        • address2string必須
          建物名・部屋番号など
        • telstring必須nullable
          電話番号。未登録時は null です。
    • shippingOrderShipping必須
      • nameOrderShippingName必須
        • firststring必須nullable
          名。配送先未登録時は null です。
        • laststring必須nullable
          姓。配送先未登録時は null です。
      • addressOrderShippingAddress必須
        • countrystring必須nullable
          国名。配送先未登録時は null です。
        • country_codestring必須nullable
          国コード(ISO 3166-1 alpha-2)。未登録または国コードを特定できない場合は null です。
        • zip_codestring必須nullable
          郵便番号。配送先未登録時は null です。
        • prefecturestring必須nullable
          都道府県。配送先未登録時は null です。
        • addressstring必須nullable
          市区町村・番地。配送先未登録時は null です。
        • address2string必須nullable
          建物名・部屋番号など。配送先未登録時は null です。
        • telstring必須nullable
          電話番号。未登録時は null です。
    • subscriptionOrderSubscription必須nullable
      定期便情報。通常注文では null です。
      • unique_keystring必須nullable
        定期便の一意キー。未取得時は null です。
      • repeat_numberinteger必須nullable
        何回目の配送か
      • repeat_timesinteger必須nullable
        配送回数の総数
    • referrerOrderReferrer必須nullable
      流入元情報。記録が無い注文は null です。
      • site_domainstring必須nullable
        流入元ドメイン
      • site_paramstring必須nullable
        流入元から引き継ぐ値
    • item_countinteger必須
      注文に含まれる商品の点数(キャンセル明細を除いた各明細の数量の合計)
    • amountsOrderAmounts必須
      • subtotalinteger必須
        商品合計(円)。明細 total の合計です。
      • shipping_feeinteger必須
        送料(円)。無料は 0 です。
      • cod_feeinteger必須
        代引手数料(円)。対象外は 0 です。
      • totalinteger必須
        注文合計(円)。クーポン・送料・代引手数料・金額調整を反映した値です。
      • coupon_discountOrderCouponDiscount必須
        • amountinteger必須
          クーポン割引額(円)。割引なしは 0 です。
        • notestring必須nullable
          割引メモ(クーポンコード等)
        • allocates_balance_logboolean必須
          売上残高ログの金額配分に含めるクーポン割引かどうか
      • coin_discountOrderCoinDiscount必須
        • amountinteger必須
          コイン割引額(円)。割引なしは 0 です。
        • notestring必須nullable
          割引メモ
      • adjustmentOrderAmountAdjustment必須
        • amountinteger必須
          金額調整(円)。調整なしは 0 です。
      • service_chargeOrderServiceCharge必須
        • collected_feeinteger必須
          BASE 徴収手数料(円)。未徴収の注文は 0 です。
        • fee_type"base" | "payid_app"必須
          手数料種別(base / payid_app)
      • additional_chargesOrderAdditionalCharge[]必須
        追加料金の内訳。無い場合は空配列です。
        • namestring必須nullable
          追加料金の種別名
        • collected_feeinteger必須nullable
          追加料金額(円)
    • deliveryOrderSummaryDelivery必須
      • delivery_company_idinteger必須
        注文全体の配送業者 ID。未指定は 0 です。
      • tracking_numberstring必須nullable
        注文全体の伝票番号
      • delivery_datestring (date)必須nullable
        配送希望日(YYYY-MM-DD)。未指定は null です。
      • delivery_time_zonestring必須nullable
        配送希望時間帯(4 桁。例: '1214' = 12 時-14 時)。未指定は null です。
      • dispatched_atstring (date-time)必須nullable
        最終発送日時(RFC 3339, 秒精度 UTC)。未発送は null です。
    • paymentOrderSummaryPayment必須
      • methodstring必須nullable
        注文確定時の決済手段。未確定は null です。
  • paginationPagination必須
    • pageinteger必須≥ 1
      現在のページ番号(1 始まり)
    • limitinteger必須≥ 1
      1 ページあたりの最大件数
    • total_countinteger必須≥ 0
      検索条件に一致した注文の総件数
    • total_pagesinteger必須≥ 0
      総ページ数。total_count と limit から算出した値です。0 件のときは 0 です。
    • has_nextboolean必須
      次のページが存在するか
    • has_previousboolean必須
      前のページが存在するか

エラー

エラーは application/problem+json の Problem 形式で返します。 認証・スコープ・予期しない内部エラーなど、すべてのエンドポイントに共通のエラーと 構造・判別方法は エラーレスポンス を参照してください。

このエンドポイントが返すその他のエラーは次のとおりです。

400 /errors/request/malformed-body リクエストボディをこのエンドポイントが要求する形式として解釈できない場合に返します。
400 /errors/orders/invalid-body リクエストボディがエンドポイントのスキーマを満たさない場合に返します。
413 /errors/request/body-too-large JSON リクエストボディが 1 MiB の上限を超える場合に返します。
415 /errors/request/unsupported-media-type JSON 形式のリクエストボディを要求するエンドポイントに、対応していない Content-Type が指定された、または Content-Type が指定されていない場合に返します。
502 /errors/internal/bad-gateway BASE API が処理を完了するために必要な内部処理で不整合が発生した場合に返します。
504 /errors/internal/gateway-timeout BASE API が処理を完了するために必要な内部処理が制限時間内に完了しなかった場合に返します。