メインコンテンツへスキップ

Attribute API

Attribute API は、データとプログラム的に連携し、大量のデータを抽出して社内システムと統合できるようにします。

このドキュメントでは、利用可能な認証方法とエンドポイント、レスポンスコードについて説明し、Attribute API を簡単に利用するためのコード例を提供します。

Authentication and Authorization

Attribute API との認証は JWT (JSON Web Token) に基づいています。

注意

セキュリティ上の理由から、一度生成されたトークンは再取得できません。トークンは安全な方法で保管してください。

トークンを生成するには、Attribute ダッシュボードにアクセスしてください。setup/api-tokens ページに移動すると、新しいトークンの作成や既存トークンの管理ができます。

API Tokens page in the Attribute Dashboard

Create Token をクリックして新規トークン作成ダイアログを開きます。トークン名、説明、有効期限(日数)、IP 制限を入力し、Create をクリックします。

New API Token creation dialog

API Endpoints

注意

通常、AWS がデータを更新するまで最大 48 時間かかるため、最も安定した日次データは2日前のものになります。

Granularity and Date Parameters

以下のほとんどのエンドポイントは、同じルールに従う2つのパスパラメータを受け取ります。

  • granularity: 1 日分のデータを取得する場合は daily、1 か月分のデータを取得する場合は monthly
  • date: データを取得する日付。形式は YYYY-MM-DD
    • granularitydaily の場合、その特定の日のデータが返されます。当日を指定した場合は、現時点までに利用可能なデータが返されます。未来の日付を指定した場合は空のレスポンスになります。
    • granularitymonthly の場合、日付の「日」の部分は無視され、その月全体のデータが返されます。今月を指定した場合は前月のデータが返されます。未来の月を指定した場合は空のレスポンスになります。例: 日付が 2026-05-06 で granularity が monthly の場合、レスポンスには 2026 年 4 月分のデータが含まれます。

Healthcheck Information

サーバーのヘルスチェックを行います。

  • Endpoint: /api/v1/health
  • Method: GET
  • Example: https://api.app.attrb.io/api/v1/health
  • Returns: サーバーが正常な場合は HTTP 200。

Resources Information

Resources Information エンドポイントは、個々のクラウドリソースの請求データ (Attribute ダッシュボードの Billing ページ) を返します。

  • Endpoint: /api/v1/resources/{granularity}/{date}
  • Method: GET
  • Example: https://api.app.attrb.io/api/v1/resources/daily/2025-11-10
  • Description: リソースデータを取得するジョブを開始します。
  • Parameters:
  • Query Strings:
    • includetags (boolean, optional): true の場合、レスポンスにリソースタグを含めます。デフォルトは false
  • Returns: JobDescription
注意

ダッシュボード設定の show $0 costshow tax は、API ではどちらも true として扱われます。

Workloads Information

Workloads Information エンドポイントは、ワークロード単位に集約された請求データを返します。

  • Endpoint: /api/v1/workloads/{granularity}/{date}
  • Method: GET
  • Example: https://api.app.attrb.io/api/v1/workloads/daily/2025-11-10
  • Description: ワークロードデータを取得するジョブを開始します。
  • Parameters:
  • Query Strings:
    • includelabels (boolean, optional): true の場合、レスポンスにリソースラベルを含めます。デフォルトは false
  • Returns: JobDescription

All Customers Information

All Customers Information エンドポイントは、Attribute プラットフォームから、すべてのクラウドプロバイダーにまたがる顧客インサイトを抽出します。各顧客にアトリビュートされたリソースについて、顧客コストや償却後コスト、実効コスト、GCP コストなどを取得できます。(顧客データの詳細な構造については、AllCustomerEntryObject を参照してください。)

  • Endpoint: /api/v1/allcustomers/{granularity}/{date}
  • Method: GET
  • Example: https://api.app.attrb.io/api/v1/allcustomers/daily/2026-05-01
  • Description: すべてのクラウドプロバイダーにまたがる顧客データを取得するジョブを開始します。
  • Parameters:
  • Returns: JobDescription
  • Result object: AllCustomerEntryObject

Identifiers Information

Identifiers Information エンドポイントは、コンピュートコストを identifier (共有クラスタ上で動作する顧客、プロジェクト、国などの単位) ごとに分解して返します。これにより、単一クラスタのコストが、各 identifier のリクエストシェアに基づき、ビジネスユニット間でどのように分配されているかを確認できます。

