{"openapi":"3.1.0","info":{"title":"セールスコンパス.ai API","version":"1.0.0","description":"名刺管理サービスなどから、担当者と会社を登録するためのAPIです。1分あたり60回まで呼び出せます。"},"servers":[{"url":"https://app.salescompass-ai.com/api/v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"設定 > APIキー で発行したキー"}},"schemas":{"Contact":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"kana":{"type":["string","null"]},"company":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"department":{"type":["string","null"]},"title":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"mobile":{"type":["string","null"]},"memo":{"type":["string","null"]},"external_source":{"type":["string","null"]},"external_id":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ContactInput":{"type":"object","required":["name","company_name"],"properties":{"name":{"type":"string","description":"氏名"},"kana":{"type":"string"},"company_name":{"type":"string","description":"会社名。登録済みの会社があれば紐づけ、なければ作る"},"department":{"type":"string"},"title":{"type":"string"},"email":{"type":"string","description":"同じメールの担当者がいれば更新する"},"phone":{"type":"string"},"mobile":{"type":"string"},"memo":{"type":"string"},"external_source":{"type":"string","description":"連携元のサービス名（例: card-service）"},"external_id":{"type":"string","description":"連携元での名刺のID。同じ組み合わせがあれば更新する"}}}}},"paths":{"/contacts":{"get":{"summary":"担当者の一覧","parameters":[{"name":"email","in":"query","schema":{"type":"string"}},{"name":"external_id","in":"query","schema":{"type":"string"}},{"name":"updated_since","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","schema":{"type":"integer","maximum":100,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"OK"},"401":{"description":"エラー","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}},"429":{"description":"エラー","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}}},"post":{"summary":"担当者を登録（重複していれば更新）","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"}}}},"responses":{"200":{"description":"既存の担当者を更新した"},"201":{"description":"新しく登録した"},"401":{"description":"エラー","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}},"403":{"description":"エラー","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}},"422":{"description":"エラー","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}},"429":{"description":"エラー","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}}}},"/contacts/{id}":{"get":{"summary":"担当者を取得","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"404":{"description":"エラー","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}}},"put":{"summary":"担当者を更新（送った項目だけ変える）","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"}}}},"responses":{"200":{"description":"OK"},"404":{"description":"エラー","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}},"422":{"description":"エラー","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}}}},"/companies":{"get":{"summary":"会社の一覧","parameters":[{"name":"name","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"会社を登録（同じ名前があればそれを返す）","description":"画面からの登録ではメールアドレスが必須ですが、APIでは任意です（未登録の会社は画面に「メールアドレスが未登録」と表示されます）。売上高・資本金は万円単位の整数です。","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"employees":{"type":"integer","description":"従業員数（人）"},"revenue_man_yen":{"type":"integer","description":"売上高（万円）"},"capital_man_yen":{"type":"integer","description":"資本金（万円）"},"name":{"type":"string","description":"会社名"},"kana":{"type":"string","description":"フリガナ"},"email":{"type":"string","description":"メールアドレス"},"phone":{"type":"string","description":"電話番号"},"address":{"type":"string","description":"住所"},"url":{"type":"string","description":"Webサイト"},"registered_on":{"type":"string","description":"顧客登録日（YYYY-MM-DD）"},"contact_name":{"type":"string","description":"先方の担当者名"},"contact_kana":{"type":"string","description":"担当者名（カタカナ）"},"decider_name":{"type":"string","description":"決裁者名"},"decider_kana":{"type":"string","description":"決裁者名（カタカナ）"},"decider_title":{"type":"string","description":"決裁者の役職"},"industry":{"type":"string","description":"業種"},"source":{"type":"string","description":"顧客獲得経路（紹介 / Web / 店舗 / 広告 / 任意の文字）"},"memo":{"type":"string","description":"メモ"}}}}}},"responses":{"200":{"description":"既存の会社"},"201":{"description":"新しく登録した"},"422":{"description":"エラー","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}}}}}}