Forum Discussion

jhugery's avatar
jhugery
New Contributor
1 month ago
Solved

Events API

We need to track events occurring in 1password.  I have enabled the Events API integration.  If I run the CURL command:  

 

curl --request POST \

--url https://events.1password.com/api/v2/auditevents \

--header 'Authorization: Bearer <mytoken>' \

--header 'Content-Type: application/json' \

--data '{

"limit":1,

"start_time": "2026-01-01T00:00:00Z"

 

}'

 

Being a windows shop, we prefer to use powershell for API requests.  If I repackage the above into the following script, I continually get "Bad Request"

 

 

 

$tok="<my token>"

$header=@{

Authorization = "Bearer $($tok)"

'Content-Type'='application/json'

}

$data=@{

limit=100

'start_time'= '01-01-2026T00:00:00Z'

}

$url="https://events.1password.com/api/v2/auditevents"

$response=Invoke-WebRequest -Uri $url -headers $header -Method post -Body $data -Authentication

$response

 

I cannot figure out the issue.  Any ideas?

  • nm.  we figured it out. I had to convert the $data field to json and all now works

     

1 Reply

  • jhugery's avatar
    jhugery
    New Contributor

    nm.  we figured it out. I had to convert the $data field to json and all now works