Developer Documentation

Explore our highly scalable APIs with clear endpoints, request formats, and response examples.

PastPapers.wiki Search API

Search for past papers, marking schemes, and educational resources dynamically from the PastPapers.wiki database.

GET https://sh4lu-z-api.vercel.app/api/pastpapers.wiki

Query Parameters

ParamTypeRequiredDescription
qStringYesKeyword to search (e.g., "Combine Maths", "Physics").

Response Fields

FieldTypeDescription
creatorStringThe API developer's name.
statusStringReturns "success" if the request is handled properly.
search_queryStringThe exact query you searched for.
results_countIntegerTotal number of items found in the search.
dataArrayList of objects containing title, image, pdf_link, and source_page.

Error Handling

If the q parameter is missing or incorrectly formatted, the API returns the following error message:

ConditionStatus CodeResponse Example
Missing q parameter 400 / 200 {"error": "?q=maths)"}

Success Response Example

{
  "creator": "Sh4lu Z",
  "status": "success",
  "search_query": "Combine Maths",
  "results_count": 4,
  "data": [
    {
      "title": "2025 A/L Combined Maths Marking Scheme | Sinhala Medium",
      "image": "https://pastpapers.wiki/wp-content/uploads/2026/03/2024-AL-Markings-1-350x250.jpg",
      "pdf_link": "https://pastpapers.wiki/download/39724/2025-a-l-marking/105220/2025-al-combined-maths-marking-sm-past-papers-wiki.pdf",
      "source_page": "https://pastpapers.wiki/2025-a-l-combined-maths-marking-scheme-sinhala-medium/"
    }
  ]
}

QR Code Generator API

Generate QR codes dynamically from any text or URL. Returns a Base64 encoded PNG image that can be directly displayed in any web or mobile application without needing to save the image to a server.

POST https://sh4lu-z-api.vercel.app/api/QR

Request Body (JSON)

ParamTypeRequiredDescription
textStringYesThe text or link you want to encode into a QR code (e.g., "https://sh4lu-z.vercel.app").

Response Fields

FieldTypeDescription
qrCodeUrlStringA Base64 encoded data URL of the generated QR image.
errorStringReturns an error message if the generation fails.

Error Handling

ConditionStatus CodeResponse Example
Missing text parameter 400 {"error": "Text එකක් හෝ Link එකක් ලබා දෙන්න!"}
Server Generation Error 500 {"error": "QR Code එක හදන්න බැරි වුණා."}

Success Response Example

{
  "qrCodeUrl": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAYAAACI7Fo9AAAA..."
}

How to Display the QR Code (Integration Guide)

Since the API returns a Base64 data URL, you do not need to download the image. You can directly set this string as the src attribute of an HTML <img> tag.

// 1. Create an image tag in your HTML:
// QR Code

// 2. Fetch data from the API and display it:
async function getQR() {
    const response = await fetch('https://sh4lu-z-api.vercel.app/api/QR', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ text: "https://sh4lu-z.vercel.app" })
    });

    const data = await response.json();

    if (data.qrCodeUrl) {
        // Inject the Base64 string directly into the image source
        document.getElementById('myQrImage').src = data.qrCodeUrl;
    }
}

1. Password Strength Checker API

Analyze password security using the zxcvbn algorithm. It calculates the strength score and estimates the time required to crack the password against modern supercomputers.

POST https://sh4lu-z-api.vercel.app/api/password/check

Request Body (JSON)

ParamTypeRequiredDescription
passwordStringYesThe password string to be analyzed for security.

Response Fields

FieldTypeDescription
scoreIntegerStrength score from 0 (very weak) to 4 (very strong).
strength_levelStringHuman-readable strength (Weak, Medium, Strong, Very Strong).
crack_time_rawStringEstimated time to crack (e.g., "centuries", "10 days").
crack_time_descriptionStringDetailed explanation of security against supercomputers.
color_codeStringHex color code representing the security level (Red to Green).
warningStringSpecific security warnings if the password is unsafe.

Success Response Example

{
  "score": 4,
  "strength_level": "Very Strong",
  "color_code": "#33cc33",
  "crack_time_raw": "centuries",
  "crack_time_description": "Even with a supercomputer testing 10 billion passwords per second...",
  "warning": "Perfectly secure!"
}

2. Secure Password Generator API

Generate high-entropy, military-grade random passwords using Node.js crypto module. These passwords include a mix of uppercase, lowercase, numbers, and symbols with no repeating characters.

POST https://sh4lu-z-api.vercel.app/api/password/generate

Request Body (JSON)

ParamTypeRequiredDescription
lengthIntegerNoDesired password length (Default: 16, Minimum: 8).

Response Fields

FieldTypeDescription
generated_passwordStringThe cryptographically secure generated password.
lengthIntegerThe actual length of the generated password.

Success Response Example

{
  "generated_password": "G.Cyk(rH[g59(R2o",
  "length": 16
}

Security Note

This API is Stateless. We do not store, log, or cache any generated passwords or check requests. Data exists only in memory for the duration of the request.