Gafiapay Docs

API Key Setup

Learn how to set up and manage your API keys for secure access to the Gafiapay API.


Getting Your API Keys

To access the Gafiapay API, you'll need to generate API keys from your business dashboard. Follow these steps:

  1. Log into Your Dashboard

    Access your Gafiapay business dashboard using your credentials.

  2. Navigate to API Settings

    Go to the API Settings section in your dashboard.

  3. Generate New API Key

    Click on "Generate New API Key" to create a new key pair.

  4. Save Your Keys Securely

    Copy and store your API key and secret key in a secure location. You won't be able to view the secret key again.

API Key Structure

Your API key will be a unique identifier that looks like this:

bash
sbp_live_1234567890abcdef1234567890abcdef

Security Best Practices

Never Share Your Keys
Keep your API keys confidential. Never commit them to version control or share them publicly.
Use Environment Variables
Store your API keys in environment variables or secure configuration files.
Rotate Keys Regularly
Regularly rotate your API keys to maintain security. Generate new keys and update your applications.

Environment Setup Examples

javascript
// .env file
GAFIAPAY_API_KEY=sbp_live_1234567890abcdef1234567890abcdef
GAFIAPAY_SECRET_KEY=your_secret_key_here

// Usage in your code
require('dotenv').config();
const apiKey = process.env.GAFIAPAY_API_KEY;
const secretKey = process.env.GAFIAPAY_SECRET_KEY;

// Example API request
const axios = require('axios');

const headers = {
  'x-api-key': apiKey,
  'x-signature': generateSignature(requestBody, timestamp, secretKey),
  'x-timestamp': Date.now(),
  'Content-Type': 'application/json'
};

const response = await axios.post('https://api.gafiapay.com/api/v1/external/account/generate', requestBody, { headers });

Testing Your API Key

You can test your API key by making a simple request to the health check endpoint:

curl
curl -X GET 'https://api.gafiapay.com/v1/health' \
  -H 'x-api-key: your_api_key_here' \
  -H 'x-signature: generated_signature' \
  -H 'x-timestamp: current_timestamp'

Troubleshooting

Invalid API Key Error

If you receive an "Invalid API key" error:

  • Verify that your API key is correct and complete
  • Ensure your API key is active in the dashboard
  • Check that you're using the correct key for your environment (live/test)

Signature Verification Failed

If signature verification fails:

  • Ensure you're using the correct secret key
  • Verify that your signature generation algorithm is correct
  • Check that the timestamp is within the allowed window