Console
Achievements

Grant Achievement

Unlock an achievement for a user. Idempotent — calling twice with the same user/achievement returns "already_unlocked" without error.

POST /api/achievements/grant.php
Requires Authorization: AppID:AppKey header

Identify the achievement (one of)

FieldTypeDescription
slugstringAchievement slug from your app
achievement_idintNumeric ID returned by create.php

Identify the user (one of)

FieldTypeDescription
user_idintNumeric user ID
userkeystringUser's userKey
tokenstringUser's session token

Success response 200

{
  "success": true,
  "result": "granted",
  "achievement": {
    "id": 1,
    "slug": "first_kill",
    "name": "First Kill",
    "rarity": "common",
    "xp": 100
  },
  "user_id": 42
}
{
  "success": true,
  "result": "already_unlocked",
  "achievement": { "id": 1, "slug": "first_kill", ... },
  "user_id": 42
}

Errors

CodeMessageCause
401Invalid app credentials.Bad AppID or AppKey
400Achievement identifier required.Neither slug nor achievement_id provided
400User identifier required.No user identification field in body
404Achievement not found.Slug/ID doesn't exist for this app
401Invalid or expired token.Token is invalid or expired