Documentation

Resume Management API

SmartCV resume management API documentation, including resume creation, editing, deletion, export and other features

Updated: 12/30/2024

SmartCV resume management API provides complete resume CRUD operations, supporting resume creation, editing, deletion, export, sharing and other features.

📋 API Endpoint Overview

EndpointMethodDescription
/api/resumesGETGet user resume list
/api/resumesPOSTCreate new resume
/api/resumes/[id]GETGet specified resume details
/api/resumes/[id]PUTUpdate resume information
/api/resumes/[id]DELETEDelete resume
/api/resumes/[id]/exportPOSTExport resume
/api/resumes/[id]/sharePOSTCreate share link
/api/resumes/[id]/sharePUTUpdate share settings
/api/resumes/[id]/projectsGETGet resume project experience
/api/resumes/[id]/projectsPOSTAdd project experience

🔍 Get Resume List

Endpoint: GET /api/resumes

Description: Get all resumes for the current user

Authentication: Required login

Query Parameters:

  • page (optional): Page number, default is 1
  • limit (optional): Items per page, default is 10
  • status (optional): Filter by status (DRAFT, PUBLISHED, ARCHIVED)

Response:

{
  "success": true,
  "data": [
    {
      "id": "resume_123",
      "title": "Software Engineer Resume",
      "status": "DRAFT",
      "templateId": "template_456",
      "template": {
        "id": "template_456",
        "name": "Modern Minimal",
        "category": "MODERN"
      },
      "atsScore": 85,
      "keywordMatchScore": 78,
      "createdAt": "2024-12-30T10:00:00Z",
      "updatedAt": "2024-12-30T15:00:00Z",
      "shareInfo": {
        "isEnabled": true,
        "viewCount": 12,
        "hasPassword": false,
        "lastViewedAt": "2024-12-30T14:00:00Z"
      }
    }
  ],
  "meta": {
    "total": 5,
    "page": 1,
    "limit": 10,
    "totalPages": 1
  }
}

➕ Create Resume

Endpoint: POST /api/resumes

Description: Create a new resume

Authentication: Required login

Request Body:

{
  "title": "Software Engineer Resume",
  "templateId": "template_456",
  "contentJson": {
    "personalInfo": {
      "name": "Zhang San",
      "email": "zhangsan@example.com",
      "phone": "13800138000",
      "address": "Chaoyang District, Beijing",
      "summary": "5 years of software development experience..."
    },
    "workExperience": [
      {
        "company": "ABC Technology Company",
        "position": "Senior Software Engineer",
        "startDate": "2021-01",
        "endDate": "2024-12",
        "description": "Responsible for core product development..."
      }
    ],
    "education": [
      {
        "school": "Peking University",
        "degree": "Computer Science and Technology",
        "startDate": "2017-09",
        "endDate": "2021-06"
      }
    ],
    "skills": ["JavaScript", "React", "Node.js", "Python"],
    "projects": [
      {
        "name": "E-commerce Platform",
        "description": "E-commerce platform developed with React and Node.js",
        "technologies": ["React", "Node.js", "MongoDB"],
        "url": "https://github.com/example/ecommerce"
      }
    ]
  }
}

Response:

{
  "success": true,
  "data": {
    "id": "resume_123",
    "title": "Software Engineer Resume",
    "status": "DRAFT",
    "templateId": "template_456",
    "template": {
      "id": "template_456",
      "name": "Modern Minimal",
      "category": "MODERN"
    },
    "contentJson": {
      /* Complete resume content */
    },
    "createdAt": "2024-12-30T10:00:00Z",
    "updatedAt": "2024-12-30T10:00:00Z"
  }
}

📄 Get Resume Details

Endpoint: GET /api/resumes/[id]

Description: Get detailed information of specified resume

Authentication: Required login

Path Parameters:

  • id: Resume ID

Response:

