監査ログを取得する
組織の監査イベントを古い順に取得する読み取り専用 API です。
GET https://api.spectra-app.net/api/v1/audit-eventsBearer 認証が必要です。GET 以外は 405 Method Not Allowed と Allow: GET を返します。
クエリパラメータ
すべて省略可能です。未知のパラメータと同名パラメータの重複は拒否します。日時は秒までとタイムゾーンを含め、小数秒はミリ秒精度まで指定できます(例 2026-09-13T00:00:00Z)。
| 名前 | 型 | 説明 |
|---|---|---|
since | string | 開始時刻(境界を含む)。タイムゾーン付きの日時。UTC の Z を推奨します。 |
until | string | 終了時刻(境界を含む)。ページング中は固定してください。since より前にはできません。 |
cursor | string | 前ページの next_cursor を変更せず URL エンコードして渡します。別組織の cursor は使えません。 |
limit | integer | 整数 1〜1000。既定 100 件。 |
category | string | category の完全一致。大文字・小文字を区別します。 |
action | string | action の完全一致。大文字・小文字を区別します。 |
応答とページング
curl
curl --fail-with-body --silent --show-error --get \
-H "Authorization: Bearer $SPECTRA_AUDIT_TOKEN" \
--data-urlencode 'since=2026-09-01T00:00:00Z' \
--data-urlencode 'until=2026-09-13T00:00:00Z' \
--data-urlencode 'limit=1000' \
'https://api.spectra-app.net/api/v1/audit-events'応答(JSON)
{
"data": [
{
"schema_version": "1.0",
"event_id": "example-event",
"time": "2026-09-13T00:00:00.000Z",
"organization_id": "example-organization",
"category": "domain",
"action": "domain.added",
"outcome": "success",
"actor": {
"type": "user",
"user_id": "example-user",
"email": "owner@example.com"
},
"target": {
"type": "domain",
"id": "example-domain"
},
"src_ip": "192.0.2.10",
"user_agent": null,
"request_id": null,
"details": {
"name": "example.com",
"active_requested": false,
"schedule": "WEEKLY",
"changed": []
}
}
],
"next_cursor": null
}NDJSON — Accept: application/x-ndjson
{"schema_version":"1.0","event_id":"example-event","time":"2026-09-13T00:00:00.000Z","organization_id":"example-organization","category":"domain","action":"domain.added","outcome":"success","actor":{"type":"user","user_id":"example-user","email":"owner@example.com"},"target":{"type":"domain","id":"example-domain"},"src_ip":"192.0.2.10","user_agent":null,"request_id":null,"details":{"name":"example.com","active_requested":false,"schedule":"WEEKLY","changed":[]}}
JSON は data 配列と next_cursor を返します。続きがなければ next_cursor は null です。並び順は time、同時刻では event_id の昇順です。cursor は解釈・改変せず、同じ since / until / category / action / limit とともに渡してください。
Accept: application/x-ndjson では各行が data 内のイベントと同じ形式です。空の結果は空の本文です。続きがあるときだけ X-Next-Cursor と Link: …; rel="next" を返します。応答は Cache-Control: no-store です。
イベントのフィールド
| フィールド | 意味 |
|---|---|
schema_version | 文字列。現在 1.0。 |
event_id | 一意な不透明 ID。重複排除のキー。 |
time | 発生時刻。UTC のタイムスタンプ。 |
organization_id | 対象組織の ID。 |
category / action / outcome | イベントの分類・操作名・結果。イベント一覧を参照。 |
actor | 実行主体のオブジェクト。type は user / api_token / system。user_id と email は不明なら null。email は発生時点の値。 |
target | 対象の type と id。各値は null の場合があり、対象全体がなければ null。 |
src_ip / user_agent / request_id | リクエストの接続元 IP・User-Agent・識別子。不明または HTTP リクエストがない場合は null。 |
details | イベント固有のオブジェクト、または null。キーはイベント一覧を参照。 |
保存期間は 366 日です。発生から 366 日を過ぎたイベントは 1 時間ごとに自動削除され、API でも取得できなくなります。組織を削除するとその監査ログも削除されます。長期保管が必要な場合は、366 日を過ぎる前に取得し、取得先のシステムで保管してください。