User Registration API Documentation

Everything you need to integrate user registration into your system.

Getting Started

Before you begin integrating the API, ensure you have the necessary tools and information. This section outlines the prerequisites, setup steps, and basic guidelines to get you started.

Prerequisites

  • API Key: A unique API key will be provided to you for authentication (e.g., XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX). Contact our support team if you haven’t received one.
  • HTTP Client: Any HTTP client library (e.g., Axios, fetch) or tool (e.g., Postman) to make requests. Examples in this documentation use Axios.
  • HTTPS Access: The API only accepts requests over secure HTTPS connections.

Base URL

All API requests should be sent to the following base URL:

https://ex.pankek.io

Authentication

Every request to the API requires an API key, which must be included in the request headers:

  • Header Name: api-key
  • Value: Your provided API key (e.g., XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX)

Example header:

{
    "Content-Type": "application/json",
    "api-key": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX"
  }

Request Format

  • Method: Most endpoints use POST, except for /sendVerifyMail, which uses GET.
  • Content Type: All requests must include the Content-Type: application/json header unless specified otherwise.
  • Body: Request data should be sent as JSON in the request body (for POST requests) or as query parameters (for GET requests).

Response Format

Responses are returned in JSON format. A successful response typically includes a result field with "OK" or relevant data. Errors include a result field with an error message or an error object for server-side issues.

Example successful response:

{
    "result": "OK"
  }

Example error response:

{
    "result": "Username is already in use"
  }

Rate Limiting

To ensure fair usage, the API enforces rate limiting:

  • Limit: 100 requests per IP every 15 minutes.
  • Error Response on Limit Exceed:
{
    "message": "Too many requests from this IP, please try again later"
  }

If you anticipate higher traffic, contact us to discuss custom limits.

Setting Up Your Environment

  1. Install Dependencies:

    If you’re using Node.js, install Axios (or your preferred HTTP client):

    npm install axios

    Alternatively, use the built-in fetch API in modern browsers or Node.js 18+.

  2. Store Your API Key Securely:

    Avoid hardcoding your API key in your source code. Use environment variables instead:

    • Create a .env file in your project root:
    • API_KEY=XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX
    • Load it in your Node.js application (e.g., with dotenv):
    • require('dotenv').config();
        const apiKey = process.env.API_KEY;
  3. Test Your Connection:

    Make a simple request to verify your setup. For example, using Axios:

    const axios = require('axios');
      
      axios.get('https://ex.pankek.io/sendVerifyMail', {
        headers: {
          'api-key': process.env.API_KEY
        },
        params: { email: '', userId: '', database: '' } // Invalid request to test error handling
      })
      .then(response => console.log('Response:', response.data))
      .catch(error => console.error('Error:', error.response?.data || error.message));

    Expected output (since parameters are missing):

    {
        "result": "not found"
      }

Best Practices

  • Error Handling: Always implement try-catch or .catch() blocks to handle network or server errors gracefully.
  • Logging: Log API responses during development to troubleshoot issues effectively.
  • Security: Do not expose your API key in client-side code if possible. Use server-side proxies for public-facing applications (e.g., Next.js API Routes).

Next Steps

Once you’ve set up your environment and tested your connection, proceed to the following sections: