Kotlin API Explorer

Kotlin Android Client Architecture

Kotlin Mobile API Explorer & Code Generator

Live testing console for all 24 backend endpoints, complete with production-ready Kotlin Retrofit & Coroutines code.

Host: window.location.origin

Available Endpoints

29 Routes

Live REST Request SandboxAuthentication

POST
Server Response Payload
Click "Send Request" above to fire this request against the live Next.js backend!

Android Kotlin Code Generator

Copy-pasteable production Kotlin source code for your mobile app

package com.onepaper.app.data.remote

import com.onepaper.app.data.model.*
import retrofit2.Response
import retrofit2.http.*

interface OnePaperApiService {

    // --- Authentication ---
    @POST("api/auth/login")
    suspend fun login(
        @Body request: LoginRequest
    ): Response<AuthResponse>

    @POST("api/auth/register")
    suspend fun register(
        @Body request: RegisterRequest
    ): Response<AuthResponse>

    // --- Exams & Syllabus ---
    @GET("api/exams")
    suspend fun getExams(
        @Query("agency") agency: String? = null,
        @Query("popular") popular: Boolean? = null
    ): Response<ApiResponse<List<Exam>>>

    @GET("api/exams/{id}")
    suspend fun getExamDetails(
        @Path("id") examId: String
    ): Response<ApiResponse<ExamDetail>>

    // --- Subjects & Topics ---
    @GET("api/subjects")
    suspend fun getSubjects(): Response<ApiResponse<List<Subject>>>

    @GET("api/subjects/{subjectName}/topics")
    suspend fun getTopics(
        @Path("subjectName") subjectName: String
    ): Response<ApiResponse<List<Topic>>>

    // --- Question Bank & Practice ---
    @GET("api/questions/practice")
    suspend fun getPracticeQuestions(
        @Query("subject") subject: String? = null,
        @Query("topic") topic: String? = null,
        @Query("difficulty") difficulty: String? = null,
        @Query("limit") limit: Int = 20,
        @Query("offset") offset: Int = 0
    ): Response<QuestionsListResponse>

    @GET("api/questions/bookmarked")
    suspend fun getBookmarkedQuestions(
        @Header("Authorization") token: String
    ): Response<ApiResponse<List<Question>>>

    @POST("api/questions/{id}/bookmark")
    suspend fun toggleBookmark(
        @Header("Authorization") token: String,
        @Path("id") questionId: String
    ): Response<BookmarkResponse>

    // --- Mock Tests ---
    @GET("api/mock-tests")
    suspend fun getMockTests(
        @Query("examId") examId: String? = null
    ): Response<ApiResponse<List<MockTest>>>

    @POST("api/mock-tests/{id}/start")
    suspend fun startMockTest(
        @Path("id") testId: String
    ): Response<ApiResponse<TestSession>>

    // --- Attempt Submission & Results ---
    @POST("api/attempts/submit")
    suspend fun submitAttempt(
        @Header("Authorization") token: String,
        @Body submission: AttemptSubmission
    ): Response<ApiResponse<AttemptResult>>

    @GET("api/attempts/history")
    suspend fun getAttemptHistory(
        @Header("Authorization") token: String
    ): Response<AttemptHistoryResponse>

    // --- Job Alerts ---
    @GET("api/jobs")
    suspend fun getJobs(
        @Query("agency") agency: String? = null,
        @Query("status") status: String? = null
    ): Response<ApiResponse<List<Job>>>

    // --- System & Diagnostics ---
    @GET("api/health")
    suspend fun checkHealth(): Response<HealthResponse>
}