REST API
Create Session
Your backend endpoint that creates a session token for the SmartAI portal. Your frontend calls this before opening the assessment.
POST
You build this endpoint. The path
/assessment/session is whatever route you choose in your own app. Internally it calls client.createSession() from the Backend SDK and returns the token to your frontend.How it fits in the flow
Environment variables required
Add these to your server’s.env file before this endpoint will work:
Request
Headers
Your app’s authentication token for the logged-in recruiter. Format:
Bearer <jwt>.
Protect this endpoint so only your own recruiter accounts can call it.Must be
application/json.Body
Array of candidate objects to include in this assessment session. Must have at least one item.
Your internal recruiter ID. Pass this or
recruiterEmail — at least one is required.The recruiter’s email address. Pass this or
recruiterId — at least one is required.Response
true when the session was created successfully.Common mistakes
| Mistake | What happens | Fix |
|---|---|---|
ASSESSMENT_API_KEY not set in .env | Returns 500 | Add the key to your server .env |
Sending users: [] empty array | Returns 400 | Make sure candidates are selected before calling |
Neither recruiterId nor recruiterEmail sent | Returns 400 | Pass at least one recruiter field |
| Calling this from the browser directly | API key exposed in network tab | Always call through your backend |
| Reusing the same token for a second session | Token expired error | Always request a fresh token |

