Aghanim Users API

The Users API from Aghanim — 5 operation(s) for users.

OpenAPI Specification

aghanim-users-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Aghanim Server-to-Server Achievements Users API
  description: "The Aghanim Server-to-Server API is designed for **backend server integrations only**. Use this API when you need to automate game hub updates from your server-side applications.\n\n\n## OpenAPI Specification\n\nYou can download the [OpenAPI](https://www.openapis.org/) specification for this API at the following link:\n[docs.aghanim.com/openapi.json](https://docs.aghanim.com/openapi.json).\n\n## Changelog\n\nSee the [S2S API Changelog](https://docs.aghanim.com/s2s-api/changelog/) for a history of changes to this API.\n\n## Authentication\n\nAghanim supports two methods of authentication: **Bearer token** and **Basic authentication**.\n\nTo authenticate, you will need your API key, which can be retrieved from\nthe Aghanim Dashboard → [**Game → Integration → API Keys**](https://dashboard.aghanim.com/go/integration/api-keys).\n\n**⚠️ Security Notice**: The S2S API key is **secret** and must be kept secure on your server. Never expose the S2S API key in client-side code, mobile apps, or any public-facing applications.\n\n### Bearer Token Authentication\n\nUse the Bearer method by including an `Authorization` header with the word `Bearer`\nfollowed by your API key. The `Authorization` header in your HTTP request should look like this: `Authorization: Bearer API_KEY`\n\n### Basic Authentication\n\nAlternatively, you can authenticate using Basic authentication. Your API key is used\nas the `username`, and the `password` should be left empty. Send an `Authorization`\nheader with the word `Basic` followed by a base64-encoded string\nin the format `API_KEY:` (note the colon at the end).\n\nThe `Authorization` header should look like this: `Authorization: Basic ZGVtbzpwQDU1dzByZA==`\n\n## Error Codes\n\nAghanim employs standard HTTP response codes to denote the success or failure of an API request.\nBelow is a table detailing error codes.\n\n| Code | Description |\n| ---- | ----------- |\n| 200  | OK          |\n| 400  | Bad request |\n| 401  | Not authenticated |\n| 403  | Not authorized |\n| 404  | Resource not found |\n| 409  | Conflict. Request conflicts with current state of resource |\n| 422  | Validation error |\n| 429  | Too many requests. Rate limit exceeded |\n| 503  | Server unavailable |\n\n### Generic error schema\n\n```json\n{\n  \"detail\": \"string\"\n}\n```\n\n### Validation error schema\n\n```json\n{\n  \"detail\": [\n    {\n      \"loc\": [\n        \"string\",\n        0\n      ],\n      \"msg\": \"string\",\n      \"type\": \"string\"\n    }\n  ]\n}\n```\n\n## Rate Limits\n\nThe Aghanim API has rate limiting in place to avoid overloading and to ensure it remains stable.\nThe allowable rate of requests is capped at 1,000 per minute for every game.\nGame developers who exceed this limit will receive a 429 error code.\n\nTo increase the rate limit, please contact us via [integration@aghanim.com](mailto:integration@aghanim.com).\n\n## Pagination\n\nIn the Aghanim API, pagination is managed through the use of the `limit` and `offset` query parameters.\nThese parameters allow to fine-tune your data retrieval requests by specifying:\n\n- `limit`: the number of records to be returned in a single request.\n- `offset`: indicates the number of records to skip from the start of the dataset.\n"
  contact:
    name: Aghanim
    email: integration@aghanim.com
  version: 2026.07.14
servers:
- url: https://api.aghanim.com/s2s
  description: Production
