TP | API

Toxicity Protection API

Our API allows you to create calls to our endpoints and in return get data on users, bans or get all bans, the possibilities are endless. The API is currently small and in beta but we do have plans to expand in the near future and add endpoints our fellow developers want to see.


API endpoint

All API calls start with our domain - https://toxicityprotection.com/api/v1


Get User

To fetch a user you call the following endpoint using a GET request

URL: /getuser/USER_ID 
Type: GET 
Response: Object
In Practice (Javascript using Fetch)
fetch('https://toxicityprotection.com/api/v1/getuser/389558396195438593').then((res) => res.json()).then((data) => {
    console.log(data)
}).catch((e) => {
    return console.log('User does not exist.')
})

Example URL: https://toxicityprotection.com/api/v1/getuser/389558396195438593


Get Reason

To get a ban reason for a specific User ID or Ban ID you can call the following endpoint using a GET request

URL: /getreason/USER_ID|BAN_ID
Type: GET 
Response: Object
In Practice (Javascript using Fetch)
// User ID
fetch('https://toxicityprotection.com/api/v1/getreason/389558396195438593').then((res) => res.json()).then((data) => {
    console.log(data)
}).catch((e) => {
    return console.log('User is not banned')
});
            
// Ban ID
fetch('https://toxicityprotection.com/api/v1/getreason/351').then((res) => res.json()).then((data) => {
    console.log(data)
}).catch((e) => {
    return console.log('Ban ID dosent exist')
});

Example URL: https://toxicityprotection.com/api/v1/getreason/389558396195438593


Is Banned?

To check if a user is banned in the TP database you can call the following endpoint using a GET request

URL: /isbanned/USER_ID
Type: GET 
Response: Object
In Practice (Javascript using Fetch)
fetch('https://toxicityprotection.com/api/v1/isbanned/389558396195438593').then((res) => res.json()).then((data) => {
    console.log(data)
}).catch((e) => {
    return console.log('Internal API errorw')
});

Example URL: https://toxicityprotection.com/api/v1/isbanned/389558396195438593


Get All Bans

To fetch all bans in the TP database you can call the following endpoint using a GET request

URL: /fetchbans
    Type: GET 
    Response: Object
In Practice (Javascript using Fetch)
fetch('https://toxicityprotection.com/api/v1/fetchbans').then((res) => res.json()).then((data) => {
    console.log(data)
}).catch((e) => {
    return console.log('Internal API error')
});
            

Example URL: https://toxicityprotection.com/api/v1/fetchbans


Get All Staff Users

To fetch all staff on our website you can call this endpoint using a GET request

URL: /fetchteam
Type: GET 
Response: Object
In Practice (Javascript using Fetch)
fetch('https://toxicityprotection.com/api/v1/fetchteam').then((res) => res.json()).then((data) => {
    console.log(data)
}).catch((e) => {
    return console.log('Internal API error')
});
                

Example URL: https://toxicityprotection.com/api/v1/fetchteam


We are always looking to improve, any ideas can be submitted to our Discord