/v1/account

account

アカウント:残高、利用状況、クレジットサブスクリプション、APIキーをAPIで。

コストと制限

コストと制限
内容 クレジット
アカウント、残高、利用状況、クレジットサブスクリプションの読み取り 無料

制限:1分あたり 30 リクエスト。 作成、更新、削除:1分あたり 10 回。

エンドポイント

メソッド
メソッド パス 用途 アクセス
GET /v1/account あなたのアカウント。 APIキー
GET /v1/account/credits 残高と失効日。 APIキー
GET /v1/account/usage 期間内の利用状況(合計)。 APIキー
GET /v1/account/usage/transactions コスト付きの個々のリクエスト。 APIキー
GET /v1/account/subscription あなたのクレジットサブスクリプション。 APIキー
GET /v1/account/api-keys あなたのAPIキー。 APIキー
POST /v1/account/api-keys 新しいAPIキー。 管理者トークン
DELETE /v1/account/api-keys/{id} APIキーを削除。 管理者トークン
POST /v1/auth/tokens/create Bearerトークンを作成。 APIキー
GET · DELETE /v1/auth/tokens Bearerトークンの一覧と取り消し。 APIキー

アカウント

curl -G "https://handelsregister.ai/api/v1/account" \
  -H "x-api-key: YOUR_API_KEY"
1{2  "account": {3    "id": 2,4    "name": "Max Mustermann",5    "email": "[email protected]",6    "email_verified": true,7    "language": "de",8    "plan": "max",9    "member_since": "2026-09-02T17:07:10+00:00"10  },11  "meta": {12    "request_credit_cost": 0,13    "credits_remaining": 14514  }15}
200 · Maxのアカウントのレスポンス例

残高

curl -G "https://handelsregister.ai/api/v1/account/credits" \
  -H "x-api-key: YOUR_API_KEY"
フィールド
フィールド 意味
balance.total 合計残高。
balance.subscription クレジットサブスクリプションからのクレジット。プラン変更時に持ち越されたもの(rollover)を含む。
balance.purchased チャージクレジットとスタートクレジット。
next_expiry 次に失効するクレジット。amountとexpires_at付き。失効するものがなければnull。
breakdown すべてのクレジット付与。残りの額amount、出所source、失効日valid_until付き。sourceはsubscription、rollover、purchase、registrationのいずれか。
1{2  "balance": {3    "total": 145,4    "subscription": 0,5    "purchased": 1456  },7  "next_expiry": null,8  "meta": {9    "request_credit_cost": 0,10    "credits_remaining": 14511  }12}
200 · レスポンス例:アカウントの残高
残高不足のアラートには、balance.totalを定期的に照会してください。料金はかかりません。

利用状況

curl -G "https://handelsregister.ai/api/v1/account/usage" \
  -H "x-api-key: YOUR_API_KEY" \
  --data-urlencode 'from=2026-11-01' \
  --data-urlencode 'group_by=day'
パラメータ
名前 型 説明 例
fromクエリ 文字列任意 開始。YYYY-MM-DDまたはISO 8601。省略時:月初。 2026-11-01
toクエリ 文字列任意 終了(その日を含む)。日付のみの場合は、その日の終わりまで。省略時:現在。 –
group_byクエリ 文字列任意 省略時、APIは 92 日までの期間を日ごとに、それより長い期間を月ごとにまとめます。値: day, month day
1{2  "period": {3    "from": "2026-11-01T00:00:00+00:00",4    "to": "2026-11-01T07:54:44+00:00"5  },6  "totals": {7    "requests": 80,8    "credits_used": 3209  },10  "by_endpoint": [11    {12      "endpoint": "/api/v1/signals",13      "requests": 7,14      "credits_used": 14015    },16    {17      "endpoint": "/api/v1/fetch-organization",18      "requests": 25,19      "credits_used": 12020    },21    {22      "endpoint": "/api/v1/search-companies",23      "requests": 47,24      "credits_used": 4025    },26    {27      "endpoint": "/api/v1/signals/e23c12835d697c00512944ebdfb8260f",28      "requests": 1,29      "credits_used": 2030    }31  ],32  "series": {33    "group_by": "day",34    "buckets": [35      {36        "date": "2026-11-01",37        "requests": 80,38        "credits_used": 32039      }40    ]41  },42  "meta": {43    "request_credit_cost": 0,44    "credits_remaining": 14545  }46}
200 · レスポンス例:1日の利用状況

