API Keys

Overview

Sayswitch uses API keys to authenticate requests. Each key is designed for specific use cases and environments.

Key Types

Public Keys

  • Format: pk_test_... (test) / pk_live_... (live)
  • Usage: Client-side operations, payment initialization
  • Security: Safe to expose in frontend code

Secret Keys

  • Format: sk_test_... (test) / sk_live_... (live)
  • Usage: Server-side operations, payment processing
  • Security: Keep private - never expose in client code

Getting Your Keys

  1. Login to Sayswitch Dashboard
  2. Navigate to Settings > API Keys
  3. Copy your keys for integration

API Key Management

Authentication

Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Example Request

curl -X GET https://backendapi.sayswitchgroup.com/api/v1/transactions \
  -H "Authorization: Bearer sk_test_your_secret_key_here" \
  -H "Content-Type: application/json"

Security Best Practices

  1. Protect Secret Keys

    • Store in environment variables
    • Never commit to version control
    • Keep out of client-side code
  2. Environment Separation

    • Use test keys for development
    • Use live keys only in production
  3. Key Rotation

    • Rotate keys every 6 months
    • Replace immediately if compromised

Key Permissions

Key TypePermissions
Public KeyPayment initialization, public endpoints
Secret KeyFull API access, refunds, webhooks

Troubleshooting

IssueSolution
401 UnauthorizedCheck key format and validity
403 ForbiddenVerify correct key type for operation
Environment errorsEnsure test/live key matches endpoint

Support

Need help? Contact support@sayswitch.com