Authentication

Authentication

API keys and permission scopes.

API keys

Harpoon uses API keys, issued from your dashboard. Pass them as a Bearer token:

Plain Text
Authorization: Bearer hpn_live_sk_your_api_key_here

The full key is shown once at creation — store it immediately. Lost keys cannot be recovered, only revoked and replaced.

Key types

TypeFormatUse
Secrethpn_{env}_sk_*Server-side only. Full access.
Publichpn_{env}_pk_*Browser-safe. Limited scopes.

{env} is live or test.

Public keys cannot:

  • Set a custom webhook_url on initialize.
  • Hold scopes other than transactions:read or transactions:initialize.

Scopes

ScopePurposeBrowser-safe
transactions:readRead transaction statusYes
transactions:initializeCreate payments without custom webhookYes
transactions:writeList, reconcile, cancelNo
webhooks:manageCreate / update / delete / test webhook endpointsNo
reports:readReports and analyticsNo
team:manageTeam managementNo

Defaults

Key typeDefault scopes
Secrettransactions:read, transactions:write
Publictransactions:read, transactions:initialize

IP whitelisting

Optionally restrict an API key to specific IPs or CIDR ranges. Configure from API Keys → IP Whitelist. Requests from non-whitelisted IPs return 403.

Rate limits

Default: 100 requests per minute per API key.

429 Too Many Requests includes:

Plain Text
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1704715600
Retry-After: 30

Browser usage

Use a public key. Don’t ship secret keys to a browser.

JavaScript
const HARPOON_PUBLIC_KEY = 'hpn_live_pk_your_key_here';

await fetch('https://api.harpoonsms.com/v1/transactions/initialize', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${HARPOON_PUBLIC_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    amount: '150.00',
    phone_number: '0244123456',
    description: 'Order payment'
  })
});

For status updates from the browser, either poll GET /v1/transactions/{reference} or rely on webhooks configured server-side.

Revoking a key

Settings → API Keys → revoke. Revoked keys are invalidated immediately.