利用可能範囲: AWS データのみで、sensor identifiers を使って複数ユニットが設定されている顧客に限られます。それ以外の顧客では、コストは標準の顧客コストフロー ( All Customers Information を参照) を通じてレポートされます。

  • Endpoint: /api/v1/identifiers/{granularity}/{date}
  • Method: GET
  • Example: https://api.app.attrb.io/api/v1/identifiers/daily/2026-06-02
  • Description: identifier ごとのコストデータを取得するジョブを開始します。
  • Parameters:
    • granularity: 1 日分のデータを取得する daily (このエンドポイントは日次の粒度のみをサポートします)
    • date: date parameters を参照してください。
  • Returns: JobDescription

Cost Calculation Types

各 workload と identifier の組み合わせは、cost_calculation_type ごとに4回返されます。このタイプは、独立した2つの次元を表します。

  • Anonymous costs — identifier を持たないリクエストのコストシェアを、そのまま保持するか、識別済みグループに再配分するか。
  • Unallocated costs — いずれのワークロードにもアトリビュートできなかった請求コストを除外するか、ワークロード間に分配するか。
cost_calculation_typeAnonymous costsUnallocated costs
with_anonymous_without_unallocatedそのまま保持除外
with_anonymous_with_unallocatedそのまま保持分配
without_anonymous_without_unallocated識別済みグループに再配分除外
without_anonymous_with_unallocated識別済みグループに再配分分配

AI Cost Information

AI Cost Information エンドポイントは、すべてのクラウドおよび直接プロバイダー (Bedrock、Vertex AI、OpenAI、Azure OpenAI、Anthropic) からの AI コストを取得します。

  • Endpoint: /api/v1/aicost/{granularity}/{date}
  • Method: GET
  • Example: https://api.app.attrb.io/api/v1/aicost/monthly/2025-11-01
  • Description: AI コストデータを取得するジョブを開始します。
  • Parameters:
  • Returns: JobDescription
  • Result object:
{
"results": [
{
"granularity": "MONTHLY",
"data_date": "2026-03-01",
"cloud_provider": "OpenAI",
"resource_type": "OpenAI",
"resource_name": "attribute-cyopcu/gpt-5.2-2025-12-11",
"token_type": "Output Tokens",
"amortized_cost": 0.088521999999999976,
"unblended_cost": 0.088521999999999976
}
]
}

OpenAI Information

OpenAI Information エンドポイントは、Attribute プラットフォームから、Customer と Workload ごとの OpenAI 関連インサイトを取得します。

結果は、AWS にネイティブの OpenAI 連携が設定されており、さらに customer identifier が設定されている場合にのみ返されます。

  • Endpoint: /api/v1/reports/openai/{granularity}/{date}
  • Method: GET
  • Example: https://api.app.attrb.io/api/v1/reports/openai/monthly/2025-11-01
  • Description: OpenAI データを取得するジョブを開始します。
  • Parameters:
  • Returns: JobDescription
  • Result object:

Example OpenAI result object

Job Management

上記の各データエンドポイントは、id を持つ JobDescription を返します。以下のエンドポイントを使用して、ジョブの進行状況を追跡し、結果を取得します。

Job Status

  • Endpoint: /api/v1/job/{jobid}/status
  • Method: GET
  • Example: https://api.app.attrb.io/api/v1/job/{jobid}/status
  • Description: 特定のジョブについて、そのステータス付きの JobDescription を取得します。
  • Parameters:
    • jobid: ジョブの ID。
  • Returns: JobDescription

Fetch

  • Endpoint: /api/v1/job/{jobid}/fetch
  • Method: GET
  • Example: https://api.app.attrb.io/api/v1/job/{jobid}/fetch
  • Description: 完了したジョブの結果を取得します。
  • Parameters:
    • jobid: ジョブの ID。
  • Query Strings:
    • maxResults (int, optional): 取得する JobData.results 内のオブジェクト数の上限。
    • token (int, optional): ページネーション用トークン。
  • Returns: JobData

Status Codes

Attribute API は標準的な HTTP ステータスコードを使用します。

CodeMeaningDescription
400Bad Requestリクエストパラメータの解析に失敗しました
401Unauthorizedリクエストは認可されていません
404Not Foundジョブが完了していないか、データが見つかりませんでした
429Rate Limit単一の組織に対してリクエストが多すぎます
500Internal Server Errorサーバーエラー

Data Structures

JobDescription

