# Logs

GET https://analytics.alephant.io/v1/analytics/saas/logs

Business request-log list with pagination metadata.

**Time window — provide one of:**
- `dateFrom` + `dateTo` (`YYYY-MM-DD`), or
- `start` + `end` (ISO 8601 datetimes).

If **both** pairs are present, the **ISO** `start`/`end` pair wins.

**Filters:** at most one of `agentId` vs `memberId`; do not combine `entityType` with agent/member ids (`40028`). `entityType` ∈ `agent` | `user` | `member` (`member` maps to user internally). `search` non-empty must be UUID (`40027`). `masterKeyId` / `departmentId` optional UUIDs.

**Pagination:** `limit` (default 20, max 200), `offset` **or** `page` + optional `pageSize`.

**Success `data`:** `{ "period", "data": [...], "meta": { "total", "hasMore", "limit", "offset", ... } }`

Reference: https://api.alephant.io/api-reference/analytics-api/analytics-saas/get-logs

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: analytics-openapi
  version: 1.0.0
paths:
  /v1/analytics/saas/logs:
    get:
      operationId: get-logs
      summary: Logs
      description: >-
        Business request-log list with pagination metadata.


        **Time window — provide one of:**

        - `dateFrom` + `dateTo` (`YYYY-MM-DD`), or

        - `start` + `end` (ISO 8601 datetimes).


        If **both** pairs are present, the **ISO** `start`/`end` pair wins.


        **Filters:** at most one of `agentId` vs `memberId`; do not combine
        `entityType` with agent/member ids (`40028`). `entityType` ∈ `agent` |
        `user` | `member` (`member` maps to user internally). `search` non-empty
        must be UUID (`40027`). `masterKeyId` / `departmentId` optional UUIDs.


        **Pagination:** `limit` (default 20, max 200), `offset` **or** `page` +
        optional `pageSize`.


        **Success `data`:** `{ "period", "data": [...], "meta": { "total",
        "hasMore", "limit", "offset", ... } }`
      tags:
        - subpackage_analyticsSaas
      parameters:
        - name: dateFrom
          in: query
          description: >-
            Calendar start `YYYY-MM-DD` (use with `dateTo` unless ISO pair
            used).
          required: false
          schema:
            type: string
        - name: dateTo
          in: query
          description: Calendar end `YYYY-MM-DD`.
          required: false
          schema:
            type: string
        - name: start
          in: query
          description: >-
            ISO 8601 start (pair with `end`; overrides calendar pair when both
            pairs present).
          required: false
          schema:
            type: string
        - name: end
          in: query
          description: ISO 8601 end; must be after `start`.
          required: false
          schema:
            type: string
        - name: agentId
          in: query
          description: Agent UUID; mutually exclusive with `memberId`.
          required: false
          schema:
            type: string
        - name: memberId
          in: query
          description: Member UUID; mutually exclusive with `agentId`.
          required: false
          schema:
            type: string
        - name: entityType
          in: query
          description: >-
            `agent` | `user` | `member` for type-only filter; not with
            agentId/memberId.
          required: false
          schema:
            type: string
        - name: masterKeyId
          in: query
          description: Optional master key UUID.
          required: false
          schema:
            type: string
        - name: departmentId
          in: query
          description: Optional department UUID.
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Non-empty must be UUID (entity/user id search).
          required: false
          schema:
            type: string
        - name: model
          in: query
          description: Exact model filter after trim.
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: Page size (default 20, max 200).
          required: false
          schema:
            type: integer
        - name: offset
          in: query
          description: 0-based offset (alternative to `page`).
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: 1-based page index when not using `offset`.
          required: false
          schema:
            type: integer
        - name: pageSize
          in: query
          description: Used with `page` (capped with `limit` semantics, max 200).
          required: false
          schema:
            type: integer
        - name: status
          in: query
          description: HTTP status filter as integer string.
          required: false
          schema:
            type: string
        - name: Authorization
          in: header
          description: >-
            Optional. Bearer JWT, Virtual Key, or PAT. Server also accepts
            Cookie `alephant_token`; not modeled as a header here.
          required: false
          schema:
            type: string
        - name: X-Workspace-Id
          in: header
          description: >-
            Optional in the spec; required for authenticated analytics. Omit for
            unauthenticated `GET /v1/analytics/health`.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsJsonResponse'
servers:
  - url: https://analytics.alephant.io
  - url: https://analytics-dev.alephant.io
components:
  schemas:
    AnalyticsJsonResponse:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
        data:
          description: Any type
      required:
        - code
        - message
        - data
      title: AnalyticsJsonResponse

```

## SDK Code Examples

```python
import requests

url = "https://analytics.alephant.io/v1/analytics/saas/logs"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://analytics.alephant.io/v1/analytics/saas/logs';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://analytics.alephant.io/v1/analytics/saas/logs"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://analytics.alephant.io/v1/analytics/saas/logs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://analytics.alephant.io/v1/analytics/saas/logs")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://analytics.alephant.io/v1/analytics/saas/logs');

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://analytics.alephant.io/v1/analytics/saas/logs");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://analytics.alephant.io/v1/analytics/saas/logs")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```