Learn how to integrate the Recovery API into your application.
First, create an API key in your dashboard.
When a user requests account recovery, call the initiate endpoint:
POST https://your-recovery-api.netlify.app/api/v1/recovery/initiate
Authorization: Bearer ra_your_api_key_here
Content-Type: application/json
{
"email": "user@example.com",
"redirect_url": "https://yourapp.com/recovery/success",
"webhook_url": "https://yourapp.com/webhooks/recovery" // optional
}
When the user clicks the recovery link, you'll receive a webhook:
POST https://yourapp.com/webhooks/recovery
Content-Type: application/json
{
"event": "recovery.completed",
"data": {
"request_id": "123e4567-e89b-12d3-a456-426614174000",
"user_email": "user@example.com",
"recovery_token": "abc123...",
"timestamp": "2024-01-08T12:00:00Z"
}
}
/api/v1/recovery/initiate
Initiate a recovery process for a user.
Authorization: Bearer {your_api_key}
Content-Type: application/json
Field | Type | Required | Description |
---|---|---|---|
email | string | Yes | User's email address |
redirect_url | string | Yes | Where to redirect after successful recovery |
webhook_url | string | No | URL to receive webhook notifications |
{
"request_id": "123e4567-e89b-12d3-a456-426614174000",
"expires_at": "2024-01-08T12:30:00Z",
"message": "Recovery email sent successfully"
}
Invalid or missing API key
Invalid request body or parameters
Rate limit exceeded (max 5 attempts per email per hour)
When a user clicks their recovery link, we'll send a POST request to your webhook URL.
{
"event": "recovery.completed",
"data": {
"request_id": "123e4567-e89b-12d3-a456-426614174000",
"user_email": "user@example.com",
"recovery_token": "abc123...",
"timestamp": "2024-01-08T12:00:00Z"
}
}
Need help? Visit your dashboard or check the logs for troubleshooting.