Skip to main content

Overview

The PricingSaaS Intelligence API uses Bearer Token authentication with API keys. All API requests must include your API key in the Authorization header.

Getting Your API Key

1

Create an Account

Sign up at api.pricingsaas.com to access your dashboard
2

Generate API Key

In your dashboard, navigate to API Keys and click Generate New Key
3

Name Your Key

Give your API key a descriptive name (e.g., “Production App”, “Development”)
4

Copy and Store

Copy the generated key immediately - it will only be shown once!
Important: Your API key will only be displayed once. Store it securely in a password manager or environment variable. If you lose it, you’ll need to generate a new one.

Making Authenticated Requests

Include your API key in the Authorization header with the Bearer scheme:
curl -X GET "https://api.pricingsaas.com/functions/v1/api/companies" \
  -H "Authorization: Bearer YOUR_API_KEY"

Environment Variables

Best Practice: Always store your API key in environment variables, never hardcode it in your source code.

Local Development

Create a .env file in your project root:
.env
PRICINGSAAS_API_KEY=your_api_key_here
Add .env to your .gitignore file to prevent accidentally committing your API key to version control!

Production Deployment

Set environment variables in your hosting platform:
vercel env add PRICINGSAAS_API_KEY
Or add it in the Vercel dashboard under Project Settings → Environment Variables

Authentication Errors

The API returns specific error codes for authentication issues:
401 Unauthorized
error
API key is missing or invalid
{
  "error": "Unauthorized",
  "message": "Invalid or missing API key"
}
Solution: Check that your API key is correctly included in the Authorization header
403 Forbidden
error
API key is valid but lacks permission for the requested resource
{
  "error": "Forbidden",
  "message": "API key does not have permission to access this resource"
}
Solution: Upgrade your plan or contact support to enable this feature

Managing API Keys

View All Keys

View all your API keys in the dashboard to see:
  • Key name and creation date
  • Last used timestamp
  • Usage statistics
  • Key status (active/revoked)

Rotate Keys

1

Generate New Key

Create a new API key in your dashboard
2

Update Applications

Update your applications to use the new key
3

Test Thoroughly

Verify all applications work with the new key
4

Revoke Old Key

Once confirmed, revoke the old key to prevent unauthorized access
Pro Tip: We recommend rotating your API keys every 90 days for enhanced security.

Revoke Keys

If you suspect your API key has been compromised:
  1. Immediately revoke the compromised key in your dashboard
  2. Generate a new key for your applications
  3. Review API logs to check for suspicious activity
  4. Update all applications with the new key
Revoking a key immediately invalidates all requests using that key. Ensure you have a replacement key ready before revoking.

Security Best Practices

Never hardcode API keys in your source code. Always use environment variables or secret management services like AWS Secrets Manager, HashiCorp Vault, or similar.
Always make API requests over HTTPS. The API will reject HTTP requests to prevent key interception.
Never expose your API key in client-side code (JavaScript, mobile apps). Make API calls from your backend server or serverless functions.
Rotate your API keys periodically (every 90 days recommended) to minimize risk if a key is compromised.
Regularly check your API usage dashboard for unexpected spikes or unusual patterns that might indicate unauthorized use.
Use different API keys for development, staging, and production environments to limit blast radius if a key is compromised.

Testing Your Authentication

Test your authentication setup with this simple request:
curl -X GET "https://api.pricingsaas.com/functions/v1/api/companies?limit=1" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -w "\nHTTP Status: %{http_code}\n"
Expected responses:
{
  "data": [
    {
      "id": 1,
      "name": "Slack",
      "slug": "slack"
    }
  ]
}

Need Help?