KashierDevelopersKashier Developers
Get started

Secret keys

Create merchant-owned secret keys with their own permissions, IP allow-list and expiry, and roll or revoke them without breaking your integration.

A secret key is the credential your server sends in the Authorization header to call the Kashier API. Each key belongs to your merchant account, not to a team member, and carries its own settings:

  • Permissions: the modules the key may read or write, such as Transactions or Payment links.
  • IP allow-list: the server addresses allowed to use the key.
  • Expiry: an optional date after which the key stops working.

Because each key has its own scope, you can give every integration its own key with only the access it needs. Roll a key that leaked, or revoke a key you no longer use, without touching the others.

Secret key or Payment API Key?

The secret key authenticates server-to-server API calls. The Payment API Key is a different credential: you use it to compute the order hash and to verify Kashier's signatures. This page covers secret keys only. See API keys for both.

Key format

New keys start with a prefix that names their mode:

ModePrefixWorks on
Testksk_test_test-api.kashier.io, test-fep.kashier.io
Liveksk_live_api.kashier.io, fep.kashier.io

A test key never works on a live host, and a live key never works on a test host. Keys that existed before merchant-owned keys keep their original value and format. See Existing keys.

Send the key

Put the raw key in the Authorization header. Do not add a Bearer prefix.

curl --location 'https://test-api.kashier.io/v2/aggregator/transactions' \
  --header 'Authorization: ksk_test_YOUR_SECRET_KEY'

A key belongs to exactly one merchant, so you do not need the authmerchantid header. If you send it, it must name the key's own MID.

Create a key

Create keys in the Dashboard under Developers → Integrations → Secret Keys. Switch the dashboard to the mode you want the key for first. A key is created in the mode the dashboard is in.

Secret Keys tab under Developers, Integrations, showing the Create secret key button and a table of keys with their permissions, IP addresses, expiry, status and last use

  1. Click Create secret key and give the key a name of up to 60 characters. Name it after the integration that will use it, for example ERP refunds.
  2. Choose the permissions the key needs. Pick at least one.
  3. Add the IP addresses of the servers that will call the API with this key.
  4. Optionally set an expiry date.
  5. If the dashboard asks for one, enter the code Kashier sends by SMS to your phone number.
  6. Copy the key value and store it in your secrets manager.

Create secret key drawer on the Permissions step, with Customers and Payment links set to Read and the key-only Payment sessions permission set to Write

Kashier shows a live key's value only once

Copy the value when the dialog shows it. Kashier does not show a live key's value again. If you lose it, roll the key to get a new value.

Your new secret key dialog showing a ksk_live_ key value with a Copy button and a warning that the key will not be shown again

Secret keys are created, edited, rolled and revoked from the dashboard.

Permissions

Each permission is a module and a level. Read lets the key view and export a module's data. Write lets it create and change that data. Read and Write are separate, so a key can hold Write without Read.

ModuleRead lets the keyWrite lets the keyNotes
DashboardView dashboard dataNot available
TransactionsView transactions and their details, export them, view feesRefund transactionsVoids also need Transactions: Write
Payment linksView, share and export payment linksCreate, edit, cancel, delete and mark payment links as paid
Payment pagesView, share and export payment pagesCreate, edit and delete payment pages
Payment sessionsView payment sessionsCreate and expire payment sessionsOnly for keys. See Payment sessions.
Products and categoriesView productsCreate and edit products, adjust stock, delete categories
Balance managementView and export balance and settlementsNot available
Instant settlementView instant settlementsRequest an instant settlement
TransfersView and export transfersCreate transfersAdd at least one IP address to the key
BeneficiariesView beneficiariesCreate, edit and delete beneficiariesAdd at least one IP address to the key
CustomersView customersCreate, edit and delete customers, manage the customer portal
TerminalsView and export terminalsEdit terminals
Webhooks configurationView webhook settingsCreate, edit and delete webhook settings
Webhooks logView sent webhooksResend webhooks
BranchesNot availableManage branches
User managementView usersInvite and edit users

