Below is your corrected documentation where I replaced every real-looking API key or token example with:
<YOUR_API_KEY><YOUR_API_TOKEN>This follows API security best practices because real API keys should never appear in public documentation. ([apidog][1])
Base URL: {APP_URL}/api (web/React). Mobile: {APP_URL}/mobile/v1
Sitemap: The backend generates a sitemap for the React frontend’s public pages (Spatie Laravel Sitemap). URL: {APP_URL}/sitemap.xml. It includes static routes (/, /about, /products, /services, /portfolio, /contact, /become-partner, /blog) and published blog detail URLs ({FRONTEND_URL}/blog/{slug}). Regenerate with php artisan sitemap:generate; schedule every 4 hours with cron: 0 */4 * * * cd /path/to/backend && php artisan sitemap:generate. Set FRONTEND_URL in .env to the React app’s base URL.
All API and mobile routes are protected by ejarnutowski/laravel-api-key. Send an active API key on every request in the header:
| Header | Value | Description |
|---|---|---|
| X-Authorization | Your API key | An active key created via php artisan apikey:generate {name} |
Backend: Generate keys with
php artisan apikey:generate credicare-web
List keys with
php artisan apikey:list
Keys are stored in the api_keys table; only active keys are accepted.
Frontend (React):
Set VITE_INTERNAL_API_KEY in the project root .env.
Mobile app:
Send the same key in X-Authorization on each request.
X-Authorization: <YOUR_API_KEY>
Error
401
{
"errors": [
{ "message": "Unauthorized" }
]
}
Authentication is handled by Laravel Sanctum.
After login/register, the API returns a token.
Send it in the header:
Authorization: Bearer <YOUR_API_TOKEN>
Check API availability.
{
"status": "ok",
"timestamp": "2025-01-01T12:00:00.000000Z"
}
Login and receive a Sanctum API token.
| Field | Type | Required | Description |
|---|---|---|---|
| string | Yes | User email | |
| password | string | Yes | User password |
| role | string | No | super-admin, regional-center, end-user |
{
"token": "<YOUR_API_TOKEN>",
"user": {
"id": 1,
"email": "user@example.com",
"fullName": "John Doe",
"role": "end-user",
"status": "active",
"regionalCenterId": null,
"regionalCenterName": null
}
}
Errors:
401 Invalid email or password
Register a new end-user.
| Field | Type | Required | Description |
|---|---|---|---|
| fullName | string | Yes | Full name |
| string | Yes | ||
| phone | string | No | Phone |
| password | string | Yes | Min 6 chars |
| panCard | string | No | PAN |
| aadhaar | string | No | Aadhaar |
{
"token": "<YOUR_API_TOKEN>",
"user": {
"id": 1,
"email": "user@example.com",
"fullName": "John Doe",
"role": "end-user",
"status": "pending_kyc"
}
}
{
"email": "user@example.com"
}
{
"message": "If an account exists for this email, you will receive a reset link."
}
| Field | Type | Required |
|---|---|---|
| token | string | Yes |
| password | string | Yes |
{
"message": "Password has been reset successfully"
}
Auth required.
{
"id": 1,
"email": "user@example.com",
"fullName": "John Doe",
"role": "end-user",
"status": "active"
}
| Field | Required |
|---|---|
| name | Yes |
| Yes | |
| phone | Yes |
| subject | Yes |
| message | Yes |
{
"message": "Message sent successfully. We'll get back to you within 24 hours."
}
Submit partner application.
Response
{
"message": "Application submitted successfully. Our partnership team will contact you within 48 hours."
}
Public endpoint.
{
"logo": "https://...",
"logoAlt": "CrediCare"
}
{
"creditCardPayment": 2.5,
"emiConversion": 3.5
}
| Field | Required |
|---|---|
| creditCardId | Yes |
| amount | Yes |
| paymentMethod | Yes |
{
"transactionId": "TXN1735123456",
"amount": 10000,
"fee": 250,
"total": 10250,
"status": "completed"
}
{
"id": "TXN001",
"customer": "John Doe",
"amount": 25000,
"fee": 625,
"commission": 250,
"method": "upi",
"status": "completed"
}
{
"id": 1,
"title": "Payment Due Soon",
"message": "HDFC Card payment due on Oct 30",
"type": "reminder",
"isRead": false
}
| Code | Description |
|---|---|
| 400 | Validation error |
| 401 | Invalid token |
| 403 | Forbidden |
| 404 | Not found |
| 500 | Server error |
Example:
{
"error": "Authentication required"
}