FieldDescription
idジョブ ID
statusジョブステータス: pending, running, completed, failed
reason失敗理由 (failed ステータス時に適用、任意)
lastUpdateステータスが最後に更新された Unix タイムスタンプ

JobData

FieldDescription
results結果オブジェクトのリスト
nextTokenページネーション用の任意の整数。結果の最終ページでは返されません

AllCustomerEntryObject

FieldDescription
customer_name顧客識別子
organization_id属性組織識別子
granularityデータの粒度:DAILY または MONTHLY
data_dateデータの日付
execution_dateジョブが実行された日付
dataアトリビューションデータのリスト
data[].resourceリソース識別子オブジェクト
data[].resource.cloud_providerクラウドプロバイダーの種類(例:AWSAzureGCP
data[].resource.account_idアトリビューションアカウント ID
data[].resource.customer_rule_identifierアトリビューションルール識別子
data[].resource.resource_nameリソース名(例:EKS クラスタ名)
data[].resource.resource_typeリソースの種類(例:EC2-EKS
data[].resource.resource_regionリソースの地域(例:us-east-1
data[].costアトリビューションコストオブジェクト
data[].cost.amortized_cost償却原価の値(AWS、MongoDB® Atlas、OpenAI)
data[].cost.effective_cost実効コストの値(Azure)
data[].cost.gcp_costコスト値(GCP)

Code Examples

2026-05-01 の日次データに対する customers API へのリクエスト:

curl -X GET "https://api.app.attrb.io/api/v1/allcustomers/daily/2026-05-01" \
-H "Accept: application/json" \
-H "Authorization: Bearer <JWT Token>"

作成されたジョブの JobDescription を含むレスポンス:

{
"id": "7a116c30-e245-43cb-b451-f099e84ffdeb",
"status": "pending",
"lastUpdate": 1741012038
}

ジョブ ID 7a116c30-e245-43cb-b451-f099e84ffdeb のステータスに対するリクエスト:

curl -X GET "https://api.app.attrb.io/api/v1/job/7a116c30-e245-43cb-b451-f099e84ffdeb/status" \
-H "Accept: application/json" \
-H "Authorization: Bearer <JWT Token>"

ジョブが正常に完了したことを示すレスポンス:

{
"id": "7a116c30-e245-43cb-b451-f099e84ffdeb",
"status": "completed",
"lastUpdate": 1741012038
}

1 行分のデータに対するリクエスト:

curl -sG "https://api.app.attrb.io/api/v1/job/7a116c30-e245-43cb-b451-f099e84ffdeb/fetch" \
--data-urlencode "maxResults=1" \
-H "Accept: application/json" \
-H "Authorization: Bearer <JWT Token>"

1 行分のデータを含むレスポンス:

{
"results": [
{
"customer_name": "acme_corp",
"organization_id": "org-id",
"granularity": "DAILY",
"data_date": "2026-05-01",
"execution_date": "2026-06-03",
"data": [
{
"resource": {
"cloud_provider": "AWS",
"account_id": "acct-id",
"customer_rule_identifier": "Proportions",
"resource_name": "prod-cluster",
"resource_type": "EC2-EKS",
"resource_region": "us-east-1"
},
"cost": {
"amortized_cost": 12.45,
"effective_cost": 0,
"gcp_cost": 0
}
},
{
"resource": {
"cloud_provider": "Azure",
"account_id": "azure-acct-id",
"customer_rule_identifier": "Proportions",
"resource_name": "vm-prod",
"resource_type": "VirtualMachine",
"resource_region": "eastus"
},
"cost": {
"amortized_cost": 0,
"effective_cost": 8.30,
"gcp_cost": 0
}
},
{
"resource": {
"cloud_provider": "GCP",
"account_id": "gcp-acct-id",
"customer_rule_identifier": "Proportions",
"resource_name": "gke-prod",
"resource_type": "GKE",
"resource_region": "us-central1"
},
"cost": {
"amortized_cost": 0,
"effective_cost": 0,
"gcp_cost": 5.72
}
}
]
}
],
"nextToken": 363
}

商標:AWS は Amazon.com, Inc. またはその関連会社の商標です。Microsoft および Microsoft Azure は Microsoft グループ各社の商標です。Google Cloud は Google LLC の商標です。MongoDB は MongoDB, Inc. の登録商標です。OpenAI は OpenAI の商標です。Anthropic および Claude は Anthropic, PBC の商標です。その他すべての商標はそれぞれの所有者に帰属します。