> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# Obter logs de auditoria do workspace

GET https://api.elevenlabs.io/v1/workspace/audit-logs

Retorna o log de auditoria do workspace. Requer o nível Enterprise e a permissão audit_log_read.

Reference: https://elevenlabs.io/docs/api-reference/workspace/audit-logs/list

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Request

### Query parameters

- `limit` (integer, optional, default: 50) — Número máximo de entradas por página
- `cursor` (string, optional, nullable) — Cursor para a próxima página (da resposta anterior)
- `time_from_unix_ms` (integer, optional, nullable) — Inclua apenas entradas neste momento ou posteriores a ele (ms desde a época)
- `time_to_unix_ms` (integer, optional, nullable) — Inclua apenas entradas neste momento ou anteriores a ele (ms desde a época)
- `actor_uid` (string, optional, nullable) — Filtrar por ID do usuário executor
- `class_name` (string, optional, nullable) — Filtrar por nome da classe de evento OCSF (por exemplo, Alteração de conta)
- `activity_name` (string, optional, nullable) — Filtrar por nome da atividade de auditoria (por exemplo, Criação de assinatura)

## Response

### 200

Resposta bem-sucedida

- `entries` (list of WorkspaceAuditLogEntryResponse, required)
- `has_more` (boolean, required)
- `next_cursor` (string, required, nullable)

## Errors

### 422 Unprocessable Entity Error

Erro de validação

- `detail` (list of ValidationError, optional)

## Types

### WorkspaceAuditLogEntryResponse

Entrada de log de auditoria com ID de documento do Firestore para respostas da API.

- `activity_id` (WorkspaceAuditLogEntryResponseActivityId, required) — ID da atividade
- `activity_name` (string, required) — Nome da atividade
- `status_id` (enum, required) — Status da ação
  - Allowed values: `0`, `1`, `2`, `99`
- `actor` (ActorModel, required) — Ator que executa a ação
- `message` (string, required) — Descrição do evento legível para humanos
- `id` (string, required) — ID do documento no Firestore
- `time_dt` (string, required) — Horário do evento no formato RFC 3339 legível por humanos, derivado de 'time'.
- `type_uid` (integer, required) — type_uid do OCSF é class_uid * 100 + activity_id.
- `type_name` (string, required) — type_name do OCSF combina class_name e activity_name.
- `metadata` (map from string to any, optional) — Metadados do evento
- `time` (integer, optional) — Horário do evento em milissegundos desde a época Unix
- `category_name` (string, optional, default: Identity & Access Management) — Categoria do evento
- `category_uid` (integer, optional, default: 3) — UID da categoria para IAM
- `class_name` (string, optional, default: ) — Nome da classe de evento
- `class_uid` (integer, optional, default: 0) — UID da classe de evento
- `severity_id` (enum, optional) — Nível de gravidade
  - Allowed values: `0`, `1`, `2`, `3`, `4`, `5`, `6`, `99`
- `device` (DeviceModel, optional, nullable) — Informações do dispositivo
- `http_request` (HttpRequestModel, optional, nullable) — Detalhes da solicitação HTTP
- `unmapped` (map from string to any, optional) — Atributos não mapeados para OCSF

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### WorkspaceAuditLogEntryResponseActivityId

ID da atividade

### ActorModel

Objeto Actor do OCSF — descreve a entidade que realizou a ação. Especificação: https://schema.ocsf.io/1.6.0/objects/actor

- `user` (UserModel, required) — Usuário que realizou a ação
- `app_name` (string, optional, nullable) — Nome do aplicativo ou serviço cliente
- `app_uid` (string, optional, nullable) — Identificador exclusivo do aplicativo cliente
- `session` (map from string to any, optional, nullable) — Informações da sessão

### DeviceModel

Informações do dispositivo. Especificação: https://schema.ocsf.io/1.6.0/objects/device

- `ip` (string, optional, nullable) — Endereço IP
- `hostname` (string, optional, nullable) — Nome do host do dispositivo
- `type_id` (integer, optional, default: 99) — ID do tipo de dispositivo (99 = Desconhecido)

### HttpRequestModel

Detalhes da solicitação HTTP. Especificação: https://schema.ocsf.io/1.6.0/objects/http_request

- `http_method` (string, required) — Método HTTP (GET, POST etc.)
- `url` (UrlModel, required) — Objeto de URL da solicitação
- `user_agent` (string, optional, nullable) — String do agente do usuário
- `x_forwarded_for` (list of string, optional, nullable) — Cabeçalho X-Forwarded-For como uma lista

### ValidationErrorLocItems

### UserModel

Objeto User do OCSF. Especificação: https://schema.ocsf.io/1.6.0/objects/user

- `name` (string, optional, nullable) — Username
- `uid` (string, optional, nullable) — Identificador exclusivo do usuário
- `type_id` (enum, optional) — Identificador do tipo de conta
  - Allowed values: `0`, `1`, `2`, `3`, `4`, `99`
- `type` (string, optional, nullable) — Descrição do tipo de conta
- `email_addr` (string, optional, nullable) — Endereço de e-mail do usuário
- `full_name` (string, optional, nullable) — Nome completo do usuário
- `domain` (string, optional, nullable) — Domínio do usuário

### UrlModel

Objeto URL do OCSF. Especificação: https://schema.ocsf.io/1.6.0/objects/url

- `url_string` (string, optional, nullable) — String de URL completa
- `scheme` (string, optional, nullable) — Esquema da URL (por exemplo, https)
- `hostname` (string, optional, nullable) — Nome de host da URL
- `port` (integer, optional, nullable) — Porta da URL
- `path` (string, optional, nullable) — Caminho da URL
- `query_string` (string, optional, nullable) — String de consulta da URL

## Examples

**Response**

```json
{
  "entries": [
    {
      "activity_id": 0,
      "activity_name": "string",
      "status_id": 0,
      "actor": {
        "user": {
          "name": "string",
          "uid": "string",
          "type_id": 0,
          "type": "string",
          "email_addr": "string",
          "full_name": "string",
          "domain": "string"
        },
        "app_name": "string",
        "app_uid": "string",
        "session": {}
      },
      "message": "string",
      "id": "string",
      "time_dt": "string",
      "type_uid": 1,
      "type_name": "string",
      "metadata": {},
      "time": 1,
      "category_name": "Identity & Access Management",
      "category_uid": 3,
      "class_name": "",
      "class_uid": 0,
      "severity_id": 0,
      "device": {
        "ip": "string",
        "hostname": "string",
        "type_id": 99
      },
      "http_request": {
        "http_method": "string",
        "url": {
          "url_string": "string",
          "scheme": "string",
          "hostname": "string",
          "port": 1,
          "path": "string",
          "query_string": "string"
        },
        "user_agent": "string",
        "x_forwarded_for": [
          "string"
        ]
      },
      "unmapped": {}
    }
  ],
  "has_more": true,
  "next_cursor": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/workspace/audit-logs"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/workspace/audit-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://api.elevenlabs.io/v1/workspace/audit-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://api.elevenlabs.io/v1/workspace/audit-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://api.elevenlabs.io/v1/workspace/audit-logs")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/workspace/audit-logs');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/workspace/audit-logs");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/workspace/audit-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()
```