API Configuration

Documentation for the Fayda Authentication API configuration endpoints.

Overview
The configuration endpoints allow you to retrieve and update your API settings. These endpoints are particularly useful for managing your application's behavior and customizing the authentication experience.
Get Configuration
Retrieves the current configuration settings for your API key.
GET/api/fayda/config

Request Headers

HeaderRequiredDescription
Authorization / X-API-KeyYesYour API key. See Authentication.

Successful Response (200 OK)

json
{
  "success": true,
  "config": {
    "otpSettings": {
      "expiryMinutes": 10,
      "maxAttempts": 3,
      "cooldownMinutes": 30
    },
    "rateLimit": {
      "enabled": true,
      "requestsPerHour": 100
    },
    "security": {
      "allowlistedIps": ["192.168.1.1", "10.0.0.0/24"]
    },
    "webhook": {
      "url": "https://yourapp.com/webhook",
      "secret": "wh_secret_...",
      "events": ["auth.success", "auth.failure"]
    }
  }
}
Update Configuration
Updates the configuration settings. Only fields provided in the request body will be updated.
PATCH/api/fayda/config

Request Body

The request body should be a JSON object containing the fields to update.

json
{
  "otpSettings": {
    "expiryMinutes": 5
  },
  "webhook": {
    "url": "https://new.webhook.url/handler"
  }
}

Body Parameters

FieldTypeDescription
otpSettingsObjectSettings for OTP generation and verification.
› expiryMinutesNumberOTP validity period in minutes.
› maxAttemptsNumberMaximum OTP verification attempts before cooldown.
› cooldownMinutesNumberCooldown period in minutes after max attempts are reached.
rateLimitObjectAPI rate limiting settings.
› enabledBooleanEnable or disable rate limiting.
› requestsPerHourNumberNumber of allowed requests per hour per API key.
securityObjectSecurity-related settings.
› allowlistedIpsArray of StringsList of IP addresses or CIDR ranges allowed to make requests.
webhookObjectWebhook notification settings.
› urlStringThe URL to send webhook events to.
› secretStringA secret used to sign webhook payloads for verification.
› eventsArray of StringsAn array of event types to subscribe to (e.g., 'auth.success').

Successful Response (200 OK)

Returns the complete, updated configuration object.

json
{
  "success": true,
  "config": {
    // ... updated configuration object
  }
}