API credentials

Rotate a merchant's API password — the credential used to call the Remote API, Querying Transactions, and other transactional APIs.

This page covers rotation of the merchant's API password — the credential a merchant uses on Basic-Auth calls to the Remote API, Querying transactions, and other Scan to Pay transactional APIs. It's separate from the Portal login credential and separate from the webhook encryption key.

For the broader credential story, see Authentication.


Endpoint

MethodPathPurposeAllowed callers
POST/restful/merchant/renewApiKeyGenerate a new API password for a merchantPSP, Acquirer

Merchant must be in ACTIVE state.


Rotate the API password

Request:

curl -X POST https://qa.scantopay.io/portal/restful/merchant/renewApiKey \
  -u 'PSP_42:yourPspApiPassword' \
  -H 'Content-Type: application/json' \
  -d '{ "merchantId": 25 }'

Request fields:

FieldRequiredDescription
merchantIdyesMerchant whose API password is being rotated

Response:

{
  "merchantId": 25,
  "apiKey": "4F8B2A6C1D3E9F7B2A6C1D3E9F7B2A6C"
}

The new password is a 32-character hex string (16 random bytes, base16-encoded, uppercase). It's the only time the password is returned — store it securely.

⚠️

Rotation is immediate. The previous password stops working the instant this call returns. Coordinate your deploy so the new password is in your config before the rotation, or schedule a maintenance window.


Common errors

HTTPBodyCause
400"Merchant not in 'ACTIVE' state"Suspended, terminated, or waiting-activation merchants can't have their API key rotated
400"Invalid 'merchantId'"Ownership check failed — you don't own this merchant
401(empty)ROLE_REMOTE not granted, or caller-prefix not allowed

A safe rotation flow

To avoid downtime when rotating in production:

  1. Decide on a cutover window — typically a low-traffic period
  2. Update your application config / secret manager with the new password slot, but keep the old one active
  3. Call /restful/merchant/renewApiKey — capture the response, push the new password into the active slot
  4. Verify by making a benign call against the Remote API with the new password (e.g. getTransactionState for a recent transaction)
  5. Decommission the old password (you don't need to do anything — it's invalid the moment the rotation completes)

If your application caches credentials in-memory, restart workers / pods after the rotation so they pick up the new password.


Related credentials

CredentialPurposeHow to rotate
Merchant API passwordAuthenticates Remote API and other transactional API callsThis endpoint
Webhook encryption keyDecrypts webhook payloads sent by Scan to PayRotate the webhook key
Portal login passwordAuthenticates the Portal web UI (and Portal API if ROLE_REMOTE granted)Portal UI → email dropdown → Change Password
Lib Lite tokenIn-app SDK authenticationGenerate Lib Lite tokens — supports multiple active tokens simultaneously
JWT (Bearer) + PKIAlternative to Basic Auth on the Remote APIAuthentication — handshake protocol

What's next