Skip to content

Private API

Authorization

To use Balancy's API you need to send Authorization header with you game private key.

Branch Flags

Add into Authorization header of API request: Authorization: Bearer your_game_private_key.

Profiles

Using API you can:

  1. Get user profile: GET request https://api-lb-1.prd.balancy.dev/v2/pr/games/<game_guid>/saves/<balancy_user_id>/collections/<collection_name>?env=<environment>.

    For example, using curl:

     curl -v -X GET -H "Content-Type: application/json" \
     -H "Authorization: Bearer MDM0NGE1NTRhZTMDM0NGE1NTRhZT" \
     "https://api-lb-1.prd.balancy.dev/v2/pr/games/11111111-1111-1111-1111-0684909fddca/saves/22222222-1111-1111-1111-0684909fddca/collections/MyProfile?env=0"
    

    In response, you will get info about existing objects in this collection: [{"value":{"count":1},"key":"Items","version":0}].

  2. Update user profile: PATCH request https://api-lb-1.prd.balancy.dev/v2/pr/games/<game_guid>/saves/<balancy_user_id>/collections/<collection_name>/<key>?env=<environment>. And pass value object field with version. For version you can send -1.

    For example, using curl:

     curl -v -X PATCH -H "Content-Type: application/json" \
     -H "Authorization: Bearer MDM0NGE1NTRhZTMDM0NGE1NTRhZT" \
     --data "{\"value\": {\"count\": 100}, \"version\": -1}" \
     "https://api-lb-1.prd.balancy.dev/v2/pr/games/11111111-1111-1111-1111-0684909fddca/saves/22222222-1111-1111-1111-0684909fddca/collections/MyProfile/Items/?env=0"
    

    In response you will receive new version: {"version":1}.