API Authentication

Secure your API requests with our authentication methods

API Keys

Secure your API requests using API keys for server-to-server communication.

Implementation Steps

  • Generate an API key from your dashboard settings
  • Include the API key in the Authorization header
  • Keep your API key secure and never expose it in client-side code
  • Rotate keys periodically for enhanced security

Example API request using an API key

curl https://api.invoicedoodle.com/v1/invoices \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json"

OAuth 2.0

Implement OAuth 2.0 for secure user authentication and authorization.

Implementation Steps

  • Register your application in the developer dashboard
  • Implement OAuth 2.0 flow in your application
  • Exchange authorization code for access token
  • Use refresh tokens to maintain access

Example OAuth 2.0 token exchange

const response = await fetch('https://api.invoicedoodle.com/oauth/token', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    grant_type: 'authorization_code',
    code: 'auth_code_here',
    client_id: 'your_client_id',
    client_secret: 'your_client_secret',
    redirect_uri: 'your_redirect_uri'
  })
});

Security Best Practices

Key Management

Store API keys securely and never expose them in client-side code or version control systems.

Regular Rotation

Rotate your API keys periodically and immediately if they're compromised.

Access Control

Implement proper access controls and limit API key permissions to only what's necessary.

Monitoring

Monitor API usage and set up alerts for suspicious activities.

Troubleshooting

Invalid API Key

Verify that you're using the correct API key and it's properly formatted in the Authorization header.

Expired Access Token

Use your refresh token to obtain a new access token when the current one expires.

Rate Limit Exceeded

Implement proper rate limiting in your application and handle rate limit errors gracefully.

Ready to Start Building?

Now that you understand authentication, explore our API endpoints and start integrating.