1Password Events API Generic Scripts

This repository contains scripts in several languages to get started with the Events API.

All scripts use the EVENTS_API_TOKEN environment variable to load your API token. You should use op run and secret references provided by the 1Password CLI to securely load environment variables.

Example 1 - using an .env file, running the PHP script:

op run --env-file .env -- php eventsapi.php

Example 2 - providing variables inline, running the Go script:

EVENTS_API_TOKEN="op://Vault/Item/token" op run -- go run eventsapi.go

You can generate an API bearer token on 1Password.com or with the CLI.

The script will print up to 20 audit events, sign-in attempts, or item usages from the last 24 hours.

Learn more about how to get started with 1Password Events Reporting.