API Documentation

BerryPvP API

Build powerful integrations with the BerryPvP gaming network. Access staff data, news, player stats, and more.

Why Use Our API?

Fast & Reliable

Built on Supabase for blazing fast database operations with 99.9% uptime.

Secure

Protected endpoints with token authentication and row-level security.

Easy Integration

Simple REST API with predictable JSON responses. Works with any language.

All Endpoints

Here's a quick overview of all available API endpoints.

Method Endpoint Description
GET / API Documentation
GET /health Health check
GET /api/staff Get all staff members
GET /api/news Get all news articles
GET /api/stats Get player stats
GET /api/leaderboards Get leaderboards
POST /api/stats Submit player stats

Staff API

Get information about BerryPvP staff members.

GET /api/staff

Retrieve all staff members with their ranks. No authentication required.

Example Request

fetch('https://api.berrypvp.net/api/staff')
  .then(res => res.json())
  .then(data => console.log(data));

Response

[
  {
    "id": 1,
    "uuid": "d8d5a923-7b20-43d8-883b-1150148d6955",
    "rank": "owner",
    "created_at": "2024-01-15T10:30:00.000Z"
  },
  {
    "id": 2,
    "uuid": "069a79f4-44e9-4726-a5be-fca90e38aaf5",
    "rank": "manager",
    "created_at": "2024-01-16T14:20:00.000Z"
  }
]

News API

Access news articles from BerryPvP.

GET /api/news

Retrieve all news articles, sorted by date (newest first). No authentication required.

Response

[
  {
    "id": 1,
    "title": "Season 3 Launch!",
    "date": "April 5, 2026",
    "preview": "Get ready for the biggest season yet...",
    "content": "Full article content here...",
    "gradient": "from-primary/30 to-accent/20",
    "image": null,
    "created_at": "2024-04-05T12:00:00.000Z"
  }
]

Stats API

Submit player statistics from game servers.

POST /api/stats

Submit player statistics. Requires an API secret key in the header.

Headers

x-api-secret: YOUR_API_SECRET_KEY

Request Body

{
  "uuid": "player-uuid",
  "kills": 150,
  "deaths": 45,
  "wins": 30,
  "playtime": 3600
}

Response

{
  "success": true,
  "message": "Stats received",
  "timestamp": "2024-04-05T12:00:00.000Z"
}

Error Codes

Common errors you might encounter when using the API.

401 Unauthorized

Missing or invalid authentication token.

500 Internal Server Error

Server error. Check the response message for details.

PGRST116 Table Not Found

The requested table does not exist in the database.

404 Not Found

The requested endpoint does not exist.