# Get request log details

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Get one model call’s result, body previews, and body archive references.

```text
GET https://billing.moi.matrixorigin.cn/api/v1/taas/usage-logs/{id}
```

## Before you begin

1. Prepare a personal access token. For creation and management, see [Manage personal access tokens](../../../../../guides/billing/credentials.md#personal-access-token).
2. Select a call from [List request logs](list-request-logs.md).

Results are scoped to data accessible to the current user.

## Request example

Replace `$MOI_PERSONAL_ACCESS_TOKEN` and `$USAGE_LOG_ID` with your personal access token and the selected request log’s ID.

```bash
curl --get "https://billing.moi.matrixorigin.cn/api/v1/taas/usage-logs/$USAGE_LOG_ID" \
  -H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"
```

## Path parameters

::::{div} mo-api-parameter-table

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The selected request log’s ID, from `items[].id` in the request log list. |

::::

## Successful response

Returns HTTP `200` with the selected request log’s details and body archive references.

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "id": "usage_example",
  "user_id": "user_example",
  "model_id": "model_example",
  "model_name": "example-chat-model",
  "requested_model": "example-chat-model",
  "called_at": 1788710400,
  "input_tokens": 12,
  "output_tokens": 8,
  "cache_read_tokens": 0,
  "cache_creation_tokens": 0,
  "cost": "0.0001",
  "status": "success",
  "latency_ms": 120,
  "request_body_ref_id": "body_request_example",
  "response_body_ref_id": "body_response_example",
  "request_body_sha256": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
  "response_body_sha256": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
  "request_body_bytes": 2,
  "response_body_bytes": 2,
  "created_at": 1788710400,
  "credential": {
    "type": "personal_access_token",
    "id": "credential_example"
  },
  "request_body": "{}",
  "response_body": "{}",
  "body_refs": [
    {
      "id": "body_request_example",
      "usage_log_id": "usage_example",
      "scope": "user_request",
      "preview_body": "{}",
      "full_sha256": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
      "status": "complete",
      "preview_bytes": 2,
      "full_bytes": 2,
      "created_at": 1788710400,
      "completed_at": 1788710401
    }
  ]
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Usage log ID. |
| `token_key_id` | string | TaaS local key ID, for calls using that credential type. |
| `token_key_name` | string | TaaS local key name. |
| `user_id` | string | Calling user ID. |
| `user_name` | string | Calling user name, when available. |
| `model_id` | string | Catalog model object ID. |
| `model_name` | string | Actual model name. |
| `requested_model` | string | Model name submitted in the request. |
| `caller_ip` | string | Caller IP. |
| `called_at` | integer | Call time, Unix seconds. |
| `input_tokens` | integer | Input tokens. |
| `output_tokens` | integer | Output tokens. |
| `cache_read_tokens` | integer | Cache-read tokens. |
| `cache_creation_tokens` | integer | Cache-creation tokens. |
| `cost` | string | Call cost as a decimal string. |
| `status` | string | Call result status. |
| `error_type` | string | Call error category, when present. |
| `error_message` | string | Call error description, when present. |
| `latency_ms` | integer | Call `latency` in milliseconds. |
| `request_body_ref_id` | string | Archive reference ID for the request body. Returned when populated. |
| `response_body_ref_id` | string | Archive reference ID for the response body. Returned when populated. |
| `request_body_sha256` | string | SHA-256 of the full request body. Returned when populated. |
| `response_body_sha256` | string | SHA-256 of the full response body. Returned when populated. |
| `request_id` | string | Request tracing ID. Returned when populated. |
| `key_hash_prefix` | string | Key-hash prefix. Returned when populated. |
| `meter_code` | string | Billing meter code. Returned when populated. |
| `pricing_mode` | string | Call pricing mode. Returned when populated. |
| `enterprise_plan_id` | string | Enterprise plan ID. Returned when populated. |
| `enterprise_plan_name` | string | Enterprise plan name. Returned when populated. |
| `enterprise_contract_no` | string | Enterprise contract number. Returned when populated. |
| `enterprise_plan_model_id` | string | Enterprise plan model ID. Returned when populated. |
| `pricing_snapshot` | string | Serialized pricing snapshot. Returned when populated. |
| `settlement_method` | string | Settlement method. Returned when populated. |
| `billing_report_status` | string | Usage reporting status. Returned when populated. |
| `billing_report_group_id` | string | Usage reporting group ID. Returned when populated. |
| `billing_event_key` | string | Idempotency key for the billing usage event. Returned when populated. |
| `billing_event_id` | string | Billing usage-event ID. Returned when populated. |
| `billing_record_id` | string | Billing record ID. Returned when populated. |
| `billing_account_id` | string | Billing account ID. Returned when populated. |
| `billing_rated_credit` | string | Credit amount rated for this call. Returned when populated. |
| `billing_credit_balance` | string | Credit balance recorded from the reporting result. Returned when populated. |
| `billing_credit_available` | string | Available credit recorded from the reporting result. Returned when populated. |
| `billing_last_error` | string | Latest billing usage-reporting error. Returned when populated. |
| `request_body_bytes` | integer | Full request body size in bytes. |
| `response_body_bytes` | integer | Full response body size in bytes. |
| `billing_reported_at` | integer | Billing reporting time, Unix seconds, when present. |
| `billing_report_attempts` | integer | Billing reporting attempts. |
| `created_at` | integer | Log creation time, Unix seconds. |
| `credential` | object | Credential identity for this call, when recorded. |
| `credential.type` | string | Credential type: `taas_token_key`, `personal_access_token`, or `service_account_api_key`. |
| `credential.id` | string | Credential object ID. |
| `credential.service_account_id` | string | Service account ID; returned for service-account credentials. |
| `request_body` | string | Request body preview; may be truncated. |
| `response_body` | string | Response body preview; may be truncated. |
| `body_refs` | array of object | Associated body archive references. |
| `body_refs[].id` | string | Body archive reference ID. |
| `body_refs[].usage_log_id` | string | Owning usage log ID. |
| `body_refs[].provider_request_log_id` | string | Associated upstream request log ID. |
| `body_refs[].user_id` | string | Owning user ID. |
| `body_refs[].token_key_id` | string | Associated TaaS local key ID. |
| `body_refs[].request_id` | string | Request tracing ID. |
| `body_refs[].body_id` | string | Body object ID. |
| `body_refs[].scope` | string | Request or response stage for the body. |
| `body_refs[].content_type` | string | Body media type, when present. |
| `body_refs[].preview_body` | string | Body preview. |
| `body_refs[].full_sha256` | string | SHA-256 of the complete body. |
| `body_refs[].status` | string | Archive status. |
| `body_refs[].error_message` | string | Archive error, when present. |
| `body_refs[].legacy` | boolean | Legacy archive marker, when present. |
| `body_refs[].preview_bytes` | integer | Preview size in bytes. |
| `body_refs[].full_bytes` | integer | Full body size in bytes. |
| `body_refs[].created_at` | integer | Archive creation time, Unix seconds. |
| `body_refs[].completed_at` | integer | Archive completion time, Unix seconds, when complete. |

In field paths, `[]` denotes each array item.

:::::
::::::
:::::::

## Next steps

Use the log’s `id` to [List upstream request attempts](list-provider-requests.md). To retrieve a complete body, use a body reference from the same log to [Download a request or response body](download-body.md).
