Get Account

POST /api/v1/create-token

Common errors include:

  • "Bad Request" if body parameters are not passed
  • "DNS_CONFIGURATION_ERROR" if custom domain DNS is misconfigured.

You will use this token in your request's Authorization header. Here is an example:

Authorization: Bearer {token}

App Registration

A secure OAuth application registration system that allows users to register their applications by providing an application name, link, and optional description. The system automatically generates a unique client ID for each registered application and ensures all application links are properly formatted with trailing slashes

Request

Method : Post
Content-Type : Application/json

Request Body Schema

registrationId string Required
The unique identifier of the OAuth registration for which the token is being created
email string Required
The email address associated with the token, used in JWT payload
LANGUAGE
REQUEST
  # cURL
    curl -X POST 'https://divsly-backend.vercel.app/api/v1/create-token' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
    -d '{
        "registrationId": "your_registration_id",
        "email": "user@example.com"
    }'
API REQUEST
 // JavaScript Fetch
    const response = await fetch('https://divsly-backend.vercel.app/api/v1/create-token', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    },
    body: JSON.stringify({
        registrationId: 'your_registration_id',
        email: 'user@example.com'
    })
    });
    const data = await response.json();
                    
API REQUEST
 // Node.js Axios
  const axios = require('axios');

  const response = await axios.post('https://divsly-backend.vercel.app/api/v1/create-token', {
    registrationId: 'your_registration_id',
    email: 'user@example.com'
  }, {
    headers: {
	 'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
   }
  });
API REQUEST
 // PHP

    $curl = curl_init();

   curl_setopt_array($curl, [
    CURLOPT_URL => "https://divsly-backend.vercel.app/api/v1/create-token",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => json_encode([
        'registrationId' => 'your_registration_id',
        'email' => 'user@example.com'
    ]),
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOUR_ACCESS_TOKEN",
        "Content-Type: application/json"
    ],
    ]);

    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);

API REQUEST
 # Python (using requests)
    import requests
    import json

    url = "https://divsly-backend.vercel.app/api/v1/create-token"
    headers = {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    }
    payload = {
        'registrationId': 'your_registration_id',
        'email': 'user@example.com'
    }

    response = requests.post(url, headers=headers, json=payload)
    data = response.json()

RESPONSE
  {"message":"Token created 
            successfully","token":{"id":"cm8zhznm800018m9a95xuia68","accessToken":"oauth
        2_7n-noZ1mY","expiresAt":"2026-04-02T05:40:01.995Z"}}

        
 {
	"message": "Unauthorized!"
}
        
 {
	"success": false,
	"error": "error message from caught exception"
}
        
  {
    "error": true,
    "data": {
    "message": "Link Limit Exceeded for your current plan.
     Please upgrade!"
    }
}