tags:
- name: Users
paths:
  /v1/users/authorize:
    post:
      tags:
      - Users
      summary: Authorize User
      description: Generate an authorization URL to log in a player on the Game Hub.
      operationId: authorize_user
      requestBody:
        content:
          application/json:
            schema:
              title: Authorize
              $ref: '#/components/schemas/LoginRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
  /v1/users/authenticate:
    post:
      tags:
      - Users
      summary: Authenticate User
      description: 'Authenticate a user using a one-time token. Game Hub generates and sends this token

        to the game client to process the user''s authentication flow with the game server.


        The token is valid for a single use and expires after a short period.'
      operationId: authenticate_user
      requestBody:
        content:
          application/json:
            schema:
              title: Authenticate
              $ref: '#/components/schemas/AuthenticateRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserRead'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
  /v1/users/{user_id}:
    get:
      tags:
      - Users
      summary: Get User
      description: Retrieve a user by their ID.
      operationId: get_user
      security:
      - HTTPBearer: []
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          title: User Id
          type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserRead'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/users/{user_id}/link_player:
    post:
      tags:
      - Users
      summary: Link Player
      description: Link a player to a user.
      operationId: link_player
      security:
      - HTTPBearer: []
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          title: User Id
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              title: Link Request
              $ref: '#/components/schemas/LinkPlayerRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserRead'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/users/{user_id}/unlink_player:
    post:
      tags:
      - Users
      summary: Unlink Player
      description: Unlink a player from a user.
      operationId: unlink_player
      security:
      - HTTPBearer: []
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          title: User Id
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              title: Unlink Request
              $ref: '#/components/schemas/LinkPlayerRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserRead'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    LoginRequest:
      properties:
        player_id:
          type: string
          title: Player Id
          description: The unique player ID.
        nonce:
          type: string
          title: Nonce
          description: The nonce to authenticate the user.
        redirect_path:
          type: string
          title: Redirect Path
          description: The game hub page to redirect the player to.
        player_info:
          title: Player Info
          description: The player info object.
          $ref: '#/components/schemas/PlayerInfoV1'
      type: object
      required:
      - player_id
      title: LoginRequest
    Marketplace:
      type: string
      enum:
      - none
      - app_store
      - google_play
      - aghanim
      - other
      - one_store
      - galaxy_store
      title: Marketplace
    PlayerTag:
      type: string
      enum:
      - tester
      title: PlayerTag
    PlayerAttributes:
      properties:
        level:
          type: integer
          title: Level
          default: 0
          posthog: true
        platform:
          $ref: '#/components/schemas/Platform'
        marketplace:
          default: none
          $ref: '#/components/schemas/Marketplace'
        device_type:
          $ref: '#/components/schemas/DeviceType'
        tags:
          items:
            $ref: '#/components/schemas/PlayerTag'
          type: array
        soft_currency_amount:
          type: integer
          title: Soft Currency Amount
          default: 0
        hard_currency_amount:
          type: integer
          title: Hard Currency Amount
          default: 0
        appsflyer_id:
          type: string
          title: Appsflyer Id
        appsflyer_app_id:
          type: string
          title: Appsflyer App Id
        appsflyer_meta:
          type: object
          title: Appsflyer Meta
        appsflyer_event_params:
          type: object
          title: Appsflyer Event Params
        appsflyer_customer_user_id:
          type: string
          title: Appsflyer Customer User Id
        adjust_device_id:
          additionalProperties:
            type: string
          type: object
          title: Adjust Device Id
        adjust_adid:
          type: string
          title: Adjust Adid
        adjust_app_token:
          type: string
          title: Adjust App Token
        adjust_authorization_token:
          type: string
          title: Adjust Authorization Token
        adjust_purchase_event_token:
          type: string
          title: Adjust Purchase Event Token
        adjust_callback_params:
          additionalProperties:
            type: string
          type: object
          title: Adjust Callback Params
        adjust_partner_params:
          additionalProperties:
            type: string
          type: object
          title: Adjust Partner Params
        singular_device_id:
          additionalProperties:
            type: string
          type: object
          title: Singular Device Id
        singular_app_id:
          type: string
          title: Singular App Id
        devtodev_appid:
          type: string
          title: Devtodev Appid
        devtodev_apikey:
          type: string
          title: Devtodev Apikey
        devtodev_device_id:
          $ref: '#/components/schemas/DevtodevDeviceId'
        ga4_client_id:
          type: string
          title: Ga4 Client Id
          description: GA4 web `client_id` from the `_ga` cookie.
        ga4firebase_app_instance_id:
          type: string
          title: Ga4Firebase App Instance Id
          description: Firebase mobile `app_instance_id` from the SDK.
        ga4_user_id:
          type: string
          maxLength: 256
          title: Ga4 User Id
          description: Partner-set GA4 cross-device `user_id`; falls back to `User.player_id` when unset.
      type: object
      title: PlayerAttributes
    UserRead:
      properties:
        id:
          type: string
          title: Id
          description: The unique identifier of the user.
        name:
          type: string
          title: Name
          description: The name of the user.
        avatar_url:
          type: string
          title: Avatar Url
          description: The avatar URL of the user.
        player_id:
          type: string
          title: Player Id
          description: The unique player ID of the user. If the user is not linked to a player, this field will be null.
      type: object
      required:
      - id
      title: UserRead
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    PlayerInfoV1:
      properties:
        name:
          type: string
          title: Name
          description: The player's name.
        avatar_url:
          type: string
          title: Avatar Url
          description: The player's avatar URL.
        attributes:
          title: Attributes
          description: The player's attributes.
          $ref: '#/components/schemas/PlayerAttributes'
        custom_attributes:
          additionalProperties:
            anyOf:
            - type: boolean
            - type: integer
            - type: number
            - type: string
            - items:
                anyOf:
                - type: boolean
                - type: integer
                - type: number
                - type: string
              type: array
          type: object
          title: Custom Attributes
          description: The player's custom attributes.
      type: object
      title: PlayerInfo
    Platform:
      type: string
      enum:
      - any
      - ios
      - android
      - other
      title: Platform
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LoginResponse:
      properties:
        authorization_url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Authorization Url
          description: The URL to authenticate the user on the Game Hub.
      type: object
      required:
      - authorization_url
      title: LoginResponse
    AuthenticateRequest:
      properties:
        token:
          type: string
          title: Token
          description: The token to authenticate the user.
      type: object
      required:
      - token
      title: AuthenticateRequest
    DevtodevDeviceId:
      properties:
        deviceId:
          type: string
          title: Deviceid
        devtodevId:
          type: integer
          title: Devtodevid
        userId:
          type: string
          title: Userid
        advertisingId:
          type: string
          title: Advertisingid
      type: object
      title: DevtodevDeviceId
    LinkPlayerRequest:
      properties:
        player_id:
          type: string
          title: Player Id
          description: The unique player ID to link to the user.
      type: object
      required:
      - player_id
      title: LinkPlayerRequest
    DeviceType:
      type: string
      enum:
      - Apple
      - Android
      - Unknown
      - Other
      title: DeviceType
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      description: Refer to the [Authentication](https://docs.aghanim.com/api-reference/) section for instructions on obtaining an API key and use it as the `Bearer` token.