Skip to main content

Endpoint

POST /api/interview/sessions
Creates a new interview session with AI-generated questions tailored to the candidate’s resume. The system analyzes the resume text and generates questions across multiple technical categories including Java basics, Spring framework, databases, and project experience.
This endpoint is rate-limited to 5 requests per IP address and 5 globally to prevent abuse.

Request Body

resumeText
string
required
The complete resume text content to analyze. This will be used to generate personalized interview questions based on the candidate’s experience and skills.
questionCount
integer
required
Number of interview questions to generate. Must be between 3 and 20 questions.
  • Minimum: 3
  • Maximum: 20
  • Recommended: 8-12 for a comprehensive interview
resumeId
long
required
The unique identifier of the resume in the database. Used to associate the interview session with a specific resume for tracking and history purposes.
forceCreate
boolean
default:"false"
Whether to force creation of a new session even if an unfinished session exists for this resume.
  • false (default): Returns existing unfinished session if one exists
  • true: Creates a new session regardless of existing unfinished sessions

Response

code
integer
Response status code. 200 indicates success.
message
string
Response message. Returns "success" on successful creation.
data
object
The interview session data containing all session details and questions.

Example Request

curl -X POST https://api.example.com/api/interview/sessions \
  -H "Content-Type: application/json" \
  -d '{
    "resumeText": "张三\n高级Java工程师\n5年开发经验\n\n技能:\n- Java, Spring Boot, Spring Cloud\n- MySQL, Redis, Kafka\n- 微服务架构设计\n\n项目经验:\n1. 电商平台后端系统\n   - 使用Spring Cloud构建微服务架构\n   - 实现分布式事务和缓存方案\n   - 日均处理订单10万+",
    "questionCount": 8,
    "resumeId": 12345,
    "forceCreate": false
  }'

Example Response

{
  "code": 200,
  "message": "success",
  "data": {
    "sessionId": "a1b2c3d4-e5f6-4789-g0h1-i2j3k4l5m6n7",
    "resumeText": "张三\n高级Java工程师...",
    "totalQuestions": 8,
    "currentQuestionIndex": 0,
    "status": "CREATED",
    "questions": [
      {
        "questionIndex": 0,
        "question": "请介绍一下你在电商平台项目中如何使用Spring Cloud构建微服务架构的?",
        "type": "PROJECT",
        "category": "项目经历",
        "userAnswer": null,
        "score": null,
        "feedback": null,
        "isFollowUp": false,
        "parentQuestionIndex": null
      }
    ]
  }
}

Session Lifecycle

1

Create Session

Call this endpoint to create a new interview session. The AI analyzes the resume and generates personalized questions.
2

Answer Questions

Use the Submit Answer endpoint to answer each question sequentially. The system may generate follow-up questions based on your answers.
3

Complete Interview

After answering all questions, the session status changes to COMPLETED. You can also manually complete early using the complete endpoint.
4

Generate Report

Use the Get Report endpoint to retrieve AI-generated evaluation, scores, and improvement suggestions.
5

Export or Delete

Get Unfinished Session

Check for existing unfinished sessions before creating a new one

Submit Answer

Submit answers to interview questions

Get Session

Retrieve complete session details

Complete Interview

Manually complete interview early

Additional Operations

Get Unfinished Session

Before creating a new session, you can check if the user has any unfinished sessions for a specific resume.
GET /api/interview/sessions/unfinished/{resumeId}
resumeId
long
required
The resume ID to check for unfinished sessions.
Example:
curl https://api.example.com/api/interview/sessions/unfinished/12345
Response: Returns the same InterviewSessionDTO structure if an unfinished session exists.

Get Session

Retrieve complete details of an existing interview session.
GET /api/interview/sessions/{sessionId}
sessionId
string
required
The unique session identifier.
Example:
curl https://api.example.com/api/interview/sessions/a1b2c3d4-e5f6-4789-g0h1-i2j3k4l5m6n7

Complete Interview

Manually complete an interview session before answering all questions.
POST /api/interview/sessions/{sessionId}/complete
sessionId
string
required
The session ID to complete.
Example:
curl -X POST https://api.example.com/api/interview/sessions/a1b2c3d4-e5f6-4789-g0h1-i2j3k4l5m6n7/complete
Response:
{
  "code": 200,
  "message": "success",
  "data": null
}

Error Responses

code
integer
Error code. Non-200 values indicate an error.
message
string
Error message describing what went wrong.
data
null
Always null for error responses.

Common Errors

CodeMessageDescription
400简历文本不能为空Resume text is required
400题目数量最少3题Question count must be at least 3
400题目数量最多20题Question count cannot exceed 20
400简历ID不能为空Resume ID is required
429Rate limit exceededToo many requests, try again later
500Server errorInternal server error occurred

Best Practices

Always check if an unfinished session exists before creating a new one to avoid duplicate sessions and maintain continuity.
// Check for unfinished session first
const unfinished = await fetch(`/api/interview/sessions/unfinished/${resumeId}`);
if (unfinished.data) {
  // Resume existing session
  return unfinished.data;
}

// Create new session
const newSession = await fetch('/api/interview/sessions', {
  method: 'POST',
  body: JSON.stringify({ resumeText, questionCount, resumeId })
});
Choose question count based on interview depth:
  • Quick screening (3-5 questions): Basic skill assessment
  • Standard interview (8-12 questions): Comprehensive evaluation
  • In-depth interview (15-20 questions): Senior positions with complex requirements
Provide detailed resume text for better question generation:
  • Include project descriptions with technical details
  • List specific technologies and frameworks used
  • Mention scale and complexity of projects
  • Add years of experience for context
Store the sessionId securely and persist it across page refreshes. The session remains active until completed or deleted.
Interview sessions are stored in the database and associated with the resume ID. You can retrieve session history and details later for analysis.

Build docs developers (and LLMs) love