API REST v1 + v2

GEO/AEO REST API 導入の手引き

お使いのアプリケーションを AILabsAudit の GEO監査 API につなぎます。119のエンドポイントから、監査、クライアント、レポート、GEOチェックリスト、分析データをプログラムで取得できます。

目次

  1. 事前準備
  2. APIキーを取得する
  3. 認証
  4. 最初のリクエスト
  5. エンドポイント
  6. ページ送りと絞り込み
  7. エラーとリクエスト制限
  8. コードの例

事前準備

REST API を組み込む前に、次のものをご用意ください。

1

Agent またはパートナーのアカウント

API のご利用には、Agent 以上のプラン、またはパートナーの資格が必要です。まだお持ちでない場合はアクセスをご申請ください

2

REST APIキー

API & Integrations のページで発行したAPIキー(aila_... の形式)が必要です。

3

HTTPクライアント

HTTPクライアントであれば何でも構いません。curl、Python の requests、JavaScript の fetch、Postman など。

APIキーを取得する

APIキーは、MCP 接続で使うものと同じです。すでにお持ちであれば、そのままご利用いただけます。

1

API & Integrations を開く

ダッシュボードでアカウント → API & Integrations を開きます。

2

新しいキーを作成する

「APIキーを作成」をクリックし、名前を付けて(例:「自社アプリ」)、必要な権限を選びます。

3

コピーして安全に保管する

キーは aila_ で始まります。表示されるのは一度だけですので、すぐにコピーしてください。ソースコードには書かず、環境変数に保管してください。

ヒント

多言語対応の Swagger ドキュメント/api/v1/docs?lang=fr|en|es|de)から、119のエンドポイントを対話的に試すこともできます。

認証

API は2つの認証方式に対応しています。お使いの構成に合うほうをお選びください。

方法1:X-Api-Key ヘッダー

CURL
curl -H "X-Api-Key: aila_your_key_here" \
     https://ailabsaudit.com/api/v1/clients

方法2:Authorization Bearer

CURL
curl -H "Authorization: Bearer aila_your_key_here" \
     https://ailabsaudit.com/api/v1/clients

セキュリティ

APIキーを、クライアント側のコード(ブラウザーで動く JavaScript)に書かないでください。API の呼び出しは必ずサーバー側から行ってください。

最初のリクエスト

クライアントの一覧を取得して、接続できているか確かめましょう。

CURL
curl -s -H "X-Api-Key: aila_your_key_here" \
     https://ailabsaudit.com/api/v1/clients | python3 -m json.tool

成功時の応答(200 OK)

JSON
{
    "success": true,
    "data": [
        {
            "id": 42,
            "name": "Acme Corp",
            "sector": "Technology",
            "website": "https://acme.com",
            "country": "FR",
            "created_at": "2025-01-15T10:30:00Z"
        }
    ],
    "pagination": {
        "page": 1,
        "per_page": 20,
        "total": 1,
        "total_pages": 1
    }
}

これで完了です

クライアントの一覧が表示されれば、APIキーは正しく動作しています。以下のエンドポイントをご覧ください。

エンドポイント

API は12のグループに整理され、119のエンドポイントがあります。すべてのURLは https://ailabsaudit.com/api/v1/ で始まります。コンテンツ系のエンドポイントは、多言語で応答を得るための任意パラメーター ?lang=fr|en|es|de を受け付けます。

クライアント

メソッド Endpoint Description
GET /clients クライアントを一覧表示する
GET /clients/{id} クライアントの詳細
GET /clients/{id}/contacts クライアントの連絡先
GET /clients/{id}/competitors クライアントの競合
GET /clients/{id}/360 全体像(360ビュー)

Audits

メソッド Endpoint Description
GET /audits 監査を一覧表示する
GET /audits/{id} 監査の詳細
GET /audits/{id}/results 監査の結果
GET /audits/{id}/scores 可視性スコア
POST /audits/launch 新しい監査を実行する

レポート

メソッド Endpoint Description
GET /reports レポートを一覧表示する
GET /reports/{id} レポートの詳細
GET /reports/{id}/download PDFをダウンロードする

アクションプラン

メソッド Endpoint Description
GET /action-plans アクションプランを一覧表示する
GET /action-plans/{id} プランの詳細
GET /action-plans/{id}/progress プランの進捗

アンケート

メソッド Endpoint Description
GET /questionnaires アンケートを一覧表示する
GET /questionnaires/{id}/responses アンケートの回答

Analytics

メソッド Endpoint Description
GET /analytics/portfolio ポートフォリオの全体像
GET /analytics/leaderboard 可視性のランキング
GET /analytics/scores/distribution スコアの分布

モデル

メソッド Endpoint Description
GET /models 利用できるAIモデルを一覧表示する
GET /models/{id} モデルの詳細と料金

アカウント

メソッド Endpoint Description
GET /account/profile プロフィール
GET /account/credits クレジット残高
GET /account/subscription 契約情報

Blog ?lang=

メソッド Endpoint Description
GET /blog?lang=fr|en|es|de ブログ記事を一覧表示する(多言語)
GET /blog/{slug} 記事の詳細

用語集 ?lang=

メソッド Endpoint Description
GET /glossary?lang=fr|en|es|de 用語を一覧表示する(多言語)
GET /glossary/{slug} 用語の詳細

GEO Checklist & 存在しないURL

メソッド Endpoint Description
GET /clients/{id}/geo-checklist GEO最適化のチェックリスト
GET /clients/{id}/hallucinated-urls AIモデルが生成した、存在しないURL

