Ready-to-run shell scripts for every endpoint of the Openapi OAuth V2 API.
Each script prompts for credentials interactively if the environment variables are not set.
All scripts are POSIX-compatible and work with sh, bash, and zsh.
curljq(optional — output is pretty-printed if available, raw JSON otherwise)
git clone https://github.com/openapi/get-started-with-oauth-v2.git
cd get-started-with-oauth-v2/examples/curl
sh 00-tokens-create.shYou can export your credentials once to skip the prompts across all scripts:
export OPENAPI_EMAIL="your@email.com"
export OPENAPI_KEY="your-api-key"To target the Sandbox instead of production (free, no charges):
export OPENAPI_BASE_URL="https://test.oauth.openapi.com"Use this as the first step of any integration: generate a token scoped to only the APIs your app needs. Useful for CI/CD pipelines, backend services, or handing a limited key to a third party.
sh 00-tokens-create.shCreate a token that caps total requests, wallet spend, and restricts usage to specific IPs. Ideal for partner integrations, sandboxed environments, or pay-per-use services where you want hard cost controls.
sh 01-tokens-create-limits.shAudit all active tokens on your account — useful during security reviews, before revoking stale keys, or to check which services are still active.
sh 02-tokens-list.shInspect a specific token's scopes, limits, stats, and expiry. Handy when debugging an integration or verifying that limits were applied correctly after creation.
sh 03-tokens-get.shAdd or remove scopes, extend the TTL, or tighten limits on an existing token — without deleting and recreating it. Useful when requirements change mid-project or you need to grant access to a new API.
sh 04-tokens-update.shExchange the refresh token for a brand-new access token and refresh token pair, while preserving all scopes and accumulated stats. Use this for zero-downtime key rotation in production services.
sh 05-tokens-rotate.shPermanently revoke a token. Use this to clean up unused keys, respond to a potential credential leak, or decommission an integration.
sh 06-tokens-delete.shDiscover all the API endpoints your account has access to, along with their identifiers. Use this before creating a token to know exactly which scope strings to include.
sh 07-scopes-list.shInspect rate limits, free quotas, pricing, and requirements for a specific scope before enabling it on a token. Useful when estimating costs or checking if a scope needs additional account setup.
sh 08-scopes-get.shGet a snapshot of total requests, paid calls, errors, unique IPs, and wallet spend across all APIs. Useful for monthly reporting, cost forecasting, or spotting unexpected usage spikes.
sh 09-stats-overview.shRetrieve all IP addresses that made requests under your account in a given period. Useful for detecting unexpected callers, auditing access patterns, or building an IP allowlist.
sh 10-stats-ips.shSee how usage is distributed across all the API domains you consume — total calls, paid calls, errors, and spend per domain. Useful for understanding which integrations drive the most traffic or cost.
sh 11-stats-apis.shDrill into a single API domain to get per-scope breakdowns, IP lists, and granular metrics. Useful for debugging a specific integration or preparing a domain-level cost report.
sh 12-stats-domain.shCheck the current credit available on your account. Use this before running batch jobs or launching a new integration to make sure you have sufficient funds.
sh 13-wallet-balance.shBrowse the paginated history of credits and charges on your wallet. Useful for reconciling invoices, tracking spend over time, or identifying unexpected deductions.
sh 14-wallet-transactions.shList recent API errors with scope, HTTP status, error code, and the originating IP. Use this to diagnose integration failures, spot misconfigured tokens, or investigate 4xx spikes.
sh 15-errors-list.shView recent callback deliveries for async APIs — including destination URL, HTTP response code, and completion status. Useful for verifying that webhooks are reaching your endpoint.
sh 16-callbacks-list.shInspect a single callback in detail: payload, headers, elapsed time, attempt count, and retry history. Use this to debug a failed or slow callback delivery.
sh 17-callbacks-get.shView active subscriptions on your account, including available requests, expiry dates, and auto-renew status. Useful for checking quota before a high-volume job or managing renewals.
sh 18-subscriptions-list.shInspect a specific subscription's full detail: pricing, remaining requests, type, and timeline. Useful when evaluating whether to renew, upgrade, or switch to wallet-based billing.
sh 19-subscriptions-get.sh