Rotten Legacy Developer Api

Rotten Legacy API Documentation

Build applications that interact with the Rotten Legacy ecosystem. Our comprehensive API allows you to access game data, integrate with the RTN Network, and create tools for players.

API Version: v0.0.1
All Systems Operational
0 SDKs Available

Getting Started

The Rotten Legacy API provides developers with access to game data, player information, and blockchain functionality. This documentation will help you integrate your applications with the Rotten Legacy ecosystem.

Base URL

All API endpoints are accessible through the following base URL:

Base URL
https://api.rotten.test/v1

Request Format

The API accepts request data in JSON format for POST, PUT, and PATCH requests. Include the following header in all requests:

Headers
{
  "Content-Type": "application/json",
  "Accept": "application/json",
  "Authorization": "Bearer YOUR_API_KEY"
}

Response Format

All responses are returned in JSON format. Successful responses include a data object containing the requested information. Error responses include an error object with details about what went wrong.

Success Response
Error Response
Success Response
{
  "status": "success",
  "data": {
    "id": "p123456",
    "username": "WastelandWarrior",
    "level": 42,
    "faction": "the-dawn",
    "created_at": "2025-01-15T08:23:42Z",
    "last_active": "2025-05-06T10:17:22Z"
  }
}
Error Response
{
  "status": "error",
  "error": {
    "code": "auth_required",
    "message": "Authentication is required to access this resource",
    "status": 401
  }
}
Note

All timestamps are returned in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ) and are in UTC timezone.

Authentication

The Rotten Dawn API uses API keys to authenticate requests. You can obtain an API key from your Developer Dashboard.

API Keys

Authentication is performed by including your API key in the Authorization header of each request. API keys are bound to specific permissions and rate limits based on your developer tier.

Authentication Header
Authorization: Bearer YOUR_API_KEY
Warning

Keep your API keys secure and do not share them publicly. If you believe your key has been compromised, you should revoke it immediately from your Developer Dashboard and generate a new one.

OAuth 2.0 Authentication

For applications that need to access user data, we provide OAuth 2.0 authentication. This allows users to grant your application permission to access their data without sharing their credentials.

The OAuth flow consists of the following steps:

  1. Redirect the user to the Rotten Dawn authorization page
  2. User grants permission to your application
  3. Rotten Dawn redirects back to your application with an authorization code
  4. Exchange the authorization code for an access token
  5. Use the access token to make API requests on behalf of the user

OAuth Endpoints

GET /oauth/authorize

Redirects the user to the Rotten Dawn authorization page.

Query Parameters

Parameter Type Required Description
client_id string Yes Your application's client ID
redirect_uri string Yes URL to redirect to after authorization
scope string Yes Space-separated list of permissions
response_type string Yes Must be set to "code"
state string No Random string to prevent CSRF attacks
POST /oauth/token

Exchanges an authorization code for an access token.

Request Body

Parameter Type Required Description
client_id string Yes Your application's client ID
client_secret string Yes Your application's client secret
code string Yes The authorization code received from the /authorize endpoint
redirect_uri string Yes Must match the redirect_uri used in the /authorize request
grant_type string Yes Must be set to "authorization_code"

Response

Response
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "scope": "read:profile write:inventory"
}

Player API

The Player API allows you to access and manage player information, including profiles, inventory, and statistics.

Player Profile

Retrieve player profile data, including basic information, faction affiliation, and current status.

GET /players/{player_id}

Retrieves detailed information about a specific player.

Path Parameters

Parameter Type Required Description
player_id string Yes Unique identifier for the player

Response

Response
{
  "status": "success",
  "data": {
    "id": "p123456",
    "username": "WastelandWarrior",
    "profile": {
      "avatar_url": "https://assets.rotten.test/avatars/p123456.png",
      "level": 42,
      "experience": 78945,
      "faction": {
        "id": "the-dawn",
        "name": "The Dawn",
        "rank": "Trusted"
      },
      "created_at": "2025-01-15T08:23:42Z",
      "last_active": "2025-05-06T10:17:22Z",
      "location": {
        "region": "abandoned-city",
        "coordinates": [145.23, -78.91],
        "safe_zone": false
      }
    },
    "status": {
      "online": true,
      "health": 87,
      "radiation": 12,
      "hunger": 65,
      "thirst": 72
    }
  }
}
PUT /players/{player_id}/profile

Updates a player's profile information. Requires OAuth authentication with the write:profile scope.

Path Parameters

Parameter Type Required Description
player_id string Yes Unique identifier for the player

Request Body

