Webhook Overview
Legitmark sends real-time notifications about your service requests through webhooks. This enables immediate updates to your platform when authentication is complete or when issues arise. API Reference: See the webhook events and schemas in this section’s API documentationWebhook Setup Process
Initial Configuration
- Provide webhook URL during partner onboarding
- Configure event subscriptions for the notifications you need
- Implement webhook handlers on your platform
- Verify webhook signatures for security (details provided during setup)
Security Requirements
- HTTPS endpoint required for webhook delivery
- Signature verification to authenticate webhook origin
- Timeout handling for webhook processing (30 second max)
- Retry logic for failed webhook deliveries
Key Webhook Events
State Change Notifications
Receive updates when authentication is complete or status changes. API Reference:state_change webhook
When triggered:
- Service request moves to “COMPLETE”
- Authentication result: “APPROVED” or “REJECTED”
- Status changes during processing
Media Rejection Notifications
Get notified when images need to be re-uploaded with specific feedback. API Reference:media_rejected webhook
When triggered:
- Images fail quality control
- Additional images are needed
- Specific feedback provided for each rejected image
Service Request Invalidation
Receive notifications when a service request cannot be processed. API Reference:invalidate_sr webhook
When triggered:
- Item cannot be authenticated (unsupported brand, etc.)
- Request is cancelled or expired
- System-level issues
Implementation Guide
Webhook Endpoint Setup
Event Handler Implementation
Retry Logic
Testing Webhooks
Webhook Validation
Test webhook processing with sample payloads:Monitoring and Debugging
Best Practices
Reliability
- Implement idempotency to handle duplicate webhook deliveries
- Use database transactions for atomic webhook processing
- Handle partial failures gracefully
- Log webhook events for debugging and monitoring
Performance
- Process webhooks asynchronously to avoid timeouts
- Batch related operations when possible
- Use queues for high-volume webhook processing
- Optimize database queries in webhook handlers
Security
- Always verify signatures before processing webhooks
- Use HTTPS endpoints for webhook URLs
- Implement rate limiting on webhook endpoints
- Validate webhook payload structure before processing
User Experience
- Provide immediate feedback when webhooks are processed
- Handle authentication results with appropriate user notifications
- Offer re-upload options for rejected images
- Display clear status updates throughout the process
Error Handling
Common Issues
- Webhook endpoint timeouts: Ensure processing completes within 30 seconds
- Invalid signatures: Verify signature calculation implementation
- Duplicate events: Implement idempotency to handle retries
- Network failures: Use retry logic with exponential backoff
Troubleshooting
Next Steps
Once webhook implementation is complete:- Test end-to-end authentication flow with webhook notifications
- Monitor webhook processing performance and reliability
- Implement user notifications based on webhook events
- Set up monitoring and alerting for webhook failures