Skip to main content

Overview

This guide covers best practices for using the Gather API to build robust, efficient integrations.

Authentication

Secure Credential Storage

  • Never commit API keys to version control
  • Use environment variables for credentials
  • Rotate keys regularly for security
  • Use separate keys for different environments (production, staging)

Credential Format

Always use the correct format: organizationId:apiKey

Request Handling

Error Handling

Always handle errors gracefully:

Retry Logic

Implement retry logic for transient failures:
  • Retry on 429 (rate limit) and 5xx errors
  • Use exponential backoff
  • Don’t retry on 4xx client errors
  • Set maximum retry attempts

Timeouts

Set appropriate timeouts:

Rate Limiting

Monitor Rate Limits

Check rate limit headers on every response:

Optimize Request Frequency

  • Cache responses when possible
  • Batch operations when available
  • Use webhooks instead of polling
  • Request only needed data

Data Management

Use External IDs

Use externalId to maintain references:

Phone Number Format

Always use E.164 format:
  • +1234567890
  • 123-456-7890
  • (123) 456-7890

Idempotency

Make operations idempotent when possible:
  • Use external IDs to prevent duplicates
  • Check if resource exists before creating
  • Handle duplicate creation gracefully

Webhooks

Verify Signatures

Always verify webhook signatures:

Handle Duplicates

Webhooks may be delivered multiple times:
  • Use event IDs or timestamps for deduplication
  • Make webhook handlers idempotent
  • Log all webhook events

Respond Quickly

Respond to webhooks within 5 seconds:
  • Process webhooks asynchronously
  • Queue heavy operations
  • Return 200 OK immediately

Performance

Connection Pooling

Reuse HTTP connections:

Parallel Requests

Make independent requests in parallel:

Pagination

Handle pagination efficiently:

Security

Input Validation

Validate input before sending to API:

HTTPS Only

Always use HTTPS:
  • https://api.prod.qualifi.hr
  • http://api.prod.qualifi.hr

Logging

Don’t log sensitive data:

Testing

Test Error Scenarios

Test your error handling:
  • Invalid credentials
  • Rate limiting
  • Network failures
  • Invalid data

Use Staging Environment

Test in staging before production:
  • Use https://api.dev.qualifi.hr for testing
  • Verify all workflows
  • Test error scenarios

Monitoring

Track Metrics

Monitor key metrics:
  • Request success rate
  • Error rates by type
  • Response times
  • Rate limit usage

Logging

Log important events:
  • API requests and responses
  • Errors with request IDs
  • Rate limit warnings
  • Webhook events

Error Handling

Learn about error handling patterns

Rate Limits

Understand rate limits and throttling

Handling Webhooks

Best practices for webhooks