Audit Log API error | Community
Skip to main content

Audit Log API error

  • August 15, 2022
  • 6 replies
  • 0 views

James48

I am using the API for Audit logs and it says i can use the filter[created_at] and whenever i use it i get the error at the bottom. Can't find out how to enter the value as an array. An example would be helpful or if this feature has a bug in it. Here is an example of how i am using it:

curl -g 'https://{subdomain}.zendesk.com/api/v2/audit_logs.json?filter[created_at]>2022-08-12T16:10:49Z' -v -H "Authorization: Basic *********************"

Keep in mind I have tested with the other filters and have not had any issues.

  "error": {

    "title": "Invalid attribute",

    "message": "You passed an invalid value for the filter.created_at attribute. Invalid parameter: filter.created_at must be an array from api/v2/audit_logs/index"

  }

6 replies

Eric27
  • August 16, 2022
Hey James,

I've marked this with our documentation team to get updated. What the endpoint is looking for is a range. I've included an example below:

https://{{subdomain}}.zendesk.com/api/v2/audit_logs.json?filter[created_at][]=2022-08-12T16:10:49Z&filter[created_at][]=2022-08-15T23:59:59Z

Hope this helps

Trevor23
  • October 22, 2024

This is still not corrected in the documentation but does indeed work. 


Greg29
  • October 22, 2024

Hi Trevor! It does look like it's updated here…do you see another area that it's missing? I'd be happy to update that as well!


Trevor23
  • October 23, 2024

The documentation does indicate that a range is required but the formatting is not clear/missing. 

 

A correct/working URL as mentioned above is "https://{zendesk_domain}/api/v2/audit_logs?filter[created_at][]={dayAgo}&filter[created_at][]={now}"

 

The extra square brackets `[]` after `[created_at]` is not mentioned anywhere in the documentation that I can find. The returned error when you do not use the extra set of braces mentions that an array is required but does not offer enough information to fully understand what the API is expecting. 


Greg29
  • October 24, 2024

I actually missed the part about the extra brackets, so that really drives home the point that you made, so I appreciate the follow-up! I'll make some recommendations and send it along to the team that owns that API to get it approved. Thanks for pointing this out!


Chris127
  • September 2, 2025

Wow, glad this post exists where the documentation doesn't.