API Documentation

Integrate ServerBay Images into your applications, Discord bots, or websites.

Base URL

https://img.serverbay.org/api

Authentication

All API endpoints (except status) require an API key. Include your key in the request header:

x-api-key: YOUR_API_KEY

Get your API key from the Dashboard

Upload Image

POST /api/upload

Upload an image file using multipart form data.

Request

curl -X POST https://img.serverbay.org/api/upload \
  -H "x-api-key: YOUR_API_KEY" \
  -F "image=@image.png"

Response

{
  "success": true,
  "data": {
    "id": "abc123def456",
    "url": "https://img.serverbay.org/abc123def456.png",
    "delete_key": "a1b2c3d4",
    "filename": "image.png",
    "size": 1024,
    "mime_type": "image/png",
    "created_at": "2024-01-01T00:00:00.000Z"
  }
}

Upload from URL

POST /api/upload/url

Download and upload an image from a URL.

Request

curl -X POST https://img.serverbay.org/api/upload/url \
  -H "x-api-key: YOUR_API_KEY" \
  -d "url=https://example.com/image.png"

Response

{
  "success": true,
  "data": {
    "id": "abc123def456",
    "url": "https://img.serverbay.org/abc123def456.png",
    "delete_key": "a1b2c3d4",
    "size": 1024,
    "created_at": "2024-01-01T00:00:00.000Z"
  }
}

Get Image Info

GET /api/image/:id

Get information about an uploaded image.

Response

{
  "success": true,
  "data": {
    "id": "abc123def456",
    "url": "https://img.serverbay.org/abc123def456.png",
    "filename": "image.png",
    "size": 1024,
    "mime_type": "image/png",
    "views": 42,
    "created_at": "2024-01-01T00:00:00.000Z"
  }
}

Delete Image

DELETE /api/image/:id

Delete an image you own.

Response

{
  "success": true,
  "message": "Image deleted"
}

List Your Images

GET /api/images

List all images uploaded with your API key.

Query Parameters

  • page - Page number (default: 1)
  • limit - Items per page (default: 25)

Rate Limits

Each API key has a default rate limit of 100 requests per day. Contact support if you need higher limits.

API Status

GET /api/status

Check API status and available features. No authentication required.

Response

{
  "status": "ok",
  "version": "1.0.0",
  "timestamp": "2024-01-01T00:00:00.000Z",
  "features": {
    "nsfw_filter": false,
    "temp_uploads": true,
    "url_upload": true
  }
}

Get API Key Info

GET /api/key

Get information about your API key including rate limit and usage.

Response

{
  "success": true,
  "data": {
    "name": "My API Key",
    "rate_limit": 100,
    "requests_today": 42,
    "created_at": "2024-01-01T00:00:00.000Z"
  }
}

API Login

POST /api/login

Authenticate with email and password to get an API token. The token can be used as an API key.

Request

curl -X POST https://img.serverbay.org/api/login \
  -H "Content-Type: application/json" \
  -d '{"email": "user@example.com", "password": "yourpassword"}'

Response

{
  "success": true,
  "data": {
    "token": "abcdef1234567890",
    "user": {
      "id": 1,
      "username": "exampleuser",
      "email": "user@example.com"
    }
  }
}

API Logout

POST /api/logout

Invalidate your API token (from login).

Request

curl -X POST https://img.serverbay.org/api/logout \
  -H "x-api-key: YOUR_TOKEN"

Response

{
  "success": true,
  "message": "Logged out successfully"
}