Skip to main content

Authentication and Security

Security controls on partner mutation endpoints

The following endpoints require all controls:

  • POST /transactions/initialize
  • POST /transactions/attach-intent

Controls:

  1. x-api-key
  2. x-clive-hmac
  3. idempotency-key
  4. partner rate limiting

Header reference

HeaderRequiredDescription
x-api-keyYesShared API key for partner authentication
x-clive-hmacYesSHA-256 HMAC signature of exact request body
idempotency-keyYesUnique key to make retries safe and replayable
Content-TypeYesUse application/json

HMAC signing details

  • Algorithm: HMAC-SHA256
  • Message: exact raw JSON string body
  • Secret: shared HMAC secret configured with Clive
  • Output: lowercase hex digest

Node example

import crypto from "crypto";

function cliveSign(body: string, secret: string) {
return crypto.createHmac("sha256", secret).update(body).digest("hex");
}

cURL example

BODY='{"partner_id":"ECHEZONA001","client_id":"AIRPEACE001","amount":750,"currency":"USD","echezona_reference":"EZ12345"}'
SIG=$(node -e "const c=require('crypto');console.log(c.createHmac('sha256', process.env.CLIVE_HMAC_SECRET).update(process.argv[1]).digest('hex'))" "$BODY")

curl -X POST "$CLIVE_API_BASE_URL/transactions/initialize" \
-H "Content-Type: application/json" \
-H "x-api-key: $CLIVE_API_KEY" \
-H "x-clive-hmac: $SIG" \
-H "idempotency-key: init-EZ12345-v1" \
-d "$BODY"

Idempotency behavior

  • If a prior response exists for the same key, Clive returns cached response.
  • Replay responses include:
{
"idempotentReplay": true
}
  • Recommended key strategy:
    • init-{partnerRef}
    • attach-{cliveTxId}

Common auth/security errors

HTTPCodeMeaning
401API_KEY_MISSINGx-api-key header missing
401API_KEY_INVALIDAPI key mismatch
401HMAC_MISSINGHMAC header missing
401HMAC_INVALIDHMAC mismatch
400IDEMPOTENCY_KEY_MISSINGNo idempotency key
429n/aRate limit exceeded