{
  "success": true,
  "data": {
    "id": "resume_123",
    "title": "Software Engineer Resume",
    "status": "DRAFT",
    "templateId": "template_456",
    "template": {
      "id": "template_456",
      "name": "Modern Minimal",
      "category": "MODERN",
      "htmlTemplate": "...",
      "cssStyles": "..."
    },
    "contentJson": {
      "personalInfo": {
        /* Personal information */
      },
      "workExperience": [
        /* Work experience */
      ],
      "education": [
        /* Education background */
      ],
      "skills": [
        /* Skills list */
      ],
      "projects": [
        /* Project experience */
      ]
    },
    "sectionsVisibility": {
      "personalInfo": true,
      "workExperience": true,
      "education": true,
      "skills": true,
      "projects": true
    },
    "atsScore": 85,
    "keywordMatchScore": 78,
    "targetJobDescription": "...",
    "createdAt": "2024-12-30T10:00:00Z",
    "updatedAt": "2024-12-30T15:00:00Z"
  }
}

✏️ Update Resume

Endpoint: PUT /api/resumes/[id]

Description: Update resume information

Authentication: Required login

Path Parameters:

  • id: Resume ID

Request Body:

{
  "title": "New Resume Title",
  "templateId": "template_789",
  "contentJson": {
    /* Updated resume content */
  },
  "sectionsVisibility": {
    "personalInfo": true,
    "workExperience": true,
    "education": false,
    "skills": true,
    "projects": true
  },
  "status": "PUBLISHED"
}

Response:

{
  "success": true,
  "data": {
    /* Updated resume information */
  }
}

🗑️ Delete Resume

Endpoint: DELETE /api/resumes/[id]

Description: Delete specified resume (soft delete)

Authentication: Required login

Path Parameters:

  • id: Resume ID

Response:

{
  "success": true,
  "message": "Resume deleted successfully"
}

📤 Export Resume

Endpoint: POST /api/resumes/[id]/export

Description: Export resume to specified format

Authentication: Required login

Path Parameters:

  • id: Resume ID

Request Body:

{
  "format": "pdf",
  "options": {
    "pageSize": "A4",
    "margin": "normal",
    "includePhoto": true,
    "colorScheme": "default"
  }
}

Response:

{
  "success": true,
  "data": {
    "downloadUrl": "https://storage.smartcv.cc/exports/resume_123.pdf",
    "filename": "Zhang_San_Software_Engineer_Resume.pdf",
    "format": "pdf",
    "fileSize": 1024000,
    "expiresAt": "2024-12-31T10:00:00Z"
  }
}

Supported Export Formats:

  • pdf: PDF document
  • docx: Word document
  • html: HTML webpage
  • txt: Plain text

Endpoint: POST /api/resumes/[id]/share

Description: Create share link for resume

Authentication: Required login

Path Parameters:

  • id: Resume ID

Request Body:

{
  "isEnabled": true,
  "password": "optional-password",
  "expiresAt": "2025-01-30T10:00:00Z",
  "allowDownload": true,
  "allowComments": false
}

Response:

{
  "success": true,
  "data": {
    "id": "share_123",
    "token": "abc123def456",
    "shareUrl": "https://smartcv.cc/share/abc123def456",
    "isEnabled": true,
    "hasPassword": true,
    "allowDownload": true,
    "allowComments": false,
    "viewCount": 0,
    "expiresAt": "2025-01-30T10:00:00Z",
    "createdAt": "2024-12-30T10:00:00Z"
  }
}

🔄 Update Share Settings

Endpoint: PUT /api/resumes/[id]/share

Description: Update resume share settings

Authentication: Required login

Path Parameters:

  • id: Resume ID

Request Body:

{
  "isEnabled": false,
  "password": null,
  "expiresAt": null,
  "allowDownload": false,
  "allowComments": true
}

Response:

{
  "success": true,
  "data": {
    /* Updated share settings */
  }
}

📊 Get Project Experience

Endpoint: GET /api/resumes/[id]/projects

Description: Get project experience list for resume

Authentication: Required login

Path Parameters:

  • id: Resume ID

Response:

{
  "success": true,
  "data": [
    {
      "id": "project_123",
      "name": "E-commerce Platform",
      "description": "E-commerce platform developed with React and Node.js",
      "technologies": ["React", "Node.js", "MongoDB"],
      "url": "https://github.com/example/ecommerce",
      "startDate": "2023-01",
      "endDate": "2023-12",
      "highlights": ["Implemented user authentication and authorization system", "Designed efficient database architecture", "Optimized frontend performance, improving loading speed by 50%"]
    }
  ]
}

➕ Add Project Experience

Endpoint: POST /api/resumes/[id]/projects

Description: Add new project experience to resume

Authentication: Required login

Path Parameters:

  • id: Resume ID

Request Body:

