Centurygame APIkingshot-giftcode.centurygame.com ↗
Redeem King's Shot gift codes, look up players by ID, and fetch gift code center config via 3 dedicated endpoints. JSON responses with reward data and error codes.
What is the Centurygame API?
The King's Shot Gift Code API exposes 3 endpoints for interacting with the Kingshot mobile game redemption center at kingshot-giftcode.centurygame.com. Use get_player to verify a player exists by their in-game numeric ID, redeem_code to submit a gift code and receive reward item data in return, and get_gift_code_config to retrieve promotional banner URLs for each supported language. All responses include a code field and an err_code for precise error handling.
curl -X POST 'https://api.parse.bot/scraper/ea8ff0bc-09f9-419a-a710-2374107ef49c/get_player' \
-H 'X-API-Key: $PARSE_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"fid": "12345"
}'Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace kingshot-giftcode-centurygame-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""
King's Shot Gift Code API Client
Provides a client for interacting with the King's Shot mobile game gift code
redemption center API. Supports player lookup, gift code redemption, and
configuration retrieval.
Get your API key from: https://parse.bot/settings
"""
import os
import sys
from typing import Any, Dict, Optional
import requests
class ParseClient:
"""Client for King's Shot Gift Code API."""
def __init__(self, api_key: Optional[str] = None):
"""
Initialize the Parse API client.
Args:
api_key: API key for authentication. If not provided, reads from
PARSE_API_KEY environment variable.
"""
self.base_url = "https://api.parse.bot"
self.scraper_id = "ea8ff0bc-09f9-419a-a710-2374107ef49c"
self.api_key = api_key or os.getenv("PARSE_API_KEY")
if not self.api_key:
raise ValueError(
"API key not provided. Set PARSE_API_KEY env var or pass api_key parameter."
)
def _call(
self, endpoint: str, method: str = "POST", **params
) -> Dict[str, Any]:
"""
Make a request to the Parse API.
Args:
endpoint: The API endpoint name (e.g., 'get_player')
method: HTTP method ('GET' or 'POST')
**params: Query/body parameters for the request
Returns:
Parsed JSON response as dictionary
Raises:
requests.RequestException: If the HTTP request fails
"""
url = f"{self.base_url}/scraper/{self.scraper_id}/{endpoint}"
headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
try:
if method.upper() == "GET":
response = requests.get(url, headers=headers, params=params)
else: # POST
response = requests.post(url, headers=headers, json=params)
response.raise_for_status()
return response.json()
except requests.RequestException as e:
print(f"API request failed: {e}")
raise
def get_player(self, fid: str) -> Dict[str, Any]:
"""
Look up a King's Shot player by their in-game player ID.
Args:
fid: The player's in-game ID (numeric string)
Returns:
API response containing player information or error details
"""
return self._call("get_player", method="POST", fid=fid)
def redeem_code(self, fid: str, code: str) -> Dict[str, Any]:
"""
Redeem a gift code for a King's Shot player.
Args:
fid: The player's in-game ID
code: The gift code to redeem (case-sensitive)
Returns:
API response containing redemption result and rewards
"""
return self._call("redeem_code", method="POST", fid=fid, code=code)
def get_gift_code_config(self) -> Dict[str, Any]:
"""
Retrieve the gift code center configuration.
Returns:
API response containing banner URLs for each supported language
"""
return self._call("get_gift_code_config", method="GET")
def main():
"""Practical workflow example for King's Shot Gift Code API."""
# Initialize client
client = ParseClient()
# List of player IDs and gift codes to process
players_and_codes = [
{"player_id": "12345", "codes": ["WELCOME2024", "KINGSHOT100"]},
{"player_id": "67890", "codes": ["CELEBRATE50"]},
{"player_id": "11111", "codes": ["BONUS200", "FREEGEMS"]},
]
print("=" * 60)
print("King's Shot Gift Code Redemption Workflow")
print("=" * 60)
# Step 1: Get gift code configuration
print("\n[Step 1] Fetching gift code center configuration...")
try:
config_response = client.get_gift_code_config()
if config_response.get("data", {}).get("code") == 0:
print("✓ Configuration retrieved successfully")
languages = list(config_response.get("data", {}).get("data", {}).keys())
print(f" Supported languages: {', '.join(languages)}")
else:
print(
f"✗ Failed to get config: {config_response.get('data', {}).get('msg')}"
)
return
except Exception as e:
print(f"✗ Error fetching config: {e}")
return
# Step 2: Verify players and redeem codes
print("\n[Step 2] Processing player gift code redemptions...")
print("-" * 60)
redemption_results = []
for player_info in players_and_codes:
player_id = player_info["player_id"]
codes = player_info["codes"]
print(f"\nPlayer ID: {player_id}")
# Verify player exists
try:
player_response = client.get_player(player_id)
if player_response.get("data", {}).get("code") == 0:
print(" ✓ Player found")
player_data = player_response.get("data", {}).get("data")
if isinstance(player_data, dict):
print(f" Player details: {player_data}")
else:
print(
f" ✗ Player not found: {player_response.get('data', {}).get('msg')}"
)
continue
except Exception as e:
print(f" ✗ Error looking up player: {e}")
continue
# Redeem each code for this player
for code in codes:
print(f" Redeeming code: {code}")
try:
redeem_response = client.redeem_code(player_id, code)
response_data = redeem_response.get("data", {})
if response_data.get("code") == 0:
rewards = response_data.get("data", [])
print(" ✓ Redeemed successfully")
if rewards:
print(f" Rewards: {rewards}")
redemption_results.append(
{
"player_id": player_id,
"code": code,
"status": "success",
"rewards": rewards,
}
)
else:
error_msg = response_data.get("msg")
error_code = response_data.get("err_code")
print(f" ✗ Redemption failed: {error_msg} (code: {error_code})")
redemption_results.append(
{
"player_id": player_id,
"code": code,
"status": "failed",
"error": error_msg,
}
)
except Exception as e:
print(f" ✗ Error redeeming code: {e}")
redemption_results.append(
{
"player_id": player_id,
"code": code,
"status": "error",
"error": str(e),
}
)
# Step 3: Summary
print("\n" + "=" * 60)
print("Redemption Summary")
print("=" * 60)
successful = sum(1 for r in redemption_results if r.get("status") == "success")
failed = sum(1 for r in redemption_results if r.get("status") == "failed")
errors = sum(1 for r in redemption_results if r.get("status") == "error")
print(f"Total attempts: {len(redemption_results)}")
print(f"Successful: {successful}")
print(f"Failed: {failed}")
print(f"Errors: {errors}")
if successful > 0:
print("\n✓ Successfully redeemed codes:")
for r in redemption_results:
if r.get("status") == "success":
print(f" - Player {r['player_id']}: {r['code']}")
if failed > 0:
print("\n✗ Failed redemptions:")
for r in redemption_results:
if r.get("status") == "failed":
print(f" - Player {r['player_id']}: {r['code']} ({r['error']})")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\n\nInterrupted by user")
sys.exit(0)
except Exception as e:
print(f"\nFatal error: {e}")
sys.exit(1)Look up a King's Shot player by their in-game player ID. Returns player information if the ID exists, or an error response (code=1, err_code=40001) if the player is not found. The player ID can be found in-game through the avatar in the top left corner.
| Param | Type | Description |
|---|---|---|
| fidrequired | string | The player's in-game ID (numeric string found via the in-game avatar). |
{
"type": "object",
"fields": {
"msg": "string status message from the API",
"code": "integer indicating success (0) or failure (1)",
"data": "object containing player details when found, or empty array when not found",
"err_code": "integer error code (0 for success, 40001 for player not found)"
},
"sample": {
"data": {
"msg": "role not exist.",
"code": 1,
"data": [],
"err_code": 40001
},
"status": "success"
}
}About the Centurygame API
Player Lookup
The get_player endpoint accepts a single required parameter, fid, which is the numeric player ID visible in-game via the avatar in the top-left corner. A successful response returns code: 0 along with a data object containing player details. If no player matches the supplied fid, the response returns code: 1 and err_code: 40001. This lets you validate player IDs before attempting redemption, reducing wasted requests.
Gift Code Redemption
The redeem_code endpoint takes both fid (player ID) and code (the alphanumeric gift code, case-sensitive). On success, data contains an array of reward items granted to the player. Failure states are communicated through err_code: 40014 signals the gift code was not found or is invalid, while 40001 indicates the player ID does not exist. Codes must be redeemed per-player — there is no batch redemption across multiple fid values in a single request.
Gift Code Center Configuration
The get_gift_code_config endpoint requires no parameters and returns a data object keyed by language code. Each language entry contains pc_banner and mob_banner URL strings pointing to the promotional imagery for that locale. This is useful for building localized redemption UIs that mirror the official gift code center's appearance.
The Centurygame API is a managed, monitored endpoint for kingshot-giftcode.centurygame.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when kingshot-giftcode.centurygame.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official kingshot-giftcode.centurygame.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Validate a King's Shot player ID before presenting a gift code redemption form
- Build a self-service redemption tool where players enter their
fidand acodeto claim in-game rewards - Display language-specific promotional banners from
get_gift_code_configin a web or mobile redemption portal - Surface clear error messages to users by mapping
err_codevalues (40001, 40014) to human-readable feedback - Track redemption outcomes by logging
datareward arrays returned from successfulredeem_codecalls - Automate gift code distribution campaigns by iterating over a list of player IDs and submitting codes programmatically
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does King's Shot or Century Games offer an official public developer API for gift code redemption?+
What does `redeem_code` actually return on a successful redemption?+
code: 0, err_code: 0), the data field contains an array of reward items that were granted to the player. On failure, data is an empty array and err_code identifies the reason: 40014 means the gift code was not found or is invalid, and 40001 means the player ID does not exist.Can I look up a player's game stats, inventory, or match history through this API?+
get_player returns for a given fid, scoped to the gift code center context. Game stats, inventory, and match history are not covered. You can fork this API on Parse and revise it to add endpoints targeting other King's Shot data surfaces if they become available.Is there a way to list all currently valid gift codes through this API?+
Are gift codes case-sensitive, and can the same code be redeemed more than once per player?+
code parameter passed to redeem_code is case-sensitive. Attempting to redeem a code that has already been used by the same player, or one that does not exist, returns err_code: 40014. The API response does not distinguish between an already-used code and a completely invalid one — both surface the same error code.