The permissions you can grant to a key depend on your own role.

Payment sessions

Creating a payment session with a key needs Payment sessions: Write. Listing, viewing or exporting sessions needs Payment sessions: Read and Transactions: Read.

Team roles don't include the Payment sessions permission. It exists only for keys.

IP allow-list

Each key has its own IP allow-list. A call from an address that is not on the key's list is rejected.

IP allow-list step of the Create secret key drawer with two IPv4 addresses added and an Add IP field

  • Add at least one IP address to every key.
  • Use exact public IPv4 addresses. CIDR ranges, IPv6, and private or loopback addresses are not accepted. A key holds up to 50 addresses, each listed once.
  • Transfers and Beneficiaries need an IP. A key that holds either module, at Read or Write, must list at least one IP address.
  • Allow-list your egress address. Behind a proxy or NAT, allow-list the public IP your traffic leaves from. Update the list before you move servers, or every call from the new server fails.

The Authorized IP addresses table under Secret Keys lists every address on every active key in one read-only view. To change an address, edit the key that holds it.

Expiry

A key can stay valid forever or stop on a date you choose. The earliest expiry you can set is tomorrow, counted from midnight Cairo time. There is no latest date. Once a key passes its expiry date, it stops working and its status shows Expired.

You can change or remove the expiry date by editing the key, as long as it has not expired yet. An expired key cannot be brought back. Create a new key instead.

Edit a key

You can change a key's name, permissions, IP addresses and expiry date. The key value stays the same, so your integration keeps working. Changes apply to the next call the key makes.

Some edits ask for an SMS code. Revoked and expired keys cannot be edited.

Roll a key

Rolling replaces the key's value and keeps everything else: name, permissions, IP addresses and expiry. Roll a key when its value may have leaked, or to rotate it on a schedule.

When you roll, choose what happens to the old value:

Roll key dialog offering Keep the current key working for 24 hours, selected as recommended, or Stop the current key immediately

OptionOld valueUse it when
Keep the current key working for 24 hoursKeeps working for 24 hours with the same permissions, then stops. The key shows Rolling until then.You need time to deploy the new value without downtime
Stop the current key immediatelyStops at onceThe value leaked

The new value is shown once, as on create. Some rolls ask for an SMS code.

Revoke a key

Revoking stops a key immediately and for good. The key stays in the list with the status Revoked. A revoked key cannot be edited, rolled or reactivated.

Statuses

StatusMeaning
ActiveThe key works
RollingThe key was rolled with a 24-hour overlap. The new value works, and the old value works until the overlap ends
ExpiredThe key passed its expiry date and no longer works
RevokedThe key was revoked and no longer works

Who can see and manage keys

Five permissions in the Integrations section of a team role control secret keys: View, Create, Edit, Roll and Revoke secret keys. Every action except View also needs View. Manage roles under Settings → Manage team → Roles. See Teams and user roles.

  • The Owner and the Administrator role see and manage every key on the account.
  • Every other team member sees and manages only the keys they created, within their role's permissions.

Existing keys

Secret keys that existed before merchant-owned keys were moved to your merchant account with the same value. You don't need to change your integration. Review your existing keys in the dashboard and add IP addresses and permissions as needed.

Errors

If a call is rejected with 401 or 403, check the key, its permissions and its IP allow-list. For 400, check the request. See Error responses.

Keep your keys safe

  • Store keys only on your servers, in a secrets manager. Never put them in client-side code, a mobile app or a Git repository.
  • Give each integration its own key with only the permissions it needs.
  • Add IP addresses to every live key.
  • Set an expiry date on keys for temporary integrations, such as a contractor's tool.
  • If a key may have leaked, roll it and choose Stop the current key immediately. Revoke keys you no longer use.

On this page