logo
OverviewAuthentication

Authentication

Authentication

All Merchant API requests are authenticated using an API key passed in the request header.


API key

Include your API key in every request using the X-Api-Key header:

curl -X POST https://api.ecca-ex.com/api/v1/create-invoice \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: your_api_key_here" \
  -d '{ ... }'

Required headers

HeaderRequiredDescription
X-Api-KeyYesYour merchant API key
Content-TypeYesMust be application/json for POST requests

Obtaining an API key

Log in to your merchant dashboard.

Navigate to Settings → API Keys.

Click Generate new key. The key is displayed only once — copy and store it securely.

Each API key is tied to a specific merchant account. You can generate multiple keys and deactivate them independently.


Security best practices

Your API key grants full access to your merchant account. Treat it like a password.

  • Never expose API keys in client-side code (JavaScript, mobile apps)
  • Never commit API keys to version control (Git, SVN)
  • Store keys in environment variables or a secrets manager
  • Use separate keys for development / staging / production
  • If a key is compromised, rotate it immediately in your dashboard — the old key will be deactivated instantly

Authentication errors

If authentication fails, the API returns one of these errors:

HTTPCodeDescription
401API_KEY_MISSINGX-Api-Key header is missing or empty
403API_KEY_INVALIDAPI key is invalid or deactivated
403OWNER_BLOCKEDMerchant account owner is blocked
403MERCHANT_BLOCKEDMerchant account is banned
403MERCHANT_NOT_ACTIVEMerchant account is not yet activated

Example error response:

{
  "successful": false,
  "request_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
  "error": {
    "code": "API_KEY_INVALID",
    "message": "Invalid or inactive API key"
  }
}

These errors can occur on any endpoint. If you receive a 401 or 403, check your API key before investigating further.