{
  "name": "New Project",
  "description": "Project description",
  "technologies": ["Technology stack"],
  "url": "https://github.com/example/project",
  "startDate": "2024-01",
  "endDate": "2024-12",
  "highlights": ["Main achievement 1", "Main achievement 2"]
}

Response:

{
  "success": true,
  "data": {
    "id": "project_124"
    /* Newly created project information */
  }
}

📝 Usage Examples

JavaScript Example

// Get resume list
async function getResumes() {
  const response = await fetch('/api/resumes', {
    credentials: 'include'
  })
  const data = await response.json()
  return data.data
}
 
// Create new resume
async function createResume(resumeData) {
  const response = await fetch('/api/resumes', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    credentials: 'include',
    body: JSON.stringify(resumeData)
  })
 
  const data = await response.json()
  if (data.success) {
    console.log('Resume created successfully:', data.data)
  } else {
    console.error('Creation failed:', data.error)
  }
}
 
// Update resume
async function updateResume(resumeId, updates) {
  const response = await fetch(`/api/resumes/${resumeId}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json'
    },
    credentials: 'include',
    body: JSON.stringify(updates)
  })
 
  return response.json()
}
 
// Export resume
async function exportResume(resumeId, format = 'pdf') {
  const response = await fetch(`/api/resumes/${resumeId}/export`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    credentials: 'include',
    body: JSON.stringify({
      format,
      options: {
        pageSize: 'A4',
        margin: 'normal'
      }
    })
  })
 
  const data = await response.json()
  if (data.success) {
    // Download file
    window.open(data.data.downloadUrl, '_blank')
  }
}
 
// Create share link
async function createShareLink(resumeId, settings) {
  const response = await fetch(`/api/resumes/${resumeId}/share`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    credentials: 'include',
    body: JSON.stringify(settings)
  })
 
  const data = await response.json()
  if (data.success) {
    return data.data.shareUrl
  }
}

React Hook Example

import { useState, useEffect } from 'react'
 
function useResumes() {
  const [resumes, setResumes] = useState([])
  const [loading, setLoading] = useState(true)
  const [error, setError] = useState(null)
 
  useEffect(() => {
    fetchResumes()
  }, [])
 
  const fetchResumes = async () => {
    try {
      setLoading(true)
      const response = await fetch('/api/resumes', {
        credentials: 'include'
      })
      const data = await response.json()
 
      if (data.success) {
        setResumes(data.data)
      } else {
        setError(data.error)
      }
    } catch (err) {
      setError('Failed to fetch resume list')
    } finally {
      setLoading(false)
    }
  }
 
  const createResume = async (resumeData) => {
    try {
      const response = await fetch('/api/resumes', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json'
        },
        credentials: 'include',
        body: JSON.stringify(resumeData)
      })
 
      const data = await response.json()
      if (data.success) {
        setResumes((prev) => [data.data, ...prev])
        return data.data
      } else {
        throw new Error(data.error)
      }
    } catch (err) {
      setError(err.message)
      throw err
    }
  }
 
  const deleteResume = async (resumeId) => {
    try {
      const response = await fetch(`/api/resumes/${resumeId}`, {
        method: 'DELETE',
        credentials: 'include'
      })
 
      const data = await response.json()
      if (data.success) {
        setResumes((prev) => prev.filter((r) => r.id !== resumeId))
      } else {
        throw new Error(data.error)
      }
    } catch (err) {
      setError(err.message)
      throw err
    }
  }
 
  return {
    resumes,
    loading,
    error,
    createResume,
    deleteResume,
    refetch: fetchResumes
  }
}

❌ Error Handling

Common Error Codes

Error CodeHTTP StatusDescription
RESUME_NOT_FOUND404Resume does not exist
RESUME_NOT_OWNED403No permission to access this resume
INVALID_TEMPLATE400Template does not exist or is invalid
CONTENT_TOO_LARGE413Resume content is too large
EXPORT_FAILED500Export failed
SHARE_LIMIT_EXCEEDED429Share limit exceeded

Error Response Example

{
  "error": "Resume does not exist or has been deleted",
  "code": "RESUME_NOT_FOUND",
  "details": {
    "resumeId": "resume_123"
  }
}

Next Steps

🎨 Template System

Learn how to use template API to manage resume templates

🤖 AI Services

Learn how to use AI analysis and optimization features