Skip to main content
CodePlanet Docs

Endpoints Reference

Complete endpoint documentation

Complete reference for all CodePlanet API endpoints. All endpoints are under /api/v1/.

Base URL

https://acodeplanet.tech/api/v1

For local development:

http://localhost:3000/api/v1

Authentication

Most endpoints require authentication. Include your token in the Authorization header:

Authorization: Bearer <your_token>

Or use an API key:

X-API-Key: <your_api_key>

Problems

List Problems

GET /problems

Query parameters:

ParameterTypeDescription
pagenumberPage number (default: 1)
limitnumberItems per page (default: 20, max: 100)
difficultystringFilter by difficulty: easy, medium, hard
topicstringFilter by topic tag
statusstringsolved, attempted, unsolved
searchstringSearch in title and description

Response:

{
  "success": true,
  "data": {
    "problems": [
      {
        "id": "two-sum",
        "title": "Two Sum",
        "difficulty": "easy",
        "topics": ["arrays", "hash-table"],
        "acceptance_rate": 48.2,
        "status": "solved"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 500,
      "totalPages": 25
    }
  }
}

Get Problem

GET /problems/:slug

Response:

{
  "success": true,
  "data": {
    "id": "two-sum",
    "title": "Two Sum",
    "difficulty": "easy",
    "description": "Given an array of integers...",
    "examples": [...],
    "constraints": [...],
    "topics": ["arrays", "hash-table"],
    "companies": ["google", "amazon"],
    "starterCode": {
      "python": "def twoSum(nums, target):\n    pass",
      "javascript": "function twoSum(nums, target) {\n    \n}"
    }
  }
}

Submit Solution

POST /problems/:slug/submit
Content-Type: application/json
 
{
  "language": "python",
  "code": "def twoSum(nums, target):\n    seen = {}\n    ..."
}

Response:

{
  "success": true,
  "data": {
    "submission_id": "sub_123abc",
    "status": "accepted",
    "runtime": "45 ms",
    "memory": "16.2 MB",
    "testCases": {
      "passed": 57,
      "total": 57
    }
  }
}

Submissions

List Submissions

GET /submissions

Query parameters:

ParameterTypeDescription
problemstringFilter by problem slug
statusstringaccepted, wrong_answer, runtime_error, time_limit
languagestringFilter by language
limitnumberItems per page (default: 20)

Get Submission

GET /submissions/:id

Learning

Get Weak Topics

GET /learning/weak-topics

Response:

{
  "success": true,
  "data": {
    "weakTopics": [
      {
        "topic": "dynamic-programming",
        "weakness_score": 78.5,
        "total_attempts": 15,
        "correct_attempts": 4,
        "success_rate": 0.267,
        "recommended_problems": ["dp-001", "dp-002"]
      }
    ],
    "learningProfile": {
      "strongestTopic": "arrays",
      "overallSuccessRate": 0.72,
      "totalProblemsAttempted": 145
    }
  }
}

Record Attempt

POST /learning/weak-topics
Content-Type: application/json
 
{
  "topics": ["dynamic-programming", "memoization"],
  "isCorrect": false
}

Get Learning Path Progress

GET /learning/paths/:pathId/progress

User

Get Current User

GET /user/me

Response:

{
  "success": true,
  "data": {
    "id": "user_123",
    "email": "user@example.com",
    "name": "John Doe",
    "avatar": "https://...",
    "plan": "pro",
    "stats": {
      "problemsSolved": 145,
      "currentStreak": 12,
      "xp": 4500,
      "level": 8
    }
  }
}

Update Profile

PATCH /user/me
Content-Type: application/json
 
{
  "name": "Jane Doe",
  "bio": "Software Engineer"
}

Get User Stats

GET /user/stats

Payments

Create Order

POST /payments/create
Content-Type: application/json
 
{
  "planId": "pro"
}

Response:

{
  "success": true,
  "data": {
    "orderId": "order_123abc",
    "amount": 79900,
    "currency": "INR",
    "key": "rzp_test_xxx"
  }
}

Verify Payment

POST /payments/verify
Content-Type: application/json
 
{
  "razorpay_order_id": "order_123abc",
  "razorpay_payment_id": "pay_123abc",
  "razorpay_signature": "..."
}

Get Payment Status

GET /payments/status/:orderId

Documentation

List Docs

GET /docs

Get Doc by Slug

GET /docs?slug=introduction

Search Docs

GET /docs?search=authentication

Error Responses

All errors follow this format:

{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or expired token",
    "details": {}
  }
}

Error Codes

CodeHTTP StatusDescription
UNAUTHORIZED401Missing or invalid auth
FORBIDDEN403Insufficient permissions
NOT_FOUND404Resource not found
RATE_LIMITED429Too many requests
VALIDATION_ERROR400Invalid input
INTERNAL_ERROR500Server error

Rate Limits

See Rate Limits for detailed information.

SDKs

Official SDKs are planned for future releases:

  • JavaScript/TypeScript
  • Python
  • Go

Next Steps