Welcome! You have reached the FreeFaucet.io Webfaucet API.

Below is a detailed guide on how to get a web faucet and set it up on your website using the FreeFaucet.io Webfaucet API!



Creating a faucet

To create a new Webfaucet for your website, go to the webfaucet creation page.

You must provide the following details for your faucet, in the faucet creation page.

When you are ready to create your faucet, push the Create button




Setting up the API

After you have created your faucet, you will be redirected to the my faucets page. On this page you will find your API_KEY and a list of FAUCET_KEYs. Your website will use these keys to make requests to the Freefaucet.io Webfaucet API, to reward users who perform the faucet task correctly.

Your API Key

Your API_KEY is a secret key. Do not show it to anyone.

Your API key is used to authenticate requests made by your webserver to the FreeFaucet API, when it detects a user performing the desired action.

Your Faucet Key

Your FAUCET_KEY is a secret key. Do not show it to anyone.

Your Faucet key is used to identify which faucet should reward the user for performing the desired action.

The User Token

FreeFaucet.io users will find your faucet on the my faucets page.

When the user clicks on your faucet, they will be redirected to the web page you specified when you created the webfaucet. Then they will attempt to perform the faucet task. The link to your website from the faucets page will include two GET parameters ref and t. Like this:

https://example-website.com/faucet?ref=ffio&t=SOME_USER_TOKEN

Your webserver will send this t value in the reward request to the FreeFaucet API, when the user has performed the faucet task.




Rewarding the user

When the user completes the desired task on your website, they should be rewarded as promised. Your webserver will reward the user by sending the reward request to the FreeFaucet.io API. See the details below

Code examples at the bottom of this guide
Reward API Call
Method: Request Type: Endpoint:
Reward POST https://api.freefaucet.io/reward/index.php
Parameters
t api_key faucet_key
The user's authentication token Your API_KEY Your FAUCET_KEY
Example Successful Response:
{ "success":"1", "reward":"0.32309389", "coin":"brazio", "time":"1559030311", "errors":"", "mode":"test" }
Example Error Response:
{ "success":"0", "reward":"0", "time":"1559030311", "errors":"ALREADY CLAIMED", "mode":"test" }

Errors

Here are the possible errors returned by the API

Code Examples

PHP

The script below triggers the faucet reward. You can either use this code in the page that the user lands on with require and reward them immediately, or run it when they complete the faucet task.




<?php
  
// prevent XSS
  
$_GET   filter_input_array(INPUT_GETFILTER_SANITIZE_STRING);

  
//Add your API_KEY and FAUCET_KEY to these variables
  
$API_KEY "YOUR API KEY";
  
$FAUCET_KEY "YOUR FAUCET KEY";

  
//Retrieve User token from URL parameter
  
$t $_GET["t"];

  
//Build the request URL
  
$curl curl_init();
  
curl_setopt($curlCURLOPT_URL,"https://api.freefaucet.io/reward/index.php");
  
curl_setopt($curlCURLOPT_POST1);
  
curl_setopt($curlCURLOPT_FOLLOWLOCATIONtrue);
  
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  
curl_setopt($curlCURLOPT_POSTFIELDS,
              
"t=".$t."&API_KEY=".$API_KEY."&FAUCET_KEY=".$FAUCET_KEY);

  
$result curl_exec($curl);
  
curl_close($curl);

  
//decode response object
  
$result_obj json_decode($result);

  if(
$result_obj->success === 1)
  {
    
$message "Faucet Claim Successful! You were rewarded " $result_obj->reward " " $result_obj->coin;
  }
  else
  {
    
$message "Error: Your claim was unsuccessful. Reason: " $result_obj->errors;
  }

  
//Print message to the screen
  
echo $message;