# List audit events (/docs/api-reference/audit-log/list-audit-events)

The organization's audit log, newest first: changes made by members in the dashboard, by API keys (from any environment) and by coss.com support. The audit log is organization-wide, so every key of the organization reads the same events. Filter by action (an entry ending in `.` matches a whole resource, e.g. `domain.`), actor, target, environment or time. Pass the last `id` as `after` to get the next page while `has_more` is true. Reading the audit log is not itself logged.

`GET https://api.coss.com/v1/audit_events`

Authenticate with your API key as a bearer token (`Authorization: Bearer coss_test_…`). Responses are JSON with snake_case fields; errors are `{ error: { type, code, message, param?, issues?, request_id } }` (https://coss.com/docs/api-reference/errors.md).

## Query parameters

- `action` (string): Only these actions, comma-separated. An entry ending in `.` matches every action of that resource: `domain.,api_key.created`.
- `actor_type` (string): Only these actor types, e.g. `user,api_key`.
- `actor_id` (string, at most 64 characters): Only changes made by this user or API key.
- `target_id` (string, at most 64 characters): Only changes to this resource, e.g. a `dom_…` id.
- `environment_id` (string, at most 64 characters): Only changes in this environment.
- `from` (string, date-time): Only events at or after this time.
- `to` (string, date-time): Only events before this time.
- `limit` (integer, 1-100): 1-100, default 50.
- `after` (string): Cursor: the `id` of the last event of the previous page.

## Example request

TypeScript (the `coss` package):

```ts
import { Coss } from "coss";

const coss = new Coss({
  apiKey: process.env.COSS_API_KEY,
  baseUrl: "https://api.coss.com",
});

const { data, error } = await coss.auditEvents.list();
```

HTTP:

```sh
curl -X GET "https://api.coss.com/v1/audit_events" \
  -H "Authorization: Bearer $COSS_API_KEY"
```

Python:

```python
from coss import Coss

client = Coss()  # api_key= or COSS_API_KEY

client.audit_events.list()
```

Go:

```go
import (
	"context"

	coss "github.com/cosscom/coss-go"
	cossclient "github.com/cosscom/coss-go/client"
)

client := cossclient.NewClient() // option.WithAPIKey(…) or COSS_API_KEY

request := &coss.ListAuditEventsRequest{}
client.AuditEvents.List(
    context.TODO(),
    request,
)
```

Ruby:

```ruby
require "coss"

client = Coss::Client.new # api_key: or COSS_API_KEY

client.audit_events.list
```

PHP:

```php
<?php

use Coss\Coss;
use Coss\AuditEvents\Requests\ListAuditEventsRequest;

$client = new Coss(); // apiKey: or COSS_API_KEY

$client->auditEvents->list(
    new ListAuditEventsRequest([]),
);
```

Java:

```java
import com.coss.Coss;
import com.coss.resources.auditevents.requests.ListAuditEventsRequest;

Coss client = Coss.builder().build(); // .apiKey(…) or COSS_API_KEY

client.auditEvents().list(
    ListAuditEventsRequest
        .builder()
        .build()
);
```

.NET:

```csharp
using Coss;

var client = new CossClient(); // apiKey: or COSS_API_KEY

await client.AuditEvents.ListAsync(new ListAuditEventsRequest());
```

## Response 200

A page of audit events.

- `object` ("list", required)
- `data` (object[], required)
  - `object` ("audit_event", required)
  - `id` (string, required)
  - `created_at` (string, required, date-time)
  - `actor_type` ("user" | "api_key" | "system", required): `user`: a member, in the dashboard (`actor_id` is the user's id, `actor_label` their email). `api_key`: a request made with an API key (`actor_id` is the key's id). `system`: coss.com itself, including coss.com support.
  - `actor_id` (string | null, required): The user's or API key's id; `null` for the system.
  - `actor_label` (string, required): Who made the change, copied when it was recorded so it outlives them: the user's email, the API key's id, or `coss.com support`.
  - `action` (string, required): `<resource>.<verb>`, e.g. `api_key.created`, `domain.deleted`, `member.role_changed`.
  - `target_type` (string | null, required): What was changed: `domain`, `api_key`, `member`…
  - `target_id` (string | null, required): The id of what it acted on. `null`: nothing in particular.
  - `target_label` (string | null, required): A readable name for the target when it was changed.
  - `project_id` (string | null, required): `null` for organization-wide changes (domains, members…).
  - `environment_id` (string | null, required): `null` for organization-wide changes (domains, members…).
  - `metadata` (map of any, required): Details of the change; API changes include their `request_id`.
  - `client_ip` (string | null, required): The actor's address. `null`: unknown.
  - `user_agent` (string | null, required): The actor's `User-Agent`. `null`: unknown.
- `has_more` (boolean, required)

Example:

```json
{
  "object": "list",
  "data": [
    {
      "object": "audit_event",
      "id": "oaudit_01k7c8m4q2f3e9v6t5r1n0p8yz",
      "created_at": "2026-01-15T09:30:00.000Z",
      "actor_type": "api_key",
      "actor_id": "key_01k7c8m4q2f3e9v6t5r1n0p8yz",
      "actor_label": "key_01k7c8m4q2f3e9v6t5r1n0p8yz",
      "action": "suppression.created",
      "target_type": "suppression",
      "target_id": "sup_01k7c8m4q2f3e9v6t5r1n0p8yz",
      "target_label": "user@example.com",
      "project_id": "proj_01k7c8m4q2f3e9v6t5r1n0p8yz",
      "environment_id": "env_01k7c8m4q2f3e9v6t5r1n0p8yz",
      "metadata": {
        "scope": "*",
        "request_id": "req_01k7c8m4q2f3e9v6t5r1n0p8yz"
      },
      "client_ip": "203.0.113.7",
      "user_agent": "coss-node/0.1.0"
    }
  ],
  "has_more": false
}
```

## Errors

- `400`: The `Coss-Version` header names an unknown API version (`invalid_api_version`).
- `401`: The API key is missing, invalid, revoked or expired (`authentication_error`).
- `402`: The organization's plan doesn't include the audit log (`plan_feature_unavailable`) (`billing_error`). Never retried: it needs a plan change or a payment.
- `403`: The API key lacks the permission this endpoint needs (`permission_error`), or its organization is suspended (`organization_suspended`).
- `422`: A query parameter failed validation (`validation_error`).
- `429`: Too many requests with this API key (`rate_limited`), or too many requests with invalid keys from this address (`too_many_failed_authentications`). Retry after `Retry-After` seconds. Successful responses carry `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds until the limit is fully restored).
- `500`: Unexpected server error (`api_error` / `internal_error`).
- `503`: The API key could not be verified right now; retry (`service_unavailable`).