# Tracking user access to Textual

{% hint style="info" %}
Required global permissions:

* Manage users and user groups
* View all datasets
  {% endhint %}

Textual provides a REST API endpoint to track the following events that are related to user access and permissions:

* User account is created
* User account is removed
* User logs into Textual
* User fails to log into Textual
* User attempts to perform an action that they do not have permission for
* A permission set is created, updated, or deleted
* Permissions are added or removed from a permission set
* A permission set is added to or removed from a user or user group

In the results, each event includes the following information:

* Description of the action
* The user who performed the action
* When the action occurred

To request the access and permission events, use the following endpoint:

## Search audit events

> By default, the most recent 100 results will be returned.\
> &#x20;           \
> \*\*Adding filters to the request\*\*\
> &#x20;           \
> For each filter to add, use the following format:\
> &#x20;           \
> &#x20;   parameterName=value\
> &#x20;           \
> Use & to separate multiple filter values:\
> &#x20;           \
> &#x20;   parameter1Name=parameter1Value\&parameter2Name=parameter2Value\
> &#x20;           \
> \*\*Valid filter parameters\*\*\
> &#x20;           \
> You can filter the included events based on the following parameters:\
> &#x20;           \
> \<i>event\_category\</i> - The general category of event.\
> For example, to filter the results to only include events related to permission sets:\
> &#x20;           \
> &#x20;   event\_category=PermissionSet\
> &#x20;           \
> You can provide multiple event category values.\
> For example, to filter the results to include events related to both assigned permissions and permission sets:\
> &#x20;           \
> &#x20;   event\_category=PermissionSet\&event\_category=AssignedPermissions\
> &#x20;           \
> \<i>event\_type\</i> - The specific type of event.\
> To get the available event types, refer to Solar.Core.Enums.AuditEvents.AuditEventType.\
> For example, to filter the results to only include when a permission set was created:\
> &#x20;           \
> &#x20;   event\_type=PermissionSetCreated\
> &#x20;           \
> You can provide multiple event type values.\
> For example, to filter the results to include both when a permission set was created and when a permission set was updated:\
> &#x20;           \
> &#x20;   event\_type=PermissionSetCreated\&event\_type=PermissionSetUpdated\
> &#x20;           \
> \<i>outcome\</i> - Whether the event was successful (\<i>Success\</i>) or failed (\<i>Fail\</i>).\
> For example, to filter the results to only include successful events:\
> &#x20;           \
> &#x20;   outcome=Success\
> &#x20;           \
> \<i>created\_before\</i> - Used to only include events that occurred before the specified timestamp.\
> &#x20;           \
> The timestamp uses the ISO 8601 format (\<i>yyyy-MM-dd'T'HH:mm:ssZ\</i>).\
> For example, to filter the results to only include events that occurred before 6:30 PM UTC on August 1, 2023:\
> &#x20;           \
> &#x20;   created\_before=2023-08-01T18:30:00Z\
> &#x20;           \
> \<i>created\_after\</i> - Used to only include events that occurred after the specified timestamp.\
> &#x20;           \
> The timestamp uses the ISO 8601 format (\<i>yyyy-MM-dd'T'HH:mm:ssZ\</i>).\
> For example, to filter the results to only include events that occurred after 10:00 AM UTC on July 27, 2023:\
> &#x20;           \
> &#x20;   created\_after=2023-07-27T10:00:00Z\
> &#x20;           \
> \<i>include\_unidentified\_events\</i> - For self-hosted instances, whether to include events that do not have an identified user.\
> By default, is false. These events might be server-generated or might be related to an unauthenticated action.\
> To include events that do not have an identified user:\
> &#x20;           \
> &#x20;   include\_unidentified\_events=true\
> &#x20;           \
> \*\*Sample requests:\*\*\
> &#x20;           \
> First 100 results by most recent:\
> &#x20;           \
> &#x20;   GET /api/audit-events/search\
> &#x20;           \
> Returns the first 20 results for permission set events that were successful:\
> &#x20;           \
> &#x20;   GET /api/audit-events/search?limit=20\&event\_category=PermissionSet\&outcome=Success\
> \### Required Permissions\
> \
> \- \*\*Global:\*\* Manage Users And Groups, View All Datasets<br>

