openapi: 3.0.3
info:
  title: RISK EYES V2 Web Count API
  description: |
    RISK EYES V2 Web記事 記事数表示API 仕様書

    従来は本サービスの会員ページ内で反社チェック対象を入力・検索することで、ヒットした記事数を表示します。

    本機能は、APIで反社チェック対象の記事数を返却します。

    システム上に、記事数を表示・記録できるよう開発いただくことにより、反社チェック対象の記事の有無・記事数をシステム内で確認することが可能になります。

    処理概要
    調査対象となる「法人名」「人名(代表者名など)」などの検索条件を指定し、会員ページに事前に設定してあるネガティブワードとの複合条件で検索した、従来は本サービスの会員ページ内で表示される『記事数』を本APIにより出力します。
    記事がヒットした取引先に関する記事は会員ページでも検索できます。

    注意事項
    並行でリクエストを送信せず、1件ずつリクエストを送信してください。

    変更履歴：
    - 1.0.2: birth_from / birth_to（生年期間）パラメータを追加
    - 1.0.1: google_search_flg、auto_approve_on_no_result パラメータを追加
    - 1.0.0: 初版公開

  version: 1.0.2

servers:
  - url: https://www.riskeyes.jp

paths:
  /api/v2/search/count/web2:
    post:
      summary: Web記事 記事数表示
      description: Web記事検索の記事数を表示します
      tags:
        - Web Search Count
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - keyword
              properties:
                keyword:
                  type: string
                  description: 検索キーワード（必須）
                  example: ソーシャルワイヤー
                negative_type:
                  type: integer
                  minimum: 0
                  maximum: 3
                  default: 0
                  description: ネガティブワード種別
                  example: 0
                limit:
                  type: array
                  items:
                    type: string
                  description: 絞込ワード（AND条件）
                  example: ['不祥事', '問題']
                limit_or:
                  type: array
                  items:
                    type: string
                  description: 絞込ワード（OR条件）
                  example: ['事故', 'トラブル']
                keyword_not:
                  type: array
                  items:
                    type: string
                  description: 除外ワード（手動指定）
                  example: ['無関係', '関係なし']
                keyword_not_flg:
                  type: boolean
                  default: false
                  description: 除外ワード自動抽出フラグ
                  example: false
                time_period_01:
                  type: string
                  format: date-time
                  description: 掲載期間（開始日）YYYY/MM/DD または YYYY-MM-DD
                  example: '2024/01/01'
                time_period_02:
                  type: string
                  format: date-time
                  description: 掲載期間（終了日）YYYY/MM/DD または YYYY-MM-DD
                  example: '2024/12/31'
                createdate_start:
                  type: string
                  format: date-time
                  description: 記事登録日（開始日）YYYY/MM/DD または YYYY-MM-DD
                  example: '2024/01/01'
                ai_negative_score_threshold_level:
                  type: integer
                  description: AI絞込レベル
                  enum:
                    - 0
                    - 1
                    - 2
                    - 4
                  example: 0
                entity_refinement:
                  type: boolean
                  default: false
                  description: AIキーワードフィルター
                  example: false
                negative_category_filter:
                  type: array
                  items:
                    type: string
                  description: ネガティブ分類の絞込
                  example: ['反社', '背任']
                concern_level_select:
                  type: integer
                  description: 懸念レベル 0:指定なし 1:レベル1(懸念i,ii,iii) 2:レベル2(懸念ii,iii) 3:レベル3(懸念iii)
                  example: 1
                administrative_penalty:
                  type: boolean
                  description: 行政情報
                  example: true
                birth_from:
                  type: integer
                  description: 生年期間（開始年）
                  example: 1980
                birth_to:
                  type: integer
                  description: 生年期間（終了年）
                  example: 1990
                client_customer_id:
                  type: integer
                  description: 取引先管理番号
                  example: 123
                remark:
                  type: string
                  description: 備考
                  example: '検索メモ'
                condition_id:
                  type: integer
                  description: 検索条件ID
                  example: 123
                strip_corps:
                  type: boolean
                  default: false
                  description: 法人格除去フラグ（法人名を除去する場合はtrueを指定）
                  example: false
                google_search_flg:
                  type: boolean
                  default: false
                  description: Google検索フラグ（Google検索を利用する場合はtrueを指定）
                  example: false
                auto_approve_on_no_result:
                  type: boolean
                  default: false
                  description: 検索結果が0件の場合に自動承認を行うフラグ
                  example: false
            examples:
              basic_search:
                summary: 基本的な検索
                value:
                  keyword: 'ソーシャルワイヤー'
              advanced_search:
                summary: 詳細検索
                value:
                  keyword: 'ソーシャルワイヤー'
                  negative_type: 1
                  limit: ['不祥事']
                  time_period_01: '2024/01/01'
                  time_period_02: '2024/12/31'
                  concern_level_select: 2
                  administrative_penalty: true
      responses:
        '200':
          description: 検索結果件数取得成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: integer
                    description: 検索結果件数
                    example: 123
              examples:
                success:
                  summary: 成功レスポンス
                  value:
                    count: 123
                no_results:
                  summary: 結果なし
                  value:
                    count: 0
        '400':
          description: リクエストエラー
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTPステータスコード
                    example: 400
                  result:
                    type: object
                    nullable: true
                    description: 結果データ（エラー時はnull）
                    example: null
                  errors:
                    type: object
                    properties:
                      message:
                        type: string
                        description: エラーメッセージ
                      error_code:
                        type: string
                        description: エラーコード
              examples:
                invalid_request:
                  summary: 不正なリクエスト
                  value:
                    status: 400
                    result: null
                    errors:
                      message: '不正なリクエストです。パラメータを確認してください。'
                      error_code: 'E400000'
                no_keyword:
                  summary: キーワード未設定
                  value:
                    status: 400
                    result: null
                    errors:
                      message: '{調査キーワード}は必須です。'
                      error_code: 'E400002'
                no_clip:
                  summary: 案件未設定
                  value:
                    status: 400
                    result: null
                    errors:
                      message: '{案件}が設定されていません。'
                      error_code: 'E400003'
                no_negative_keywords:
                  summary: ネガティブキーワード未設定
                  value:
                    status: 400
                    result: null
                    errors:
                      message: '{ネガティブキーワード}が設定されていません。'
                      error_code: 'E400003'
                no_db_type:
                  summary: DBタイプ未設定
                  value:
                    status: 400
                    result: null
                    errors:
                      message: '{DBタイプ}が設定されていません。'
                      error_code: 'E400003'
                invalid_negative_word_type:
                  summary: 無効なネガティブワードタイプ
                  value:
                    status: 400
                    result: null
                    errors:
                      message: '{ネガティブワードタイプ}に無効な値が設定されています。'
                      error_code: 'E400004'
                forbidden_characters:
                  summary: 禁止文字使用
                  value:
                    status: 400
                    result: null
                    errors:
                      message: '{各パラメータ}に使用できない文字が含まれています。'
                      error_code: 'E400005'
        '401':
          description: 認証エラー
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTPステータスコード
                    example: 401
                  message:
                    type: string
                    description: エラーメッセージ
                    example: 'トークンの有効期限が切れています。'
        '500':
          description: サーバーエラー
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTPステータスコード
                    example: 500
                  result:
                    type: object
                    nullable: true
                    description: 結果データ（エラー時はnull）
                    example: null
                  errors:
                    type: object
                    properties:
                      message:
                        type: string
                        description: エラーメッセージ
                      error_code:
                        type: string
                        description: エラーコード
              examples:
                internal_server_error:
                  summary: システムエラー
                  value:
                    status: 500
                    result: null
                    errors:
                      message: 'システムでエラーが発生しました。'
                      error_code: 'E500000'
                not_keyword_auto:
                  summary: 除外ワード抽出エラー
                  value:
                    status: 500
                    result: null
                    errors:
                      message: '除外ワードの抽出中にエラーが発生しました。'
                      error_code: 'E500001'
                count_search_error:
                  summary: 記事数取得エラー
                  value:
                    status: 500
                    result: null
                    errors:
                      message: '記事数の取得中にエラーが発生しました。'
                      error_code: 'E500001'
                too_many_hits:
                  summary: 検索結果過多エラー
                  value:
                    status: 500
                    result: null
                    errors:
                      message: '検索結果の件数が多すぎます。詳細条件を指定して再検索ください。'
                      error_code: 'E500003'

components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: /api/v2/tokenで取得したアクセストークンを使用してください

tags:
  - name: Web Search Count
    description: Web記事 記事数表示API
