API RecipesAuthentication
API Key Generation Flow
This recipe was an interactive walkthrough in the previous portal. Each step below names the API call it makes; open it in the API Reference to try it.
Overview
API Key Rotation Flow
This recipe walks you through safely rotating an API key for a merchant-level credential — entirely through the API, without touching the Customer Area.
Flow Overview
- List Merchants — Retrieve the merchants under your company account and identify the target merchant.
- List API Credentials — Fetch the API credentials for that merchant to identify the credential to rotate.
- Generate New API Key — Rotate the API key for the selected credential. The old key remains valid for 24 hours to allow a safe cutover.
API Endpoints Involved
GET /companies/{companyId}/merchantsGET /merchants/{merchantId}/apiCredentialsPOST /merchants/{merchantId}/apiCredentials/{apiCredentialId}/generateApiKey
⚠️ Prerequisites
- Your Company ID (
companyId) — found in your Adyen Customer Area under Settings > Account. - An API key with the Management API — API credentials read and write role.
Tip: The
merchantIdfrom Step 1 andcredentialIdfrom Step 2 are automatically passed into subsequent steps.
Step 1: List Merchants
Returns the list of merchant accounts under the company account specified in the path.\n\n
API call: listCompanyMerchants
Example arguments:
{
companyId: "APIMatic300"
}Step 2: List API Credentials
Returns the list of API credentials
API call: listMerchantApiCredentials
Example arguments:
{
merchantId: merchantId,
}Step 3: Generate New API Key
Generates a new API key for credential
API call: generateMerchantApiKey
Example arguments:
{
merchantId: merchantId,
apiCredentialId: credentialId,
}