Request Body
{
  "avatar_url": "https://assets.rotten.test/avatars/custom/p123456.png",
  "settings": {
    "notifications": {
      "email": true,
      "push": false,
      "in_game": true
    },
    "privacy": {
      "show_online_status": true,
      "share_inventory": false,
      "share_location": true
    }
  }
}

Code Samples

Here are some examples of how to use the Rotten Dawn API with different programming languages:

JavaScript
Python
cURL
JavaScript Example
// Fetching Player Profile with JavaScript
const fetchPlayerProfile = async (playerId) => {
  try {
    const response = await fetch(`https://api.rotten.test/v1/players/${playerId}`, {
      method: 'GET',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    });

    if (!response.ok) {
      throw new Error(`API Error: ${response.status}`);
    }

    const data = await response.json();
    console.log('Player Profile:', data);
    return data;
  } catch (error) {
    console.error('Error fetching player profile:', error);
    throw error;
  }
};

// Example usage
fetchPlayerProfile('p123456')
  .then(profile => {
    // Handle the player profile data
    updateUIWithPlayerData(profile.data);
  })
  .catch(error => {
    // Handle errors
    showErrorMessage(error.message);
  });
Python Example
# Fetching Player Profile with Python
import requests

def fetch_player_profile(player_id, api_key):
    """Fetch a player's profile from the Rotten Dawn API"""
    url = f"https://api.rotten.test/v1/players/{player_id}"

    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {api_key}"
    }

    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()  # Raise an exception for 4XX/5XX status codes

        data = response.json()
        print(f"Successfully fetched profile for player {player_id}")
        return data
    except requests.exceptions.HTTPError as http_err:
        print(f"HTTP Error: {http_err}")
        return None
    except requests.exceptions.RequestException as err:
        print(f"Request Error: {err}")
        return None

# Example usage
if __name__ == "__main__":
    API_KEY = "YOUR_API_KEY"
    player_profile = fetch_player_profile("p123456", API_KEY)

    if player_profile and player_profile.get("status") == "success":
        # Process player data
        player_data = player_profile["data"]
        print(f"Player: {player_data['username']}, Level: {player_data['profile']['level']}")
    else:
        print("Failed to retrieve player profile")
cURL Example
# Fetching Player Profile with cURL
curl -X GET "https://api.rotten.test/v1/players/p123456" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Updating Player Profile with cURL
curl -X PUT "https://api.rotten.test/v1/players/p123456/profile" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "avatar_url": "https://assets.rotten.test/avatars/custom/p123456.png",
    "settings": {
      "notifications": {
        "email": true,
        "push": false,
        "in_game": true
      },
      "privacy": {
        "show_online_status": true,
        "share_inventory": false,
        "share_location": true
      }
    }
  }'

SDKs & Libraries

To simplify integration with the Rotten Dawn API, we provide official SDKs for popular programming languages and platforms. These SDKs handle authentication, requests, and response parsing, allowing you to focus on building your application.

JavaScript SDK

Official JavaScript SDK for browser and Node.js applications. Includes TypeScript support and full API coverage.

v1.3.0
MIT License

Python SDK

Official Python SDK with synchronous and asynchronous API support. Compatible with Python 3.7+.

v1.2.5
MIT License

Java SDK

Official Java SDK for Android and server applications. Built with Java 11 and supports Kotlin.

v1.1.8
Apache 2.0

PHP SDK

Official PHP SDK for web applications. Compatible with PHP 7.4+ and provides PSR-18 HTTP client support.

v1.0.3
MIT License

Unity SDK

Official Unity SDK for game development. Provides seamless integration with Unity projects and supports WebGL, mobile, and desktop platforms.

v0.9.2 (Beta)
MIT License

Ready to Build with Rotten Dawn?

Create a developer account to get your API keys and start building applications that integrate with the Rotten Dawn ecosystem.

API Features

Build innovative applications with our comprehensive set of APIs and integration tools.

Player Data

Access player profiles, inventory data, statistics, and activity information to create personalized experiences for Rotten Dawn players.

Marketplace Integration

Connect with the Rotten Dawn marketplace to build trading applications, price trackers, and inventory management tools.

Blockchain Access

Interact with the RTN Network blockchain to create wallet applications, NFT viewers, and token management tools.

World Data

Access location data, faction territories, and world events to build interactive maps and community planning tools.

Analytics

Retrieve game statistics and economic data to create dashboards, visualizations, and trend analysis tools.

Webhooks

Receive real-time notifications for in-game events, marketplace transactions, and player activities.