```json
{"openapi":"3.0.4","info":{"title":"Textual API","version":"vDev"},"tags":[{"name":"Audit Events","description":"Search and retrieve audit events related to user access, actions, and permissions within your organization."}],"security":[{}],"paths":{"/api/audit-events/search":{"get":{"tags":["Audit Events"],"summary":"Search audit events","description":"By default, the most recent 100 results will be returned.\n            \n**Adding filters to the request**\n            \nFor each filter to add, use the following format:\n            \n    parameterName=value\n            \nUse & to separate multiple filter values:\n            \n    parameter1Name=parameter1Value&parameter2Name=parameter2Value\n            \n**Valid filter parameters**\n            \nYou can filter the included events based on the following parameters:\n            \n<i>event_category</i> - The general category of event.\nFor example, to filter the results to only include events related to permission sets:\n            \n    event_category=PermissionSet\n            \nYou can provide multiple event category values.\nFor example, to filter the results to include events related to both assigned permissions and permission sets:\n            \n    event_category=PermissionSet&event_category=AssignedPermissions\n            \n<i>event_type</i> - The specific type of event.\nTo get the available event types, refer to Solar.Core.Enums.AuditEvents.AuditEventType.\nFor example, to filter the results to only include when a permission set was created:\n            \n    event_type=PermissionSetCreated\n            \nYou can provide multiple event type values.\nFor example, to filter the results to include both when a permission set was created and when a permission set was updated:\n            \n    event_type=PermissionSetCreated&event_type=PermissionSetUpdated\n            \n<i>outcome</i> - Whether the event was successful (<i>Success</i>) or failed (<i>Fail</i>).\nFor example, to filter the results to only include successful events:\n            \n    outcome=Success\n            \n<i>created_before</i> - Used to only include events that occurred before the specified timestamp.\n            \nThe timestamp uses the ISO 8601 format (<i>yyyy-MM-dd'T'HH:mm:ssZ</i>).\nFor example, to filter the results to only include events that occurred before 6:30 PM UTC on August 1, 2023:\n            \n    created_before=2023-08-01T18:30:00Z\n            \n<i>created_after</i> - Used to only include events that occurred after the specified timestamp.\n            \nThe timestamp uses the ISO 8601 format (<i>yyyy-MM-dd'T'HH:mm:ssZ</i>).\nFor example, to filter the results to only include events that occurred after 10:00 AM UTC on July 27, 2023:\n            \n    created_after=2023-07-27T10:00:00Z\n            \n<i>include_unidentified_events</i> - For self-hosted instances, whether to include events that do not have an identified user.\nBy default, is false. These events might be server-generated or might be related to an unauthenticated action.\nTo include events that do not have an identified user:\n            \n    include_unidentified_events=true\n            \n**Sample requests:**\n            \nFirst 100 results by most recent:\n            \n    GET /api/audit-events/search\n            \nReturns the first 20 results for permission set events that were successful:\n            \n    GET /api/audit-events/search?limit=20&event_category=PermissionSet&outcome=Success\n### Required Permissions\n\n- **Global:** Manage Users And Groups, View All Datasets\n","parameters":[{"name":"offset","in":"query","description":"Number of records to skip for pagination","schema":{"type":"integer","format":"int32"}},{"name":"limit","in":"query","description":"Maximum number of records to return","schema":{"type":"integer","format":"int32"}},{"name":"event_category","in":"query","description":"Filter by event category","schema":{"type":"array","items":{"$ref":"#/components/schemas/AuditEventCategory"}}},{"name":"event_type","in":"query","description":"Filter by specific event type","schema":{"type":"array","items":{"$ref":"#/components/schemas/AuditEventType"}}},{"name":"outcome","in":"query","description":"Filter by event outcome (Success or Fail)","schema":{"allOf":[{"$ref":"#/components/schemas/AuditEventOutcome"}]}},{"name":"created_before","in":"query","description":"Only include events before this timestamp (ISO 8601)","schema":{"type":"string","format":"date-time"}},{"name":"created_after","in":"query","description":"Only include events after this timestamp (ISO 8601)","schema":{"type":"string","format":"date-time"}},{"name":"include_unidentified_events","in":"query","description":"Include events without an identified user (self-hosted only)","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Returns paginated audit events","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditEventModelPaginationResponseModel"}}}},"400":{"description":"Invalid filter parameters or unsupported query option","content":{"text/plain":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"string"}},"text/json":{"schema":{"type":"string"}}}}}}}},"components":{"schemas":{"AuditEventCategory":{"enum":["PermissionSet","AssignedPermissions","UserAuthentication","UserAccountManagement","Api"],"type":"string","description":"<p>Possible values:</p>\n<ul>\n<li><b>PermissionSet</b>: Contains events for management of permission sets in the application</li>\n<li><b>AssignedPermissions</b>: Contains events for permissions that are granted to users or groups for all datasets.</li>\n<li><b>UserAuthentication</b>: Contains events for user authentication</li>\n<li><b>UserAccountManagement</b>: Contains events for user account management</li>\n<li><b>Api</b>: Contains events for API authentication and authorization</li>\n</ul>\n"},"AuditEventType":{"enum":["UserCreated","UserRemoved","UserLogin","ApiAuthentication","ApiAuthorization","PermissionSetCreated","PermissionSetUpdated","PermissionSetDeleted","GlobalPermissionSetAssigned","GlobalPermissionSetRevoked","DatasetPermissionSetAssigned","DatasetPermissionSetRevoked"],"type":"string","description":"The specific type of audit event, such as user creation, login, or permission changes."},"AuditEventOutcome":{"enum":["Fail","Success"],"type":"string","description":"The status of the audit event. Some event types may only log Success or Fail events."},"AuditEventModelPaginationResponseModel":{"required":["records"],"type":"object","properties":{"offset":{"type":"integer","description":"The offset from the first item in the results. For example, 20 indicates that this batch of results starts with the 21st result.","format":"int32"},"limit":{"type":"integer","description":"The number of items the request limited the search to. The number of returned items can be less than the limit if not enough items exist or match the filter criteria.","format":"int32"},"pageNumber":{"type":"integer","description":"The number for this page of the results, starting at 1.","format":"int32"},"totalPages":{"type":"integer","description":"The total number of pages in the results.","format":"int32"},"totalRecords":{"type":"integer","description":"The total number of records in the results.","format":"int32"},"absoluteTotalRecords":{"type":"integer","description":"The absolute total number of records available (unfiltered). This represents the total count without any search or filter applied.","format":"int32"},"hasPreviousPage":{"type":"boolean","description":"Whether there is a previous page of results."},"hasNextPage":{"type":"boolean","description":"Whether there is a next page of results."},"records":{"type":"array","items":{"$ref":"#/components/schemas/AuditEventModel"},"description":"An array of returned records."}},"additionalProperties":false,"description":"Paginated response wrapper containing a page of results along with pagination metadata."},"AuditEventModel":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier of the audit event."},"timestamp":{"allOf":[{"$ref":"#/components/schemas/Instant"}],"description":"The time the event occurred."},"eventCategory":{"enum":["PermissionSet","AssignedPermissions","UserAuthentication","UserAccountManagement","Api"],"allOf":[{"$ref":"#/components/schemas/AuditEventCategory"}],"description":"The general category of the event (e.g. PermissionSet, AssignedPermissions).<p>Possible values:</p>\n<ul>\n<li><b>PermissionSet</b>: Contains events for management of permission sets in the application</li>\n<li><b>AssignedPermissions</b>: Contains events for permissions that are granted to users or groups for all datasets.</li>\n<li><b>UserAuthentication</b>: Contains events for user authentication</li>\n<li><b>UserAccountManagement</b>: Contains events for user account management</li>\n<li><b>Api</b>: Contains events for API authentication and authorization</li>\n</ul>\n"},"eventType":{"enum":["UserCreated","UserRemoved","UserLogin","ApiAuthentication","ApiAuthorization","PermissionSetCreated","PermissionSetUpdated","PermissionSetDeleted","GlobalPermissionSetAssigned","GlobalPermissionSetRevoked","DatasetPermissionSetAssigned","DatasetPermissionSetRevoked"],"allOf":[{"$ref":"#/components/schemas/AuditEventType"}],"description":"The specific type of event (e.g. PermissionSetCreated, PermissionSetUpdated)."},"outcome":{"enum":["Fail","Success"],"allOf":[{"$ref":"#/components/schemas/AuditEventOutcome"}],"description":"Whether the event was successful or failed."},"user":{"type":"string","description":"The user who performed or triggered the event."},"message":{"type":"string","description":"A human-readable description of the event."},"metadata":{"description":"Additional structured data associated with the event, if any.","nullable":true}},"additionalProperties":false,"description":"Contains the details for an audit event included in the results of a GET /api/audit-events/search request."},"Instant":{"type":"object","additionalProperties":false,"description":"A point in time represented as an ISO 8601 timestamp string."}}}}
```
