Onboard Your Users

Bring your users onto GameShift and provision them a wallet.

Register your users to grant them access to marketplace features, chain assets, and interactions with GameShift’s payment flows. All that is needed is a valid email address for the user. Note, this email address will be used for transaction approval, so you should validate that the user can access it.

Make a POST http request to https://api.gameshift.dev/nx/users using your API key. Pass the user’s email address and a referenceId in the request body:

curl --request POST \
     --url https://api.gameshift.dev/nx/users \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-api-key: <your key here>' \
     --data '
{
  "referenceId": "exampleReferenceId",
  "email": "[email protected]"
}
'

Each referenceId must be a unique value. We recommend using a format compatible with your own authentication system, such as UUIDs or other generated ids. The referenceId cannot include any spaces or slashes.

The email must also be unique. You can not register two users with the same email. We recommend that you first verify the user's email before completing this step because their email address will be used to verify the user's session for transaction approvals.

If you would like to register the user with a non-GameShift wallet, you can include a externalWalletAddress field in the post body.

If successful, you’ll receive a response with the details you provided, plus an address for the user’s on-chain wallet:

{
  "referenceId": "exampleReferenceId",
  "email": "[email protected]"
}

Once a user is registered, their information and assets can be fetched at any time.

Fetch a user’s owned items by making a GET http request to https://api.gameshift.dev/nx/users/{the-user-id-you-used-to-register}/items:

curl --request GET \
     --url https://api.gameshift.dev/nx/users/exampleReferenceId/items \
     --header 'accept: application/json' \
     --header 'x-api-key: <your api key>'

If successful, you’ll receive a paginated list of all the user’s owned items, including Currencies and Unique Assets:

{
  "data": [
    {
      "type": "Currency",
      "item": {
        "id": "string",
        "mintAddress": "string",
        "name": "string",
        "symbol": "string"
      },
      "quantity": "1254"
    },
    {
      "type": "UniqueAsset",
      "item": {
        "id": "string",
        "attributes": [
          {
            "traitType": "string",
            "value": "string"
          }
        ],
        "created": 0,
        "name": "string",
        "collection": {
          "id": "string",
          "name": "string",
          "description": "string",
          "environment": {},
          "imageUrl": "string",
          "imported": true,
          "mintAddress": "string",
          "created": 0,
          "stats": {
            "numMinted": 0,
            "floorPrice": 0,
            "numListed": 0,
            "numOwners": 0
          }
        },
        "description": "string",
        "environment": {},
        "imported": true,
        "imageUrl": "string",
        "status": "Unprocessed",
        "forSale": true,
        "mintAddress": "string",
        "owner": {
          "address": "string",
          "referenceId": "string"
        },
        "price": {
          "currencyId": "USDC",
          "naturalAmount": "0"
        }
      }
    },
   ],
  "meta": {
    "page": 1,
    "perPage": 50,
    "totalPages": 1
  }
}

You can also set filters when querying the user's owned items to narrow down to just items of a specific type, items that are listed for sale on the marketplace, or items that belong to a particular collection.