How to

Get user data

Retrieve authenticated user profile information including address and preferences using Geins Merchant API

Prerequisites

  • Merchant API key
  • Bearer token (obtained from user authentication)
Learn how to obtain a Bearer token by following the Log in user guide.

Goal

  • Get and display user data

Architecture at a glance

  • Use getUser query → Retrieve user profile data
  • Include Bearer token in Authorization: Bearer {token} header for authentication

APIs used

  • Merchant API: https://merchantapi.geins.io/graphql

Step-by-step

Get user profile information

Use the getUser query to retrieve the authenticated user's profile data:

Try it out in the GraphQL Playground using the query, headers and variables below.

Request example

query getUser(
  $channelId: String
  $languageId: String
  $marketId: String
) {
  getUser(
    channelId: $channelId
    languageId: $languageId
    marketId: $marketId
  ) {
    id
    email
    gender
    customerType
    newsletter
    personalId
    address {
      firstName
      lastName
      addressLine1
      addressLine2
      city
      state
      country
      zip
      company
      mobile
      phone
    }
  }
}
The channelId, languageId, and marketId arguments are optional and can be left out to use default values.

Response example

200 OK
response.json
{
  "data": {
    "getUser": {
      "id": 12345,
      "email": "{USER_EMAIL}",
      "gender": "WOMAN",
      "customerType": "PERSON",
      "newsletter": true,
      "personalId": "19901231-1234",
      "address": {
        "firstName": "Jane",
        "lastName": "Doe",
        "addressLine1": "456 Main Street",
        "addressLine2": "Apartment 2B",
        "city": "Stockholm",
        "state": "Stockholm",
        "country": "Sweden",
        "zip": "11122",
        "company": null,
        "mobile": "+46 70 123 456 78",
        "phone": "+46 8 123 456 78"
      }
    }
  }
}

Multi-market support

The query supports optional parameters for multi-market configurations:

Read more about channelId, languageId, and marketId in the multi-market support guide.

Common pitfalls

  • Missing Authorization header with Bearer token - the request will fail without authentication
  • Expired Bearer token - refresh the token if you receive authentication errors
Related