# Introduction

Commerce Layer **Metrics API** lets you extract and aggregate relevant metric data from your organizations. It enables you to perform **4** different types of **queries** ([breakdown](https://app.gitbook.com/s/ASSiAvbL4nFnkl8plQy2/getting-started/queries/breakdown), [date breakdown](https://app.gitbook.com/s/ASSiAvbL4nFnkl8plQy2/getting-started/queries/date-breakdown), [stats](https://app.gitbook.com/s/ASSiAvbL4nFnkl8plQy2/getting-started/queries/stats), and [search](https://app.gitbook.com/s/ASSiAvbL4nFnkl8plQy2/getting-started/queries/search)) on **3** specific **resources** ([orders](https://docs.commercelayer.io/metrics-api-reference/resources/orders), [returns](https://docs.commercelayer.io/metrics-api-reference/resources/returns), and [carts](https://docs.commercelayer.io/metrics-api-reference/resources/carts) — more to come) by exposing **12** endpoints you can easily build starting from the base endpoint, according to the following format:

```http
https://{{your_domain}}.commercelayer.io/metrics/{{resource_name}}/{{query_type}}
```

{% hint style="info" %}
Commerce Layer Metrics API is currently released in **open beta**. Please [read here](https://app.gitbook.com/s/ASSiAvbL4nFnkl8plQy2/getting-started/api-specification) to get all the information about the API specification and latest version.
{% endhint %}

This guide is a detailed reference where you can explore the comprehensive lists of the available fields and attributes of the resources in question, along with all the available values for the query keys and filter operators.

{% content-ref url="resources/orders" %}
[orders](https://docs.commercelayer.io/metrics-api-reference/resources/orders)
{% endcontent-ref %}

{% content-ref url="resources/returns" %}
[returns](https://docs.commercelayer.io/metrics-api-reference/resources/returns)
{% endcontent-ref %}

{% content-ref url="resources/carts" %}
[carts](https://docs.commercelayer.io/metrics-api-reference/resources/carts)
{% endcontent-ref %}

We are also planning to provide a set of dedicated endpoints designed to support common analytical use cases — such as identifying correlations between products added to the cart, determining the most popular items, or calculating how frequently specific products are purchased. These endpoints enable you to retrieve meaningful insights through simple, yet flexible and customizable queries. Consider them as helpers to accelerate the use of the Metrics API (more coming soon!).

{% content-ref url="helpers/analysis" %}
[analysis](https://docs.commercelayer.io/metrics-api-reference/helpers/analysis)
{% endcontent-ref %}

### How it works

For each single resource you can find:

* All the order resource's **fields** and **attributes** that are accessible through the Metrics API.
* For each type of query, the allowed values for the **query keys** and **query operators**.
* For each type of query, the **filterable fields** and the allowed values for the **filter operators**.
* For each type of query, some basic **examples** to help you get started.

{% hint style="success" icon="robot" %}
Commerce Layer documentation is [LLM-ready](https://app.gitbook.com/s/XD42JVYENWrharWaLF3W/#llm-friendly)! To feed the knowledge base into your own LLM, read [this file](https://docs.commercelayer.io/llms.txt).
{% endhint %}

### More to read

See the Metrics API [Getting started](https://app.gitbook.com/o/-Lfu_B3DKew-kvoEWzTk/s/ASSiAvbL4nFnkl8plQy2/) guide for all the information on how [queries](https://app.gitbook.com/s/ASSiAvbL4nFnkl8plQy2/getting-started/queries) and [filters](https://app.gitbook.com/s/ASSiAvbL4nFnkl8plQy2/getting-started/filters) work or any other instruction you need to use it (a useful list of data analysis [helper endpoints](https://app.gitbook.com/s/ASSiAvbL4nFnkl8plQy2/getting-started/analysis) included).

Check Commerce Layer's [changelog](https://docs.commercelayer.io/changelog/) to stay up-to-date with any changes, new features, and general improvements about the Metric API itself or any other Commerce Layer's app and open-source project.

Read the [Use cases](https://app.gitbook.com/s/ASSiAvbL4nFnkl8plQy2/getting-started/use-cases) section for more examples of which queries and filters to use to get the most common metrics from your ecommerce data history.

If you're new to [Commerce Layer](https://commercelayer.io/) you can [sign up for free](https://dashboard.commercelayer.io/sign_up) and try our Core commerce API while reading the [documentation](https://docs.commercelayer.io/).

For everything else, [join us on Discord](https://discord.gg/commercelayer) and feel free to ask any questions to the team or get involved in the conversation with the rest of our developers' community.
