API & Integration

{{-- Subscription & Plan (read-only) --}}
Your Plan
Current Plan
{{ $school->plan }}
API Requests
{{ number_format($school->api_requests_used) }} / {{ $school->plan === 'enterprise' ? '∞' : number_format($school->api_requests_limit) }}
Expires
@if ($school->plan === 'free') Never @elseif ($school->subscription_expires_at) {{ $school->subscription_expires_at->format('M d, Y') }} @else Not set @endif
Last Reset
{{ $school->api_requests_reset_at ? $school->api_requests_reset_at->format('M d, Y') : 'Never' }}
@if (!$school->isSubscriptionActive()) @endif
{{-- API Key (read-only) --}}
API Key
@if ($school->api_key)
{{ $school->api_key }}
@else

No API key has been generated yet. Contact the Super Admin to generate one.

@endif
{{-- API Endpoint (read-only reference) --}}
API Endpoint

@if ($school->api_key) Send a POST request with your API key in the X-API-Key header. @else Send a POST request to the chatbot API. No API key required for this school. @endif

// POST request
POST {{ url('/api/chatbot') }}
// Headers
Content-Type: application/json
@if ($school->api_key)
X-API-Key: {{ $school->api_key }}
@endif
// Body
{
"message": "Is admission open?",
"school_code": "{{ $school->code }}"
}
{{-- Widget Embed Code --}}
Widget Embed Code

Copy and paste this code into your school's website, just before the closing </body> tag.

<!-- ShikshaLink Chatbot Widget -->
<script src="{{ url('/widget.js') }}"
        data-api="{{ url('/api') }}"
        data-school="{{ $school->code }}"{{ $school->api_key ? "\n        data-key=\"{$school->api_key}\"" : '' }}></script>
@push('scripts') @endpush