Student Emails
Provision, manage, and suspend student email accounts across all three email tiers.
How it works
- Choose a tier — Nexa-hosted subdomain, your own domain via Stalwart, or Google Workspace
- Configure once — set
email.tierandemail.domainincreateNexa() - Create accounts — call
nexa.email.create()ornexa.email.bulkCreate()— tier-agnostic - Manage lifecycle — suspend, restore, and reset passwords without touching the provider directly
Your live API key gates all email delivery. Test keys (nxa_test_...) are accepted by the SDK but will be rejected by the email endpoints — use a live key for real provisioning.
Tier guide
| Tier | ID | Domain example | Requirements |
|---|---|---|---|
| Nexa Hosted | tier-1-nexa | loretto.nexa-ed.com | Nothing — live key unlocked at signup |
| Custom Domain | tier-2-stalwart | loretto.edu.ng | Domain verified in dashboard |
| Google Workspace | tier-3-google | loretto.edu.ng | GWS credentials saved + domain verified |
Set your tier and domain once in lib/nexa.ts — all nexa.email.* methods use it automatically.
Setup
Warning
Live key required. Test keys (nxa_test_...) cannot deliver emails.
Set NEXA_API_KEY to your nxa_live_... key before calling any nexa.email.* method.
nexa.email.create()
Provision a single student email account. The email address is derived from the student's name and your configured domain.
Server-side only — your API key must not be exposed to the browser.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
studentId | string | Yes | Your internal student identifier |
firstName | string | Yes | Student's first name |
lastName | string | Yes | Student's last name |
email | string | No | Override the auto-generated address |
gradeLevel | string | No | e.g. "JSS2", "SS3" |
recoveryEmail | string | No | Parent/guardian recovery address |
nexa.email.bulkCreate()
Create up to 500 accounts in a single call. Processing happens in the background — you get a jobId to poll for progress.
When the job finishes, Nexa sends an email.bulk_completed webhook to your registered endpoint with the final counts. The webhook payload is intentionally lean — use nexa.email.getJobStatus(jobId) to fetch the full per-student breakdown.
nexa.email.list()
List provisioned email accounts for your tenant. Filter by status and limit results.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
status | "active" | "suspended" | "deleted" | — | Filter by account status |
limit | number | 100 | Max accounts to return (1–500) |
nexa.email.suspend()
Disable a student's email login without deleting their mailbox. All stored messages and data are preserved.
nexa.email.restore()
Re-enable a suspended account.
nexa.email.resetPassword()
Generate a new temporary password. Share it securely with the student — they will be prompted to change it on first login.
nexa.email.getJobStatus()
Poll the progress of a bulk provisioning job.
Return type
Type reference
React components
For ready-made provisioning UI without building it yourself:
<StudentEmailAccountManager />— create, list, suspend, and restore accounts<EmailBulkProvisioningPanel />— bulk import with live job progress
What's next
- Domain setup — verify your domain to unlock the live key
- REST API — Student Emails — raw HTTP reference for all endpoints
- Webhooks — receive
email.bulk_completedwhen a bulk job finishes; pull full results vianexa.email.getJobStatus(jobId)