> ## Documentation Index
> Fetch the complete documentation index at: https://docs.responsibleailabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# ヘルス & 検証

> ヘルスチェックとAPIキー検証エンドポイント - どちらも無料で、クレジットは必要ありません。

**0クレジット**で利用でき、すべてのプランで利用可能な2つのユーティリティエンドポイント。

## ヘルスチェック

`GET /health` - 現在のサービスステータスを返します。認証は不要です。

```bash theme={null}
curl https://api.responsibleailabs.ai/health
```

```json theme={null}
{
  "status": "healthy",
  "service": "rail-score-engine"
}
```

<ResponseField name="status" type="string">
  サービスが完全に稼働している場合は`"healthy"`。稼働時間の監視やロードバランサーのヘルスプローブに使用します。
</ResponseField>

<ResponseField name="service" type="string">
  常に`"rail-score-engine"`です。
</ResponseField>

## キー検証

`POST /verify` - APIキーが有効でアクティブであることを検証します。キーに関連するプランと残りのクレジットを返します。

```bash theme={null}
curl -X POST https://api.responsibleailabs.ai/verify \
  -H "Authorization: Bearer YOUR_RAIL_API_KEY"
```

```json theme={null}
{
  "valid": true,
  "plan": "pro",
  "credits_remaining": 847.5
}
```

<ResponseField name="valid" type="boolean">
  キーがアクティブで認可されている場合は`true`。キーが取り消されているか存在しない場合は`false`。
</ResponseField>

<ResponseField name="plan" type="string">
  このキーに関連するプラン: `"free"`、`"pro"`、`"business"`、または`"enterprise"`。
</ResponseField>

<ResponseField name="credits_remaining" type="number">
  現在の月間期間に残っているクレジット残高。
</ResponseField>

## エラー応答

| ステータス | 意味                                   |
| ----- | ------------------------------------ |
| `401` | `Authorization`ヘッダーが欠落または無効          |
| `403` | キーが取り消されているか非アクティブ                   |
| `503` | サービスが一時的に利用できません - 指数バックオフで再試行してください |

## SDKでの使用

<CodeGroup>
  ```python Python theme={null}
  from rail_score_sdk import RailScoreClient

  client = RailScoreClient(api_key="YOUR_RAIL_API_KEY")

  # ヘルスチェック
  health = client.health()
  print(health.status)  # "healthy"

  # キー検証
  info = client.verify()
  print(info.valid)              # True
  print(info.plan)               # "pro"
  print(info.credits_remaining)  # 847.5
  ```

  ```typescript JavaScript theme={null}
  import { RailScoreClient } from "@responsible-ai-labs/rail-score";

  const client = new RailScoreClient({ apiKey: "YOUR_RAIL_API_KEY" });

  const health = await client.health();
  console.log(health.status); // "healthy"

  const info = await client.verify();
  console.log(info.creditsRemaining); // 847.5
  ```
</CodeGroup>

## 次のステップ

<CardGroup cols={2}>
  <Card title="認証" icon="key" href="/getting-started/authentication">
    APIキーの生成と管理方法。
  </Card>

  <Card title="クレジット & 価格" icon="coins" href="/getting-started/credits">
    各エンドポイントのクレジットコストとプランの割り当て。
  </Card>
</CardGroup>
