Authentication

All API requests to AnyPay Tanzania services require authentication using an API token.

Getting Your API Token

To get started, you'll need to:

  1. Sign up for an account at anypaytanzania.com
  2. Navigate to your dashboard
  3. Generate an API token from the API settings section

Required Headers

All API requests must include the following headers:

Authorization: Bearer <your_access_token>
API-Key: <your_api_key>
Content-Type: application/json

Example Request

curl -X POST https://anypaytanzania.com/api/payments/wallet/pull/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "API-Key: YOUR_API_KEY" \
  -d '{"order_id": "ORD-12345", "phone": "0798123456", "amount": 1000}'

Security Best Practices

  • Keep your API token secure and never share it publicly
  • Rotate your tokens regularly
  • Use HTTPS for all API requests
  • Monitor your API usage in the dashboard

Rate Limiting

API requests are subject to rate limiting. Check the response headers for rate limit information:

  • X-RateLimit-Limit: Maximum requests per hour
  • X-RateLimit-Remaining: Remaining requests in current window
  • X-RateLimit-Reset: Time when the rate limit resets