# Console Logs API

### Get Console Logs

This endpoint allows you to get console logs of specific solve.&#x20;

## Get Console Logs for a solve

<mark style="color:blue;">`GET`</mark> `https://api.decisionrules.io/consoleLogs/:correlationId`

#### Query Parameters

| Name                                            | Type   | Description                     |
| ----------------------------------------------- | ------ | ------------------------------- |
| correlationId<mark style="color:red;">\*</mark> | String | CorrelationId of specific solve |

#### Headers

| Name                                            | Type   | Description              |
| ----------------------------------------------- | ------ | ------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<Solver API Key> |

{% hint style="info" %}
If you're using the **Regional Cloud** version of DecisionRules, read more about API calls [here](https://docs.decisionrules.io/doc/v1/regional-cloud/region-specific-api-urls#making-api-calls-on-region-cloud-accounts).
{% endhint %}

You can get the **correlationId** parameter from the response Header of the Rule Solver API. The correlation id is stored under the response header key **X-Correlation-Id**. It is generated by the solver upon every run unless the user specifies their own correlation id in the request header.

{% hint style="info" %}
Note that console logs are only generated in **debug mode**. If you are using Test Bench, just click the **Debug** button. If you are sending requests via the Rule Solver API, you can activate debug mode by providing your request with the **X-Debug** header set to "true".
{% endhint %}

#### Console Logs lifetime

The console logs are stored for 10 minutes at this moment.

#### Response

The logs themselves are different for each type of rule. However, the basic structure of the response is always the same. It will be similar to the following.

```
[
    {
        "_id": "637f74324713c83aa450e38b",
        "apiKey": {
            "created": "2022-05-13T08:44:34.950Z",
            "type": "SOLVER",
            "key": "QyjvIdGhdDgUP6_Leko2DOyYaoSIA0axZlVcRrxbJzHazTOMn03GA5kiuIzgIw5z",
            "id": "6d4153a3-a215-e8e2-17bf-cd77534d07ff",
            "name": "S"
        },
        "id": "bdb5ac23-970c-146e-efe7-d49511f14b82",
        "time": "2022-11-24T13:40:02.184Z",
        "logs": [...],
        "baseId": "086233c6-8e45-0d88-328e-5e20fa544d2c",
        "input": {
            "productType": "basic",
            "period": "month",
            "promoCode": "SUMMER SALE"
        },
        "output": [
            {
                "prices": {
                    "finalPrice": 5.6,
                    "crudePrice": 8
                },
                "message": "30% discount"
            }
        ],
        "correlationId": "efc66cc4-e942-c687-74dc-67b0b1fdde49"
    }
]
```
