# Console Logs API

## Get console logs for a specific solve.

> Retrieves console logs for a specific rule solve identified by its \`correlationId\`.\
> The \`correlationId\` can be obtained from the \`X-Correlation-Id\` response header of the Rule Solver API.\
> Logs are only generated when the solve is run in debug mode (e.g., using the \`X-Debug: true\` header).<br>

```json
{"openapi":"3.0.0","info":{"title":"Console Logs API","version":"1.0.0"},"servers":[{"url":"https://api.decisionrules.io/consoleLogs"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"ApiKey"}},"schemas":{"LogDetailResponse":{"type":"object","properties":{"_id":{"type":"string"},"apiKey":{"$ref":"#/components/schemas/ApiKey"},"id":{"type":"string"},"time":{"type":"string","format":"date-time"},"logs":{"type":"array","items":{"$ref":"#/components/schemas/ConsoleLogEntry"}},"baseId":{"type":"string"},"input":{"$ref":"#/components/schemas/Input"},"output":{"type":"array","items":{"$ref":"#/components/schemas/OutputItem"}},"correlationId":{"type":"string","format":"uuid"}}},"ApiKey":{"type":"object","properties":{"created":{"type":"string","format":"date-time"},"type":{"type":"string"},"key":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}}},"ConsoleLogEntry":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time","description":"The timestamp of the log entry."},"level":{"type":"string","description":"The severity level of the log entry (e.g., INFO, WARN, ERROR)."},"message":{"type":"string","description":"The log message."}}},"Input":{"type":"object","additionalProperties":true},"OutputItem":{"type":"object","properties":{"prices":{"type":"object","properties":{"finalPrice":{"type":"number"},"crudePrice":{"type":"number"}}},"message":{"type":"string"}}}}},"paths":{"/{correlationId}":{"get":{"summary":"Get console logs for a specific solve.","description":"Retrieves console logs for a specific rule solve identified by its `correlationId`.\nThe `correlationId` can be obtained from the `X-Correlation-Id` response header of the Rule Solver API.\nLogs are only generated when the solve is run in debug mode (e.g., using the `X-Debug: true` header).\n","operationId":"getConsoleLogs","parameters":[{"name":"correlationId","in":"path","required":true,"description":"The unique identifier for a rule solve.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Console logs retrieved successfully.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LogDetailResponse"}}}}},"401":{"description":"Unauthorized. Invalid or missing API key."},"404":{"description":"Not Found. No logs found for the given `correlationId`, or the logs have expired."}}}}}}
```

## The ConsoleLogEntry object

```json
{"openapi":"3.0.0","info":{"title":"Console Logs API","version":"1.0.0"},"components":{"schemas":{"ConsoleLogEntry":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time","description":"The timestamp of the log entry."},"level":{"type":"string","description":"The severity level of the log entry (e.g., INFO, WARN, ERROR)."},"message":{"type":"string","description":"The log message."}}}}}}
```

## The LogsResponse object

```json
{"openapi":"3.0.0","info":{"title":"Console Logs API","version":"1.0.0"},"components":{"schemas":{"LogsResponse":{"type":"object","properties":{"correlationId":{"type":"string","format":"uuid","description":"The correlation ID for the solve."},"logs":{"type":"array","items":{"$ref":"#/components/schemas/ConsoleLogEntry"},"description":"An array of console log entries."}}},"ConsoleLogEntry":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time","description":"The timestamp of the log entry."},"level":{"type":"string","description":"The severity level of the log entry (e.g., INFO, WARN, ERROR)."},"message":{"type":"string","description":"The log message."}}}}}}
```
