Javascript Library

Attached below examples and tutorial on how to get started with Ever XP Javascript library.

Getting Started


Include the Library

Add this script before the closing </body> tag:

<script src="https://api.everxp.com/assets/js/everxp-v1.0.js"></script>
                
API Key

To use the EverXP v2 API, obtain your API Key from the EverXP Dashboard. Use the Authorization: Bearer header for authentication.

Parameters
Key Type Optional Explaination
api_key Authorization: Bearer Required
folder Number Required Add new folders here My Bank
lang Text Required Languages list
style Number Optional Writing Styles list
voice Number Optional Writing Voices list
min_l Number Optional Minimum number of characters 
max_l Number Optional Maximum number of characters 
div Text Optional Returns result as text inside div id otherwise returned as json response
user_identifier Text Optional Any kind of parameter to identify your customer (IP, User ID, Email, Username, or First and Last name) Example: [email protected].
Example Usage
const params = {
    lang: 'en',
    style: 1,
    min_l: 100,
    max_l: 200,
};

xp_v2_request('quotes', params, 'YOUR_BEARER_TOKEN')
    .then((response) => {
        console.log('API Response:', response);
        if (response.div) {
            document.getElementById(response.div).innerHTML = response.heading;
        }
    })
    .catch((error) => {
        console.error('API Error:', error.message);
    });
                
Error Handling

All API errors are returned as JSON objects. Use the .catch() method to handle errors gracefully.

xp_v2_request('quotes', params, 'YOUR_BEARER_TOKEN')
    .then((response) => {
        console.log('API Response:', response);
    })
    .catch((error) => {
        if (error.response && error.response.status === 401) {
            console.error('Unauthorized: Check your API Key.');
        } else {
            console.error('An error occurred:', error.message);
        }
    });
                

Facing an error? Error codes list