Big Five API Documentation

Personality Assessment API

A stateless, production-ready API for Big Five personality assessments. Choose between local development or AWS serverless deployment.

Choose Your Deployment:

🚀 Local Development

Run locally for development and testing

Next.js API Routes
npm run dev → http://localhost:3000

☁️ AWS Serverless

Production-ready with auto-scaling

Lambda + API Gateway
./deploy.sh --stage prod

💡 Getting a Live API: Deploy to AWS Lambda using the serverless branch, or run locally with npm run dev to test the API.

Stateless Design
20+ Languages
120 Questions
43 Tests

Quick Start

🏠 Local Development

💡 Quick Test: Click the "Test API" button at the top of this page to test the API immediately!

1. Start Local Server
cd web && npm run dev

Server runs on http://localhost:3000

2. Test API Manually
curl -X POST http://localhost:3000/api/assessment/questions \
  -H "Content-Type: application/json" \
  -d '{"userId": "test-user"}'

Or use the "Test API" button

☁️ AWS Serverless (Production)

🚀 Get a Live API: Deploy to AWS Lambda for a production-ready API endpoint.

1. Switch to Serverless Branch
git checkout aws-serverless
2. Deploy to AWS
./deploy.sh --stage prod
3. Get Your Live API URL

After deployment, you'll get an API Gateway URL like:

https://abc123.execute-api.us-east-1.amazonaws.com/prod/assessment/questions

Use this URL in your applications for production API calls.

📝 Complete Example
# Calculate personality results
curl -X POST YOUR_API_URL/assessment/results \
  -H "Content-Type: application/json" \
  -d '{
    "assessmentId": "assessment_test-user_1234567890",
    "answers": [
      {"questionId": "43c98ce8-a07a-4dc2-80f6-c1b2a2485f06", "score": 4},
      {"questionId": "d50a597f-632b-4f7b-89e6-6d85b50fd1c9", "score": 3}
    ],
    "language": "en"
  }'

Replace YOUR_API_URL with your local URL or AWS API Gateway URL

API Endpoints

Available Endpoints:

GET/POST /assessment/questions
POST /assessment/answers
POST /assessment/results
GET /assessment/status
GET /assessment/history

All endpoints work with both local development and AWS serverless deployment

POSTGET/api/assessment/questions

Get Questions

Fetch 120 personality assessment questions for a user. Supports both POST and GET methods.

POST Request Body

{
  "userId": "user123",
  "language": "en"
}

GET Request

/api/assessment/questions?userId=user123&language=en

Response

{
  "assessmentId": "assessment_user123_1643723456789",
  "userId": "user123",
  "questions": [
    {
      "id": "43c98ce8-a07a-4dc2-80f6-c1b2a2485f06",
      "text": "Worry about things",
      "keyed": "plus",
      "domain": "N",
      "facet": 1,
      "choices": [
        {"text": "Very Inaccurate", "score": 1, "color": 1},
        {"text": "Moderately Inaccurate", "score": 2, "color": 2},
        {"text": "Neither Accurate Nor Inaccurate", "score": 3, "color": 3},
        {"text": "Moderately Accurate", "score": 4, "color": 4},
        {"text": "Very Accurate", "score": 5, "color": 5}
      ]
    }
  ],
  "assessmentInfo": {
    "name": "Johnson's IPIP NEO-PI-R",
    "shortId": "b5-120",
    "time": 10,
    "questionsCount": 120,
    "language": "en"
  },
  "status": "success"
}
POST/api/assessment/answers

Validate Answers

Validate user answers before processing

Request Body

{
  "assessmentId": "assessment_user123_1643723456789",
  "answers": [
    {
      "questionId": "43c98ce8-a07a-4dc2-80f6-c1b2a2485f06",
      "score": 4
    },
    {
      "questionId": "d50a597f-632b-4f7b-89e6-6d85b50fd1c9",
      "score": 3
    }
  ]
}

Response

{
  "success": true,
  "message": "Answers validated successfully. Store them on your side and use /api/assessment/results to calculate personality results.",
  "assessmentId": "assessment_user123_1643723456789",
  "answersCount": 1,
  "status": "validated"
}
POST/api/assessment/results

Calculate Results

Calculate personality assessment results from answers

Request Body

{
  "assessmentId": "assessment_user123_1643723456789",
  "answers": [
    {
      "questionId": "43c98ce8-a07a-4dc2-80f6-c1b2a2485f06",
      "score": 4
    },
    {
      "questionId": "d50a597f-632b-4f7b-89e6-6d85b50fd1c9",
      "score": 3
    }
  ],
  "language": "en"
}

Response

{
  "assessmentId": "assessment_user123_1643723456789",
  "results": {
    "overall": {
      "O": {"score": 45, "count": 10, "result": "high"},
      "C": {"score": 32, "count": 10, "result": "neutral"},
      "E": {"score": 50, "count": 10, "result": "high"},
      "A": {"score": 28, "count": 10, "result": "low"},
      "N": {"score": 25, "count": 10, "result": "low"}
    },
    "facets": {
      "O": {
        "1": {"score": 8, "count": 2, "result": "high"}
      }
    },
    "generatedAt": "2024-01-01T00:00:00.000Z",
    "rawScores": {
      "O": {"score": 45, "count": 10},
      "C": {"score": 32, "count": 10},
      "E": {"score": 50, "count": 10},
      "A": {"score": 28, "count": 10},
      "N": {"score": 25, "count": 10}
    }
  },
  "status": "completed",
  "language": "en",
  "answersProcessed": 1
}
GET/api/assessment/status

Get Assessment Status

Get basic information about an assessment. Useful for tracking assessment state.

Request

/api/assessment/status?assessmentId=assessment_user123_1643723456789

Response

{
  "assessmentId": "assessment_user123_1643723456789",
  "userId": "user123",
  "status": "info_only",
  "message": "This is a stateless API. Track assessment status on your side.",
  "apiType": "stateless"
}
GET/api/assessment/history

Get Assessment History

Get user's assessment history. Returns empty array since this is a stateless API.

Request

/api/assessment/history?userId=user123

Response

{
  "userId": "user123",
  "message": "This is a stateless API. Track assessment history on your side.",
  "apiType": "stateless",
  "history": [],
  "note": "Use your own database to store and retrieve assessment history."
}

Big Five Personality Traits

Openness

O

Imagination, curiosity, creativity

Conscientiousness

C

Organization, responsibility, dependability

Extraversion

E

Sociability, energy, assertiveness

Agreeableness

A

Cooperation, compassion, trust

Neuroticism

N

Emotional stability, anxiety, mood

Built with ❤️ using Next.js, TypeScript, and Tailwind CSS

Supports both local development and AWS serverless deployment with 43 comprehensive tests