# Attribute Formats


The [traces](/docs/protocol/traces/payload) and [logs](/docs/protocol/logs/payload) endpoints use the OpenTelemetry typed attribute format for all attributes on resources, scopes, spans, span events, and log records. The log record `body` field also uses this format.

The [errors](/docs/protocol/errors/payload) endpoint does **not** use this format. Error attributes are flat key-value objects (e.g. `{ "http.method": "GET" }`). See the [error attributes](/docs/protocol/errors/attributes) page for details.

## Attribute Array

Attributes are represented as an array of key-value objects:

```json
[
    {
        "key": "http.method",
        "value": {
            "stringValue": "GET"
        }
    },
    {
        "key": "http.status_code",
        "value": {
            "intValue": 200
        }
    },
    {
        "key": "error",
        "value": {
            "boolValue": true
        }
    }
]
```

Each object has a `key` (string) and a `value` object containing exactly one typed field.

## Value Types

| Field | JSON Type | Description |
|---|---|---|
| `stringValue` | string | String value |
| `intValue` | number | Integer value |
| `doubleValue` | number | Floating point value |
| `boolValue` | boolean | Boolean value |
| `arrayValue` | object | List of values |
| `kvlistValue` | object | Key-value list (associative data) |

This same value format is also used for the log record `body` field. Most log entries use `stringValue` for plain text messages, but structured data can be represented using `kvlistValue` or `arrayValue`.

### `arrayValue`

A list of typed values:

```json
{
    "key": "tags",
    "value": {
        "arrayValue": {
            "values": [
                { "stringValue": "web" },
                { "stringValue": "production" }
            ]
        }
    }
}
```

### `kvlistValue`

An associative list of key-value pairs, where each value is itself a typed value:

```json
{
    "key": "http.request.headers",
    "value": {
        "kvlistValue": {
            "values": [
                { "key": "Content-Type", "value": { "stringValue": "application/json" } },
                { "key": "Accept", "value": { "stringValue": "text/html" } }
            ]
        }
    }
}
```
