Your developers use API keys to connect your website or app to PaymentHooks. Every key belongs to a business, and each business can have one active key pair.
| Key | Starts with | Used for |
|---|---|---|
| Secret | phk_live_ | Your server. Never share it or put it in a web page or app. |
| Publishable | phk_pub_ | Browser or app code. It can only read payments, customers and products. |
Create a key
- 1Open Developers > API Keys.
- 2Click Create Key.
- 3Choose the Business the key belongs to.
- 4Enter a Key Name, for example
Production server. - 5Under Permissions, keep full access or limit the key to the areas it needs.
- 6Create the key and copy both keys right away.
You can also create a key from Developers > Businesses with Create Key on a business.
Permissions
Permissions are grouped by area, each with read and write access: Payments, Customers, Subscriptions, Invoices, Products, Entitlements, Payment links, Billing, Tax, Routing, Webhooks, Reports, Account and Custom domains, plus read-only access to the Activity log. A new secret key has full access unless you restrict it. To change an active key, click Edit permissions.
Team members can create keys and change key permissions only if their role includes Account write, and only with permissions their own role has. Key permissions can be changed only in the dashboard, never with an API key. A key always belongs to one of your own businesses.
An API key that has Account write can create other keys through the API, but never with a permission it does not have itself. Asking for more is refused with 403 PRIVILEGE_ESCALATION, which names the missing permissions.
Revoke a key
Click Revoke, then Revoke Key to confirm. The key stops working immediately, and any integration using it stops working too. You are emailed when a key is created or revoked.
Each key shows when it was created and last used.