Code Examples

Learn how to integrate GuardCrow into your applications with examples in your preferred programming language.

Common Integration Patterns

Server-side Moderation

Moderate content on your backend before saving to database. Best for forms, comments, and user submissions.

API Proxy

Create a proxy endpoint to keep your API key secure while allowing frontend calls.

Middleware

Add automatic moderation to all incoming requests using framework middleware.

Background Processing

Queue content for async moderation using job queues like Bull, Celery, or Hangfire.

Best Practices

  • Never expose your API key - Always call the GuardCrow API from your server, not from client-side code.
  • Implement retry logic - Handle rate limits and transient errors gracefully with exponential backoff.
  • Fail open on errors - If the API is unavailable, consider allowing content through rather than blocking all submissions.
  • Use metadata - Include source and user_id in requests for better tracking and debugging.
  • Cache results - If analyzing the same content multiple times, cache the results to reduce API calls.