Skip to main content

Request OTP

Sends a one-time password to the given identifier (phone or email). In production this integrates with an SMS or email gateway. Rate limits: 5 requests per 15 min per IP and per identifier. In non-production environments the plaintext code is returned as devCode.

Request

Method: POST
Path: /api/auth/otp/request

Authentication: Not required

Request Body

Content Type: application/json

Schema: See component schemas below

Responses

200 - OTP generated

400 - Invalid request

429 - Rate limit exceeded

Examples

cURL

curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
http://localhost:3000/api/auth/otp/request \
-d '{"example": "data"}'

JavaScript

const response = await fetch('http://localhost:3000/api/auth/otp/request', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + token,
},
body: JSON.stringify({
// Request data
}),
});

const data = await response.json();
console.log(data);

This documentation is automatically generated from the OpenAPI specification.