Thanks to our amazing Patreon supporters we are almost to our monthly goal!
If you have not already become a patron then please consider donating to BreakBlocks.com to help keep the project and community growing strong! πͺ
The BreakBlocks API supports two authentication methods: session-based authentication for web applications and API key authentication for server-to-server communication.
When you log into BreakBlocks.com, your browser automatically receives a session cookie. This cookie is used to authenticate your requests.
// JavaScript with Fetch API
fetch('https://api.breakblocks.com/api/v0.1/servers/find?limit=10', {
method: 'GET',
credentials: 'include' // Include session cookies
})
.then(response => response.json())
.then(data => console.log(data));API keys are for server-to-server authentication. Create and manage your keys from your user dashboard.
// Using cURL with API Key curl -X GET "https://api.breakblocks.com/api/v0.1/servers/find?limit=10" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json"
To create an API key:
| Endpoint Type | Authentication Required | Examples |
|---|---|---|
| Public | No | /servers/find, /status/ping, /metadata/* |
| Protected | Yes | /user/apikeys |
401 Unauthorized: Missing or invalid authentication credentials
{
"success": false,
"message": "Unauthorized: Invalid API key or session"
}403 Forbidden: Authenticated but lacking required permissions
{
"success": false,
"message": "Forbidden: You don't have permission to access this resource"
}// JavaScript with Axios
const axios = require('axios');
const apiKey = process.env.BREAKBLOCKS_API_KEY;
const response = await axios.get(
'https://api.breakblocks.com/api/v0.1/servers/find?limit=10',
{
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
}
);
console.log(response.data);