📋 API概要

AI Toolsサービス用のRESTful APIシステムです。ユーザー管理とデータ操作を提供する、マルチテナント対応のマネージドAPIサービスです。

🔐 セキュリティ

Bearer Token認証とIP制限による強固なセキュリティ

📊 プラン管理

柔軟なプラン設定と利用制限管理

ベースURL

https://api.ai-tools.city/

🔐 認証

Bearer Token認証

全てのAPIリクエストには、Authorizationヘッダーにトークンが必要です。

認証ヘッダー

Authorization: Bearer YOUR_TOKEN_HERE

セキュリティ機能

  • トリプル暗号化: AES-256-CBCによる3段階暗号化
  • IP制限: 許可されたIPアドレスからのみアクセス可能
  • アクセスログ: 全API呼び出しをログに記録

👥 Accounts API

ユーザーアカウントの管理を行うAPIエンドポイント群です。

GET /accounts/

ユーザー一覧取得

全ユーザーのID、メールアドレス一覧を取得します。

cURLコマンド:
curl -X GET "https://api.ai-tools.city/accounts/" \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json"
レスポンス例:
{
  "status": "success",
  "result": [
    {
      "id": 1,
      "username": "user@example.com"
    }
  ],
  "request_id": 12345
}
GET /accounts/{userid}

ユーザー詳細取得

指定ユーザーの詳細情報を取得します。

cURLコマンド:
curl -X GET "https://api.ai-tools.city/accounts/1" \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json"
レスポンス例:
{
  "status": "success",
  "result": {
    "id": 1,
    "username": "user@example.com",
    "status": "active",
    "plan": "basic1",
    "article_limit": 10,
    "word_limit": 125000,
    "image_limit": 10,
    "research_dr": 50,
    "research_sg": 100,
    "research_kw": 75,
    "research_bl": 25,
    "keyword_limit": 10,
    "start_datetime": "2024-01-15 10:30:00"
  },
  "request_id": 12346
}
フィールド説明:
• research_dr: 競合サイト獲得キーワード調査の残り回数
• research_sg: サジェストキーワードの残り回数
• research_kw: キーワード難易度調査の残り回数
• research_bl: 被リンクドメイン調査の残り回数
• keyword_limit: キーワード発掘の残り回数
GET /accounts/{userid}/sso

SSO URL生成

シングルサインオン用の暗号化URLを生成します。

cURLコマンド:
curl -X GET "https://api.ai-tools.city/accounts/1/sso" \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json"
レスポンス例:
{
  "status": "success",
  "result": "https://cp.value-aiwriter.com/sso.php?p=ENCRYPTED_TOKEN",
  "request_id": 12347
}
GET /accounts/{userid}/history

利用履歴取得

過去2ヶ月間のGPT利用ログを取得します。

cURLコマンド:
curl -X GET "https://api.ai-tools.city/accounts/1/history" \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json"
POST /accounts/

ユーザー作成

新規ユーザーを作成します。

cURLコマンド:
curl -X POST "https://api.ai-tools.city/accounts/" \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "newuser@example.com",
    "password": "securepassword123",
    "plan": "basic1"
  }'
リクエストボディ例:
{
  "username": "newuser@example.com",
  "password": "securepassword123",
  "plan": "basic1"
}
PUT /accounts/{userid}

ユーザー情報更新

ユーザーのプラン、ステータス、制限値を更新します。

cURLコマンド:
curl -X PUT "https://api.ai-tools.city/accounts/1" \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "plan": "basic3",
    "status": "active",
    "article_limit": 100,
    "word_limit": 50000,
    "image_limit": 50,
    "research_dr": 100,
    "research_sg": 200,
    "research_kw": 150,
    "research_bl": 50,
    "keyword_limit": 20
  }'
リクエストボディ例:
{
  "plan": "basic3",
  "status": "active",
  "article_limit": 100,
  "word_limit": 50000,
  "image_limit": 50,
  "research_dr": 100,
  "research_sg": 200,
  "research_kw": 150,
  "research_bl": 50,
  "keyword_limit": 20
}
更新可能フィールド:
• plan: プラン名 (basic1, basic3, basic5, premium, pro)
• status: ユーザーステータス (active, suspended, deleted)
• article_limit: 記事数制限
• word_limit: 文字数制限
• image_limit: 画像数制限
• research_dr: 競合サイト獲得キーワード調査制限
• research_sg: サジェストキーワード制限
• research_kw: キーワード難易度調査制限
• research_bl: 被リンクドメイン調査制限
• keyword_limit: キーワード発掘制限
レスポンス例:
{
  "status": "success",
  "result": {
    "id": 1,
    "username": "user@example.com",
    "status": "active",
    "plan": "basic3",
    "article_limit": 100,
    "word_limit": 50000,
    "image_limit": 50,
    "research_dr": 100,
    "research_sg": 200,
    "research_kw": 150,
    "research_bl": 50,
    "keyword_limit": 20,
    "start_datetime": "2024-01-15 10:30:00"
  },
  "request_id": 12348
}
DELETE /accounts/{userid}

ユーザー削除

指定したユーザーを削除します。

cURLコマンド:
curl -X DELETE "https://api.ai-tools.city/accounts/1" \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json"

💼 プラン一覧

利用可能なプランとその制限値です。

プラン

プラン名 記事数 文字数 画像数 競合調査 サジェスト 難易度調査 被リンク調査 キーワード発掘
basic11125,000100001
basic3375,000300203
basic55125,000500505
basic1011270,000110012011
basic2020600,000110025011
basic40501,500,0005002050050
pro1001003,000,0001001010040050100
pro20030010,000,0003001010040050200

制限値フィールド説明

• 競合調査 (research_dr): 競合サイト獲得キーワード調査
• サジェスト (research_sg): サジェストキーワード
• 難易度調査 (research_kw): キーワード難易度調査
• 被リンク調査 (research_bl): 被リンクドメイン調査
• キーワード発掘 (keyword_limit): キーワード発掘

⚠️ エラーレスポンス

成功レスポンス

{
  "status": "success",
  "result": { /* レスポンスデータ */ },
  "request_id": 12345
}

エラーレスポンス

{
  "status": "error",
  "error": "エラーメッセージ",
  "request_id": 12345
}

よくあるエラー

認証エラー

  • Wrong credentials: 無効なトークン
  • Access from unauthorized IP: 許可されていないIPからのアクセス
  • No IP: IPアドレスが取得できない

データエラー

  • Username does not exist: 指定したユーザーが存在しない
  • 更新失敗しました: データベース更新エラー