Add an Entry to the Audit Log

This API allows you to insert an Audit Log. Generally, Audit Logs are created automatically whenever an admin does something from the FusionAuth UI. However, you can use this API to insert Audit Logs directly if you need.

Request#

API Key Authentication
Create an Audit Log
POST/api/system/audit-log
OpenAPI Spec

Request Body#

auditLog.dataObjectoptional

An object that can hold additional details of an audit log.

auditLog.newValueStringoptional

Intended to be utilized during a change to record the new value.

auditLog.oldValueStringoptional

Intended to be utilized during a change to record the old value prior to the change.

auditLog.reasonStringoptional

Intended to be utilized during a change to indicate the reason for the modification.

auditLog.tenantIdUUIDoptionalAvailable since 1.65.0

The Id of the Tenant associated with this Audit Log. This field will be overridden if the request contains an X-FusionAuth-TenantId header, or if the supplied API key is scoped to a specific Tenant.

auditLog.insertUserStringrequired

The user that took the action that is being written to the Audit Logs. We suggest you use email addresses for this field.

auditLog.messageStringrequired

The message of the Audit Log.

Example Request JSON

{
  "auditLog": {
    "data": {
      "externalId": "_applicationA"
    },
    "newValue:": "{\"name\": \"bar\"}",
    "oldValue": "{\"name\": \"foo\"}",
    "reason": "Because I like to change things.",
    "insertUser": "user@fusionauth.io",
    "message": "Example audit log"
  }
}

Response#

The response for this API does not contain a body. It only contains a status code.

Response Codes
CodeDescription
200The request was successful. The response will contain a JSON body.
400The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present.
401You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication.
500There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty.
503The search index is not available or encountered an exception so the request cannot be completed. The response will contain a JSON body.