Available languages: [Python](https://databento.com/docs/api-historical/metadata/metadata-list-fields.python.md) · [C++](https://databento.com/docs/api-historical/metadata/metadata-list-fields.cpp.md) · [Rust](https://databento.com/docs/api-historical/metadata/metadata-list-fields.rust.md) · [HTTP](https://databento.com/docs/api-historical/metadata/metadata-list-fields.http.md)

Source: https://databento.com/docs/api-historical/metadata/metadata-list-fields



### Historical.metadata.list_fields

List all fields for a particular schema and encoding.

#### API method

```python
Historical.metadata.list_fields(
    schema: Schema | str,
    encoding: Encoding | str,
    dataset: Dataset | str | None = None,
) -> list[dict[str, str]]
```

#### Parameters

| Parameter | Type | Required | Description |
| `schema` | Schema or str | required | The data record [schema](https://databento.com/docs/schemas/whats-a-schema.md). Must be one of the values from [list_schemas](https://databento.com/docs/api-historical/metadata/metadata-list-schemas.md). |
| `encoding` | Encoding or str | required | The data [encoding](https://databento.com/docs/api-historical/basics/encodings.md). Must be one of 'dbn', 'csv', or 'json'. 'dbn' is recommended. |
| `dataset` | Dataset or str | optional | The [dataset](https://databento.com/docs/api-historical/basics/datasets.md) used to determine which fields are relevant. If `None` then the fields for the latest DBN encoding version are returned, which may differ from a specific dataset's schema. |

#### Returns

`list[dict[str, str]]`

A list of field details objects.

| Field | Type | Description |
| `name` | str | The field name. |
| `type` | str | The field data type. |

#### Example usage

```python
import databento as db

client = db.Historical("$YOUR_API_KEY")

fields = client.metadata.list_fields(schema="trades", encoding="dbn")
print(fields)
```
#### Example response

```json
[
    {
        "name": "length",
        "type": "uint8_t"
    },
    {
        "name": "rtype",
        "type": "uint8_t"
    },
    {
        "name": "publisher_id",
        "type": "uint16_t"
    },
    {
        "name": "instrument_id",
        "type": "uint32_t"
    },
    {
        "name": "ts_event",
        "type": "uint64_t"
    },
    {
        "name": "price",
        "type": "int64_t"
    },
    {
        "name": "size",
        "type": "uint32_t"
    },
    {
        "name": "action",
        "type": "char"
    },
    {
        "name": "side",
        "type": "char"
    },
    {
        "name": "flags",
        "type": "uint8_t"
    },
    {
        "name": "depth",
        "type": "uint8_t"
    },
    {
        "name": "ts_recv",
        "type": "uint64_t"
    },
    {
        "name": "ts_in_delta",
        "type": "int32_t"
    },
    {
        "name": "sequence",
        "type": "uint32_t"
    }
]
```
