The Bitcoiner Test API Docs
This API allows developers to integrate Bitcoiner Test questions and test submissions into their applications. The API requires authentication using API keys.
Authentication
- API Key: All requests require an API key, passed in the request headers.
- API Key Format:
- Standard Package:
P1<unique_key>
orP1<unique_key>TEST
(for test mode). - Premium Package:
P2<unique_key>
orP2<unique_key>TEST
(for test mode).
- Standard Package:
Ensure you’re using the appropriate API key for live or test mode, depending on your package.
1. Questions Endpoint
URL:
/wp-json/bitcoiner-api/v1/questions
Method:GET
Description: Fetches a set of randomized test questions based on the specified category.Request Headers
api-key
: Your unique API key (required).
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
category |
string | Yes | The category of questions to retrieve. Acceptable values: technical , non-technical . |
Example Request
import requests url = "https://bitcoinertest.org/wp-json/bitcoiner-api/v1/questions" headers = { "api-key": "P1yourapikey" } params = { "category": "technical" } response = requests.get(url, headers=headers, params=params) if response.status_code == 200: print("Questions received:", response.json()) else: print(f"Error: {response.status_code}, {response.json()}")
fetch("https://bitcoinertest.org/wp-json/bitcoiner-api/v1/questions", { method: "GET", headers: { "api-key": "P1yourapikey" } }) .then(response => { if (response.ok) { return response.json(); } else { throw new Error(`Error: ${response.status}`); } }) .then(data => console.log("Questions received:", data)) .catch(error => console.error(error));
import java.net.HttpURLConnection; import java.net.URL; public class ApiRequest { public static void main(String[] args) throws Exception { URL url = new URL("https://bitcoinertest.org/wp-json/bitcoiner-api/v1/questions"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("api-key", "P1yourapikey"); int code = conn.getResponseCode(); System.out.println("Response Code: " + code); if (code == 200) { // Handle the response (read from the input stream) } } }
require 'net/http' require 'json' url = URI("https://bitcoinertest.org/wp-json/bitcoiner-api/v1/questions") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["api-key"] = "P1yourapikey" response = http.request(request) puts "Response #{response.code} #{response.message}: #{response.body}" if response.is_a?(Net::HTTPSuccess)
<?php $api_key = "P1yourapikey"; $url = "https://bitcoinertest.org/wp-json/bitcoiner-api/v1/questions"; $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n" . "api-key: $api_key\r\n", 'method' => 'GET' ) ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); if ($result === FALSE) { echo "Error retrieving questions."; } echo "Response: " . $result; ?>
Success Response (200 OK)
{
"test_session_token": "session_abc12345",
"questions": [
{
"id": "test-1",
"question": "What is a Bitcoin block?",
"options": ["a. A unit of data", "b. A wallet", "c. A mining device"]
},
{
"id": "test-2",
"question": "What does POW stand for?",
"options": ["a. Proof of Work", "b. Power of Wallet", "c. Protocol of Wealth"]
}
]
}
Error Responses
Status Code | Message |
---|---|
400 | Invalid category. Use “technical” or “non-technical”. |
403 | Invalid or Inactive API key. |
429 | Rate limit exceeded. Please try again later. |
500 | Question bank not found or server error. |
2. Submit Endpoint
URL: /wp-json/bitcoiner-api/v1/submit
Method: POST
Description: Submits answers to the test questions and returns the result.
Request Headers
api-key
: Your unique API key (required).
Request Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
test_session_token |
string | Yes | Unique token received from the Questions endpoint. |
name |
string | Yes | Full name of the test taker. |
email |
string | Yes | Email address of the test taker. |
country |
string | Yes | Country of the test taker. |
answers |
dict | Yes | An object mapping question IDs to selected option labels. |
Example Request
import requests url = "https://bitcoinertest.org/wp-json/bitcoiner-api/v1/submit" headers = { "api-key": "P1yourapikey", "Content-Type": "application/json" } data = { "test_session_token": "session_abc12345", "name": "John Doe", "email": "john@example.com", "country": "Nigeria", "answers": { "test-1": "a", "test-2": "b" } } response = requests.post(url, json=data, headers=headers) if response.status_code == 200: print("Submission successful:", response.json()) else: print(f"Error: {response.status_code}, {response.json()}")
fetch("https://bitcoinertest.org/wp-json/bitcoiner-api/v1/submit", { method: "POST", headers: { "api-key": "P1yourapikey", "Content-Type": "application/json" }, body: JSON.stringify({ test_session_token: "session_abc12345", name: "John Doe", email: "john@example.com", country: "Nigeria", answers: { "test-1": "a", "test-2": "b" } }) }) .then(response => { if (response.ok) { return response.json(); } else { throw new Error(`Error: ${response.status}`); } }) .then(data => console.log("Submission successful:", data)) .catch(error => console.error(error));
import java.net.HttpURLConnection; import java.net.URL; import java.io.OutputStream; public class ApiRequest { public static void main(String[] args) throws Exception { URL url = new URL("https://bitcoinertest.org/wp-json/bitcoiner-api/v1/submit"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("api-key", "P1yourapikey"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonInputString = "{ \"test_session_token\": \"session_abc12345\", \"name\": \"John Doe\", \"email\": \"john@example.com\", \"country\": \"Nigeria\", \"answers\": {\"test-1\": \"a\", \"test-2\": \"b\"}}"; try(OutputStream os = conn.getOutputStream()) { byte[] input = jsonInputString.getBytes("utf-8"); os.write(input, 0, input.length); } int code = conn.getResponseCode(); System.out.println("Response Code: " + code); } }
require 'net/http' require 'json' url = URI("https://bitcoinertest.org/wp-json/bitcoiner-api/v1/submit") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["api-key"] = "P1yourapikey" request["Content-Type"] = "application/json" request.body = { test_session_token: "session_abc12345", name: "John Doe", email: "john@example.com", country: "Nigeria", answers: { "test-1" => "a", "test-2" => "b" } }.to_json response = http.request(request) puts "Response #{response.code} #{response.message}: #{response.body}"
<?php $api_key = "P1yourapikey"; $url = "https://bitcoinertest.org/wp-json/bitcoiner-api/v1/submit"; $data = array( "test_session_token" => "session_abc12345", "name" => "John Doe", "email" => "john@example.com", "country" => "Nigeria", "answers" => array( "test-1" => "a", "test-2" => "b" ) ); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n" . "api-key: $api_key\r\n", 'method' => 'POST', 'content' => json_encode($data), ), ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); if ($result === FALSE) { echo "Error submitting request."; } echo "Response: " . $result; ?>
Error Responses
Status Code | Message |
---|---|
400 | Missing required fields or invalid answers. |
403 | Invalid or Inactive API key. |
500 | Server error or invalid test session token. |
Rate Limiting and Quota
The API enforces rate limits to prevent overuse and abuse. Each API key has a maximum number of allowed requests per month, based on the user’s subscription plan.
Quota
- Standard Package (P1): 60 requests per month.
- Premium Package (P2): 100 requests per month.
Rate Limit
Requests are limited to 3 per minute. If the limit is exceeded, a 429 status code is returned.
Example Error Response
{
"status": 429,
"message": "Rate limit exceeded. Please try again later."
}
Example API Key Usage
This documentation provides an overview of the available API endpoints, including sample requests in Python, JavaScript, Java, Ruby and PHP. Ensure to replace placeholder values with actual API keys and data before making any requests.