個々のリクエスト

curl -G "https://handelsregister.ai/api/v1/account/usage/transactions" \
  -H "x-api-key: YOUR_API_KEY" \
  --data-urlencode 'per_page=3'
パラメータ
名前 型 説明 例
fromクエリ 文字列任意 開始。YYYY-MM-DDまたはISO 8601。省略時:月初。 –
toクエリ 文字列任意 終了(その日を含む)。日付のみの場合は、その日の終わりまで。省略時:現在。 –
endpointクエリ 文字列任意 endpointに表示されるとおりの、ちょうどこのラベルを持つリクエストのみ。 –
per_pageクエリ 整数任意 1ページあたりの項目数。それより大きな値は、APIが 100 に下げます。デフォルト: 25制限: 1 以上 3
cursorクエリ 文字列任意 次のページ用の、前のページの値pagination.next_cursor。 –
1{2  "transactions": [3    {4      "id": 1116,5      "endpoint": "/api/v1/search-companies",6      "credits": 1,7      "parameters": {8        "q": "",9        "ai_search": false,10        "filters": {11          "postal_code": "91710",12          "active": true13        },14        "sort": null,15        "order": null,16        "status": 200,17        "search_type": "standard"18      },19      "created_at": "2026-11-01T07:55:02+00:00",20      "api_key_id": 1021    },22    {23      "id": 1115,24      "endpoint": "/api/v1/search-companies",25      "credits": 1,26      "parameters": {27        "q": "",28        "ai_search": false,29        "filters": {30          "postal_code": "91710",31          "active": true32        },33        "sort": null,34        "order": null,35        "status": 200,36        "search_type": "standard"37      },38      "created_at": "2026-11-01T07:55:01+00:00",39      "api_key_id": 1040    },41    {42      "id": 1114,43      "endpoint": "/api/v1/search-companies",44      "credits": 1,45      "parameters": {46        "q": "",47        "ai_search": false,48        "filters": {49          "industry_code": "62.1"50        },51        "sort": null,52        "order": null,53        "status": 200,54        "search_type": "standard"55      },56      "created_at": "2026-11-01T07:55:00+00:00",57      "api_key_id": 1058    }59  ],60  "pagination": {61    "per_page": 3,62    "next_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNi0xMS0wMSAwNzo1NTowMCIsImlkIjoxMTE0LCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9"63  },64  "period": {65    "from": "2026-11-01T00:00:00+00:00",66    "to": "2026-11-01T07:55:02+00:00"67  },68  "meta": {69    "request_credit_cost": 0,70    "credits_remaining": 14571  }72}
200 · レスポンス例:最新の3件のリクエスト

クレジットサブスクリプション

curl -G "https://handelsregister.ai/api/v1/account/subscription" \
  -H "x-api-key: YOUR_API_KEY"
1{2  "subscription": {3    "plan": "max",4    "status": "active",5    "billing_interval": "month",6    "cancel_at_period_end": false,7    "current_period_start": "2026-10-26T21:51:51+00:00",8    "current_period_end": "2026-11-26T21:51:51+00:00",9    "trial_ends_at": null,10    "canceled_at": null,11    "features": {12      "credits_per_month": 75000,13      "bonus_percentage": 15,14      "non_expiring_credits": true,15      "support_level": "priority"16    }17  },18  "meta": {19    "request_credit_cost": 0,20    "credits_remaining": 14521  }22}
200 · レスポンス例:有効なMaxのクレジットサブスクリプション

APIキーを管理する