予約監査

メソッド Endpoint Description
GET /scheduled-audits 予約監査を一覧表示する
POST /scheduled-audits 予約監査を作成する
PUT /scheduled-audits/{id} 予約監査を変更する
DELETE /scheduled-audits/{id} 予約監査を削除する

詳細なドキュメント

API には16のスキーマ(Client、Audit、GeoChecklist、BlogArticle、GlossaryTerm、HallucinatedUrl など)、リクエスト制限のヘッダー、CORS 対応が定義されています。119のエンドポイント、パラメーター、応答スキーマの一覧は、多言語対応の Swagger 対話型ドキュメント/api/v1/docs?lang=fr|en|es|de)をご覧ください。

ページ送りと絞り込み

一覧を返すすべてのエンドポイントは、クエリパラメーターによるページ送りに対応しています。

パラメーター 既定値 Description
page 1 ページ番号
per_page 20 1ページあたりの件数(最大100)

ページ送りの例

CURL
curl -H "X-Api-Key: aila_your_key_here" \
     "https://ailabsaudit.com/api/v1/audits?page=2&per_page=10"

応答に含まれるページ送りの情報

JSON
{
    "pagination": {
        "page": 2,
        "per_page": 10,
        "total": 47,
        "total_pages": 5
    }
}

エラーとリクエスト制限

HTTPステータスコード

Code 意味
200成功
400リクエストが不正(パラメーターの誤り)
401認証されていない(APIキーがない、または無効)
403権限がない(必要な権限が不足)
404見つからない
429リクエスト回数の上限に達した
500サーバーエラー

エラー応答の形式

JSON
{
    "success": false,
    "error": {
        "code": 401,
        "message": "Invalid or missing API key"
    }
}

リクエスト制限

API は、APIキーごとに毎分60リクエストまで受け付けます。応答ヘッダーに制限の情報が含まれます。

HTTP HEADERS
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1709472000

上限に達した場合

429 の応答を受け取ったら、X-RateLimit-Reset のタイムスタンプまで待ってから再試行してください。本番環境では、指数関数的なバックオフを実装してください。

コードの例

お使いの言語で始められるよう、動作する例を用意しました。

import requests

API_KEY = "aila_your_key_here"
BASE_URL = "https://ailabsaudit.com/api/v1"

headers = {"X-Api-Key": API_KEY}

# List clients
response = requests.get(f"{BASE_URL}/clients", headers=headers)
clients = response.json()

for client in clients["data"]:
    print(f"{client['name']} — {client['sector']}")

    # Get audits for each client
    audits = requests.get(
        f"{BASE_URL}/audits",
        headers=headers,
        params={"client_id": client["id"], "per_page": 5}
    ).json()

    for audit in audits["data"]:
        print(f"  Audit #{audit['id']} — Score: {audit.get('score', 'N/A')}")

# Download a report as PDF
report_id = 1
r = requests.get(
    f"{BASE_URL}/reports/{report_id}/download",
    headers=headers
)
if r.status_code == 200:
    with open(f"report_{report_id}.pdf", "wb") as f:
        f.write(r.content)
    print(f"Report saved: report_{report_id}.pdf")
const API_KEY = "aila_your_key_here";
const BASE_URL = "https://ailabsaudit.com/api/v1";

const headers = { "X-Api-Key": API_KEY };

// List clients
async function getClients() {
    const response = await fetch(`${BASE_URL}/clients`, { headers });
    const { data, pagination } = await response.json();

    console.log(`${pagination.total} clients found`);
    data.forEach(client => {
        console.log(`${client.name} — ${client.sector}`);
    });

    return data;
}

// Get audit results
async function getAuditResults(auditId) {
    const response = await fetch(
        `${BASE_URL}/audits/${auditId}/results`,
        { headers }
    );
    return await response.json();
}

// Paginate through all audits
async function getAllAudits() {
    let page = 1;
    let allAudits = [];

    while (true) {
        const response = await fetch(
            `${BASE_URL}/audits?page=${page}&per_page=50`,
            { headers }
        );
        const { data, pagination } = await response.json();
        allAudits.push(...data);

        if (page >= pagination.total_pages) break;
        page++;
    }

    return allAudits;
}

getClients().then(console.log);
<?php
$apiKey = "aila_your_key_here";
$baseUrl = "https://ailabsaudit.com/api/v1";

function apiRequest($endpoint, $params = []) {
    global $apiKey, $baseUrl;

    $url = $baseUrl . $endpoint;
    if (!empty($params)) {
        $url .= "?" . http_build_query($params);
    }

    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => ["X-Api-Key: $apiKey"],
    ]);

    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    if ($httpCode !== 200) {
        throw new Exception("API error: HTTP $httpCode");
    }

    return json_decode($response, true);
}

// List clients
$clients = apiRequest("/clients");
foreach ($clients["data"] as $client) {
    echo "{$client['name']} — {$client['sector']}\n";
}

// Get audits with pagination
$audits = apiRequest("/audits", [
    "page" => 1,
    "per_page" => 10
]);
echo "Total audits: {$audits['pagination']['total']}\n";

// Get client 360 view
$client360 = apiRequest("/clients/42/360");
print_r($client360["data"]);

Pret a integrer l’API GEO/AEO ?

Creez votre cle API en 30 secondes et commencez a construire votre integration.

Commencer

AIでの可視性を監査する準備はできましたか?

無料でアカウントを作成すると、500クレジットのウェルカムボーナスと毎月100クレジットを受け取れます。

無料アカウントを作成