How to

Update user data

Update user profile information including address, preferences, and metadata 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

  • Update user profile information

Architecture at a glance

  • Use updateUser mutation → Update profile data
  • Include Bearer token in Authorization: Bearer {token} header for all requests

APIs used

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

Step-by-step

Update basic user information

Use the updateUser mutation to modify user profile data:

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

Request example

mutation updateUser(
  $user: UserInputType!
  $channelId: String
  $languageId: String
  $marketId: String
) {
  updateUser(
    user: $user
    channelId: $channelId
    languageId: $languageId
    marketId: $marketId
  ) {
    id
    email
    gender
    customerType
    newsletter
    personalId
  }
}
The channelId, languageId, and marketId arguments are optional and can be left out to use default values.

Response example

200 OK
response.json
{
  "data": {
    "updateUser": {
      "id": 12345,
      "email": "user@example.com",
      "gender": "WOMAN",
      "customerType": "PERSON",
      "newsletter": true,
      "personalId": "19901231-1234"
    }
  }
}

Update user address

Update address information for the user

Request example

mutation updateUser(
  $user: UserInputType!
  $channelId: String
  $languageId: String
  $marketId: String
) {
  updateUser(
    user: $user
    channelId: $channelId
    languageId: $languageId
    marketId: $marketId
  ) {
    address {
      firstName
      lastName
      addressLine1
      addressLine2
      city
      state
      country
      zip
      company
      mobile
      phone
      careOf
      entryCode
    }
  }
}

Update customer type

Change user from person to organization:

Request example

{
  "user": {
    "customerType": "ORGANIZATION",
    "address": {
      "company": "Acme Corporation AB",
      "firstName": "Jane",
      "lastName": "Doe"
    }
  }
}

User input options

The updateUser mutation accepts the following user data:

Basic information

  • gender: Set to UNSET, UNSPECIFIED, WOMAN, or MAN
  • newsletter: Boolean for newsletter subscription
  • personalId: Personal identification number or social security number
  • customerType: Set to PERSON or ORGANIZATION (defaults to PERSON)
  • metaData: JSON string for storing custom user preferences or data

Address information

All address fields are optional:

  • firstName, lastName: User's name
  • addressLine1, addressLine2, addressLine3: Street address lines
  • city, state, country: Location information
  • zip: Postal code
  • company: Company name (especially useful for ORGANIZATION customer type)
  • mobile, phone: Contact numbers
  • careOf: Care of address information
  • entryCode: Building or gate entry code

Multi-market support

The mutation supports optional parameters for multi-market configurations:

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

Common pitfalls

  • Missing to add Authorization header with Bearer token
  • Invalid customerType enum values - use PERSON or ORGANIZATION only
  • Invalid gender enum values - use UNSET, UNSPECIFIED, WOMAN, or MAN
Related