Restricted API keys and webhook signing secrets
Restricted API keys and webhook signing secrets help protect your Paystack account. Restricted keys limit what each key can do, while webhook signing secrets let your server confirm that webhooks come from Paystack without using your secret key.
This article explains how these features work together and how to set them up on the new Paystack Dashboard.
How your integration talks to Paystack
Your integration and Paystack send messages to each other in two directions:
From you to Paystack (API requests): Your server asks Paystack to do something, such as start a transaction, check a payment or send a transfer. Paystack needs to know the request comes from you, so every request carries an API key.
From Paystack to you (webhooks): When something happens on your account, such as a successful payment, Paystack sends a message to your server. This message is called a webhook. Your server needs to know the webhook comes from Paystack, so every webhook carries a signature.
Restricted API keys protect the first direction. Webhook signing secrets protect the second. If you switch to restricted keys, you'll also need a webhook signing secret. We explain why in the webhooks section below.
Secret keys and the risk they carry
Your secret key is the original API key on your account. It works like a master key: it can do everything your account can do through the API. That includes:
Starting and verifying transactions
Viewing customers and their details
Sending transfers and payouts
Checking your balance
Issuing refunds
Anyone who gets your secret key can perform these actions too. If the key is exposed through a public code repository, a shared server or a former developer, someone could use it to move money out of your account or access your customers' data.
Restricted API keys
A restricted API key can only perform the actions you allow. When you create one, you choose its permissions (also called scopes). The key can't perform actions outside those permissions.
For example, if your website only needs to accept and confirm payments, you can create a key that can only start and verify transactions. That key can't send transfers, check your balance or issue refunds.
Secret key vs restricted key
Secret key | Restricted API key | |
|---|---|---|
What it can do | Everything your account can do through the API | Only the permissions you choose |
If it leaks | A bad actor can do anything on your account | A bad actor can only do what that key allows |
Number of keys | One per mode (test and live) | As many as you need, one for each purpose |
Expiry | Doesn't expire | Up to a year, or no expiration |
Verifies webhooks | Yes | No, you need a webhook signing secret |
How permissions work
Each permission covers one area of your account, such as transactions, customers or transfers. For each area, you choose how much access the key gets:
Access | What the key can do | Example |
|---|---|---|
Read | View information only | Fetch a transaction or list your customers |
Write | View information and make changes | Start a transaction, create a customer or send a transfer |
Write access includes read access. If you select write for an area, you don't need to select read as well.
Some areas only offer one level. For example, your balance is read only.
Choosing permissions: List what your integration does, then match each task to an area.
If your integration needs to… | Select |
|---|---|
Accept payments and confirm them | Transactions: Write |
Only confirm payments or view reports | Transactions: Read |
Create or update customers | Customers: Write |
Issue refunds | Disputes & Refunds: Write |
Send transfers | Transfers: Write |
If a key tries something outside its permissions, the request fails with the message "This restricted key is not permitted to perform this action."
You can never give a restricted key access to manage API keys, your account settings or your team members.
💡 Refunds and disputes share one permission. A key that can create refunds can also respond to disputes. Keep this in mind before you share a key with a third party.
Restricted keys reduce risk, but don't remove it
A restricted key limits the damage if it's exposed, but it doesn't remove the risk. For example, someone who gets a key with transfer permission can still use it to send transfers.
Protect every restricted key as carefully as your secret key. Store keys only on your server, never in your website or app code or a code repository. You'll find more security tips at the end of this article.
Create a restricted API key
Go to the API Configuration page on your Dashboard.
Select 'Create restricted key'.
Give the key a name, choose its permissions and set an expiry date.
Complete the verification steps.
Copy the key and store it somewhere safe.
⚠️ You'll only see the full key once. If you lose it, you'll need to create a new key.
Test keys and live keys are separate. Create a test key to try your setup before you create a live key.
Edit a restricted API key
You can change a key's name and permissions after you create it. You can't change its expiry date.
Changes apply to the existing key, so you don't need to replace it in your integration. However, requests will fail if you remove a permission your integration needs.
Go to the API Configuration page on your Dashboard.
Find the key and select 'Edit'.
Update the name or permissions.
Enter your password to confirm.
To change the expiry date, create a new key with the date you want and update your integration. Then delete the old key.
Expiry dates: You can set an expiry date up to a year away, or choose no expiration. If you set a date, add a reminder to replace the key before it expires.
How webhooks are verified
Anyone on the internet could send a fake message to your webhook URL. For example, someone could send a fake "payment successful" message to trick you into providing goods or services for a payment that never happened.
To help your server identify genuine messages, Paystack signs every webhook. Your server checks the signature before trusting the message. A valid signature confirms that the webhook came from Paystack and its content hasn't been changed.
Verifying webhooks with your secret key
Until now, Paystack signed webhooks with your secret key. Each webhook carries an X-Paystack-Signature header. Your server uses your secret key to check that signature.
This means your server needs your secret key just to check webhooks, even if it never uses that key for anything else.
Why restricted keys can't verify webhooks
Restricted keys are only for sending requests to Paystack. They can't check webhook signatures. If you move to restricted keys and delete your secret key, there's nothing left to sign your webhooks with.
That's where the webhook signing secret comes in. It's a separate secret made only for webhooks. It starts with whsec_, and it can't be used to make API requests.
⚠️ Set up a webhook signing secret before you delete your secret key. We only send live webhooks that we can sign. Without a secret key or a signing secret, your server won't receive live webhooks. Your payments will still go through, but your system won't be notified about them.
Verifying webhooks with a signing secret
Once you create a signing secret, each webhook carries a new header called Paystack-Signature. It looks like this:
Paystack-Signature: t=1730800000,v1=key_id:signature
It contains:
t: The time Paystack sent the webhook.
v1: The ID of the signing secret used, followed by the signature.
To verify the signature, your developer combines the timestamp and webhook content, signs them with your signing secret and compares the result with the signature in the header. If they match, the webhook is from Paystack. Your developer can follow our signature validation guide for the technical details.
Old method vs new method
Secret key | Webhook signing secret | |
|---|---|---|
Header to check |
|
|
What's signed | The webhook content | The time and the webhook content |
Secret used | Your secret key | Your signing secret (starts with |
Can make API requests | Yes | No |
While you still have a secret key, webhooks carry both headers. Once you delete your secret key, only the Paystack-Signature header remains. That's why your developer should update your integration to check the new header first.
Create a webhook signing secret
Go to the API Configuration page on your Dashboard.
Scroll to Webhook Signing Secrets and select 'Generate signing secret'.
Copy the signing secret and store it somewhere safe.
Ask your developer to update your integration to check the
Paystack-Signatureheader with the signing secret.Test that your webhooks are verified correctly.
You can reveal your signing secret again on the Dashboard if you need it. Test and live modes have separate signing secrets. You can create a live signing secret once your business is live.
To add or change the URLs your webhooks are sent to, or to see the webhook events we've sent, go to the Webhooks page under Developers.
If a webhook doesn't arrive
Always confirm that a payment was successful before providing goods or services to a customer. You can check its status on the Transactions page on your Dashboard, or your developer can use the Verify Transaction API. This protects you even if a webhook is delayed or missed.
Moving to restricted keys
Follow these steps in order so your integration keeps working:
Create the restricted keys your integration needs, one for each purpose.
Create a webhook signing secret.
Update your integration to use the restricted keys and to check the
Paystack-Signatureheader.Test that API requests and webhook verification work for every integration that uses your secret key, including plugins and third-party platforms.
Only after every integration has been updated and tested, delete your secret key on the API Configuration page.
Don't delete your secret key while an integration still depends on it. Once all integrations use restricted keys and verify webhooks with a signing secret, you no longer need the unrestricted access your secret key provides. Deleting it removes the risk of someone using that key to access your account.
If you use a plugin
Our Shopify app and WooCommerce plugin support restricted keys and webhook signing secrets. Update to the latest version and set up your restricted key and signing secret in the plugin's settings.
If you use any other plugin, check that your plugin version supports restricted keys and webhook signing secrets before you delete your secret key. Otherwise, your plugin may stop recognizing payments.
If a developer or platform works on your behalf
If an agency, developer or platform manages your integration, give them a restricted key with only the permissions they need. Share your webhook signing secret only if they need to verify webhooks on your behalf. Don't share your secret key.
Rotating and revoking keys
You can replace a key or secret in two ways:
Rotate | Revoke | |
|---|---|---|
What happens | You get a new key or secret, and the old one keeps working for a short time | The key or secret stops working right away |
Restricted API keys | The old key works for up to 24 hours. You choose how long | Stops on the next request |
Webhook signing secrets | Both secrets sign webhooks for 24 hours by default, up to 7 days | Stops within about a minute |
When to use it | Regular updates, or when a key is about to expire | When you think a key or secret has leaked |
During a signing secret rotation, each webhook carries two signatures, one from each secret. Your integration should accept the webhook if either one matches.
Common errors
Error message | What it means | What to do |
|---|---|---|
Invalid key | The key was revoked, has expired or was rotated out | Create a new restricted key and update your integration |
This restricted key is not permitted to perform this action | The key doesn't have the permission this request needs | Use a key with the right permission, or edit the key to add it |
Keep your keys and account secure
Give each key only what it needs
Choose only the permissions a key needs for its job. For example, a key that confirms payments doesn't need transfer access. If you have different tasks, such as accepting payments and sending payouts, create a separate key for each.
Don't turn a restricted key into a master key
Avoid giving one restricted key every permission. A key that can do everything carries the same risk as a secret key, which defeats the purpose.
Use IP whitelisting
IP whitelisting lets you choose which server addresses (IP addresses) can use your keys. Requests from any other address are rejected, even if they use a valid key. The same whitelist applies to your secret key and all your restricted keys. You can set it up on the API Configuration page.
To get the most from IP whitelisting:
Use a server that's only yours. On shared hosting, many businesses use the same IP address. Whitelisting that address would also let them through. This matters most if you send transfers or payouts.
Whitelist only your own server addresses. Add every address your server uses, and nothing else.
💡 IP whitelisting is optional and may not suit every setup. For example, your server's IP address may change often on some cloud or server-less hosting services. If you use Shopify or WooCommerce, check whether IP whitelisting is suitable for your integration. Speak with your developer or hosting provider before enabling it.
Store keys safely
Keep keys and signing secrets only on your server.
Never put them in your website code, mobile app or a public code repository.
Only share them with people who need them.
Revoke a key you think has leaked
If you think a key or signing secret has been exposed, revoke it right away on the API Configuration page. Then create a new one and update your integration.

