QUARK Developers
Sign inRegister

Setup guide · Integration reference · Rules

Partner API: integration reference

Your game's server tells QUARK which level a player reached. QUARK pays the rewards you configured, from the QRK you funded. Never call this API from the game client (the app): the signing secret must stay on your server.

1. How it works

  1. Register in this portal, accept the Terms and add your app. After admin approval and the registration fee you get an App ID and a secret.
  2. Buy QRK (USDT deposit) and create a campaign: tiers such as level 5 = 1 QRK, level 10 = 2 QRK, level 15 = 3 QRK and a number of players. Tiers add up: a player who reaches level 15 earns 1 + 2 + 3 = 6 QRK. The whole budget is reserved from your wallet when the campaign starts.
  3. A player opens the QUARK app, goes to Games and taps Link account to get an 8-character code. The player types it in your game; your server confirms it. One QUARK account links to one game account per app.
  4. Your server reports levels. Each new tier is credited as earned and unlocks after the hold (default 24 h). The player then claims it in the QUARK app and the QRK lands in their Available QRK.
  5. When you close the campaign, everything not owed to players returns to your wallet. Rewards already earned stay claimable for the claim window (default 30 days), then the rest returns too.

2. Authentication (HMAC-SHA256)

Every request carries three headers:

HeaderValue
X-Quark-Appyour App ID (24 hex characters)
X-Quark-TimestampUnix time in seconds (within 5 minutes of QUARK's clock)
X-Quark-Signaturelowercase hex of HMAC_SHA256(secret, ts + "." + METHOD + "." + PATH + "." + sha256hex(rawBody))

Test vector (secret qs_TESTSECRET, ts 1760000000), body {"eventId":"evt-0001","playerId":"p1","level":7}, POST /partner/v1/progress: body sha256 a7b64ebfca4787edd2512ee22e8d0a706afdb6417ce95903d5e1360d7012b69a, signature 43a232428f23729c70f4de2ccf91cab4bb7822ccea9b6ea64c8e5a7ecb56e1da.

Node.js

const crypto = require('crypto'); function signedHeaders(appId, secret, method, path, body = '') { const ts = String(Math.floor(Date.now() / 1000)); const bodyHash = crypto.createHash('sha256').update(body).digest('hex'); const sig = crypto.createHmac('sha256', secret).update(`${ts}.${method}.${path}.${bodyHash}`).digest('hex'); return { 'Content-Type': 'application/json', 'X-Quark-App': appId, 'X-Quark-Timestamp': ts, 'X-Quark-Signature': sig }; } const body = JSON.stringify({ eventId: crypto.randomUUID(), playerId: 'player-123', level: 12 }); await fetch('https://quarknetwork-org.onrender.com/partner/v1/progress', { method: 'POST', headers: signedHeaders(APP_ID, SECRET, 'POST', '/partner/v1/progress', body), body });

Python

import hmac, hashlib, time, json, uuid, requests def signed(app_id, secret, method, path, body=b''): ts = str(int(time.time())) s = f"{ts}.{method}.{path}.{hashlib.sha256(body).hexdigest()}" return {'Content-Type': 'application/json', 'X-Quark-App': app_id, 'X-Quark-Timestamp': ts, 'X-Quark-Signature': hmac.new(secret.encode(), s.encode(), hashlib.sha256).hexdigest()} body = json.dumps({'eventId': str(uuid.uuid4()), 'playerId': 'player-123', 'level': 12}).encode() requests.post('https://quarknetwork-org.onrender.com/partner/v1/progress', data=body, headers=signed(APP_ID, SECRET, 'POST', '/partner/v1/progress', body))

3. Endpoints

All POST bodies are JSON and must contain eventId (8 to 80 characters: letters, digits, _ . : -). Repeating an eventId returns the first answer with "replay": true and changes nothing, so it is safe to retry after a timeout. Generate a new eventId for every new event.

POST /partner/v1/links/confirm

{ "code": "ABCD-EFGH", "playerId": "player-123", "level": 12, "eventId": "…" }

The player typed the code in your game. playerId is your stable id for the player (1 to 128 visible characters; use an internal id, not an e-mail). level is optional. Success returns linked, enrolled, campaignId and the tiers. Errors: INVALID_CODE (wrong, used or older than 15 minutes), PLAYER_ALREADY_LINKED, USER_ALREADY_LINKED, NO_ACTIVE_CAMPAIGN, INVALID_PLAYER. enrolled: false means the campaign has no free slots.

POST /partner/v1/progress

{ "playerId": "player-123", "level": 12, "eventId": "…" }

Report the player's current level (a whole number, 0 to 100000). Levels are cumulative, so you may skip reports; the next one catches up. result is one of CREDITED (new tiers earned), NO_NEW_TIER, IGNORED_LOWER, CAMPAIGN_PAUSED, FLAGGED (a very large jump, held for an admin to check) or FLAG_PENDING. Errors: NOT_LINKED, LINK_REVOKED, BLOCKED, NO_ACTIVE_CAMPAIGN, CAMPAIGN_FULL, INVALID_LEVEL, RETRY (HTTP 503: retry with the same eventId).

GET /partner/v1/campaign

The running campaign (tiers, holdHours, slotsLeft) or campaign: null.

4. Rules and limits