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#
OpenAPI Spec
Request Body#
auditLog.dataObjectoptionalAn object that can hold additional details of an audit log.
auditLog.newValueStringoptionalIntended to be utilized during a change to record the new value.
auditLog.oldValueStringoptionalIntended to be utilized during a change to record the old value prior to the change.
auditLog.reasonStringoptionalIntended to be utilized during a change to indicate the reason for the modification.
auditLog.tenantIdUUIDoptionalAvailable since 1.65.0The 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.insertUserStringrequiredThe user that took the action that is being written to the Audit Logs. We suggest you use email addresses for this field.
auditLog.messageStringrequiredThe 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| Code | Description |
|---|---|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The 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. |
| 401 | You 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. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 503 | The search index is not available or encountered an exception so the request cannot be completed. The response will contain a JSON body. |