Kustom has several identifiers that are easy to mix up. Here's what each one is and where to find it.
API credentials
API Username is called Key ID in the Portal. Find it under Developers → API.
API Password is called Password in the Portal. It's shown once when you generate it, so save it at that point.
Merchant ID (MID) is a separate identifier from your Key ID and Password. Find it in your account settings.
Your Portal login email is not an API credential at all- it only gets you into the Portal itself.
Test and Live are separate accounts
Playground (portal.playground.kustom.co) and Production (portal.kustom.co) have separate logins and separate credentials. Generating credentials in one does not give you credentials in the other.
Make sure you're in the right environment before generating or using a key.
Regenerating a key
Regenerating a key does not revoke the old one. You can have multiple active credential sets on the same Merchant ID at the same time, so if you're not sure which one is current, check the Portal rather than guessing.
Running several stores or organisation numbers?
Each store or organisation number has its own Merchant ID and its own credentials. Check that the Merchant ID shown under Developers → API matches the store you're configuring before using a credential.