curl -G "https://handelsregister.ai/api/v1/account/api-keys" \
  -H "x-api-key: YOUR_API_KEY"
1{2  "api_keys": [3    {4      "id": 10,5      "key_last_8": "Ab12Cd34",6      "is_current": true,7      "created_at": "2026-11-01T04:17:31+00:00",8      "last_used_at": "2026-11-01T07:55:12+00:00",9      "usage_last_30d": {10        "requests": 97,11        "credits_used": 41112      }13    }14  ],15  "total": 1,16  "meta": {17    "request_credit_cost": 0,18    "credits_remaining": 14519  }20}
200 · レスポンス例:アカウントのAPIキー
curl -X POST "https://handelsregister.ai/api/v1/account/api-keys" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"
1{2  "api_key": {3    "id": 13,4    "key": "…",5    "created_at": "2026-11-01T08:32:00+00:00"6  },7  "meta": {8    "message": "Store this key securely. It grants full data access to this account.",9    "request_credit_cost": 0,10    "credits_remaining": 14511  }12}
201 · レスポンス例:新しいAPIキー(ここでは短縮)

Bearerトークン

curl -X POST "https://handelsregister.ai/api/v1/auth/tokens/create" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "token_name": "CRM-Sync",
    "abilities": [
        "api:data",
        "account:read"
    ]
}'
パラメータ
名前 型 説明 例
token_nameボディ 文字列必須 トークンを見分けるための名前。例えばアプリケーションの名前。制限: 255 文字以下 CRM-Sync
abilitiesボディ string のリスト任意 リストとしての権限。省略時、トークンにはデータエンドポイント用のapi:dataと、アカウントのエンドポイント用のaccount:readが付きます。monitoring:manageはモニターの変更を許可します。デフォルト: ["*"] ["api:data","account:read"]
expires_atボディ 文字列 (date-time)任意 未来の有効期限。省略時、トークンは取り消すまで有効です。 –
1{2  "token": "…",3  "name": "CRM-Sync",4  "abilities": [5    "api:data",6    "account:read"7  ],8  "expires_at": null,9  "created_at": "2026-11-01T08:31:26.000000Z",10  "meta": {11    "message": "Token created successfully. Store this token securely as it will not be shown again.",12    "credits_remaining": 14513  }14}
201 · レスポンス例:新しいトークン(ここでは短縮)
DELETE /v1/auth/tokensは、管理者トークンを含め、すべてのトークンを一度に取り消します。その後キーを管理するには、新しい管理者トークンが必要です。

エラー

エラー
ステータス 原因 対処法
400 api_keyがURLにある。 キーをヘッダーx-api-keyで送る。
400 日付、group_by、長すぎる期間など、パラメータが無効。 meta.messageの説明に従って値を修正する。
401 APIキーもトークンもないか、無効。 キーをヘッダーx-api-keyで送る。
401 APIキーがないか、無効。/v1/auth以下ではBearerトークンは使えない。 APIキーをヘッダーx-api-keyで送る。
403 Bearerトークンに権限account:readがない。 APIキーか、account:read付きのトークンを使う。
403 アカウントのメールアドレスがまだ確認されていないか、アカウントがロックされている。 確認メールのリンクを開く。アカウントがロックされている場合はサポートが対応できる。
403 この呼び出しには管理者トークンが必要。APIキーでも、他のトークンでも足りない。 Authorization: Bearerと管理者トークンで送る。
404 このIDのキーまたはトークンがない。 IDはリストから取る。
422 APIキーの最大数に達している(too_many_keys)。 古いキーを削除する。
429 リクエストが多すぎる。 Retry-Afterの後に再試行する。
500 値が無効:token_nameがないか長すぎる、abilitiesがリストではない、またはexpires_atが未来ではない。 値を修正する。Accept: application/jsonを付けるとエラーがJSONで返る。
1{2  "error": "invalid_request",3  "meta": {4    "message": "'group_by' must be one of: day, month.",5    "request_credit_cost": 0,6    "credits_remaining": 1457  }8}
400 · group_byの無効な値