Retrieve and update customer information

  • Customers
  • Customer account
  • 2 routes
How do I retrieve a customer profile and update their information?

This scenario explains how to read a customer profile and then submit an update on the same profile in a customer-authenticated context.

Overview

This scenario helps an authenticated application read the current customer profile and then submit targeted profile updates on the same account.

Prerequisites

  • A valid customer_id.
  • Valid authorization, accept-language and x-api-key headers.
  • A payload containing only the profile fields that must be changed.

Expected result

The application can preload the existing profile, send the requested changes and keep the customer record aligned with the latest information.

Process workflow

Legend:
Mandatory
Optional
1

Retrieve the customer profile

Mandatory

Use GET/v2/customers/{customer_id}/profile to read the current customer profile before displaying or editing account data in an authenticated journey.

Prerequisites

  • customer_id must identify an existing customer account.
  • Send accept-language, authorization, and x-api-key.
  • Run this step before building the update payload of the next step.

Calling CURL

curl -X 'GET' \
  'https://api.clubmed.com/v2/customers/123456789/profile' \
  -H 'accept: application/json' \
  -H 'accept-language: en-US' \
  -H 'authorization: Bearer YOUR_TOKEN' \
  -H 'x-api-key: YOUR_API_KEY'

Example answer

{
  "email": "tom@example.com",
  "gm_number": "123456789",
  "first_name": "Tom",
  "second_name": "James",
  "third_name": "Edward",
  "last_name": "Smith",
  "birth_city": "Paris",
  "phones": [
    {
      "number": "0623456789",
      "type": "MOBILE"
    }
  ],
  "loyalty_program": {
    "status": "GOLD",
    "previous_status": "SILVER",
    "is_platinum_for_life": false,
    "points": 1200
  },
  "address": {
    "city": "Aix-en-Provence",
    "zip_code": "75000",
    "country_code": "FR"
  },
  "locale": "fr-FR"
}

info: v2 is the best source to prefill editable forms without losing secondary names, birth city, or the richer loyalty fields.


Response codes

  • OK Response (200): returns the detailed customer profile with identity, contact, loyalty, and locale information.
  • Error (400): request validation failed or one input value is malformed.
  • Error (401): authentication is missing, invalid, or expired.
  • Error (403): access to this customer profile is forbidden for the current context.
  • Error (404): the customer profile was not found.
GET/v2/customers/{customer_id}/profile
See more
2

Update the customer profile

Mandatory

This route updates the detailed information of a customer account. Swagger specifies that all fields are optional: send only the ones you want to update. Missing or undefined keys are ignored, while null and empty strings are stored as null.

Prerequisites

  • Reuse the customer_id returned by the profile read step.
  • Send accept-language, authorization, and x-api-key.
  • Use the optional force_address query parameter if you need to force an address that is unknown from the current database.

Calling CURL

curl -X 'PATCH' \
  'https://api.clubmed.com/v1/customers/123456789/profile?force_address=false' \
  -H 'accept: application/json' \
  -H 'accept-language: en-US' \
  -H 'authorization: Bearer YOUR_TOKEN' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  --data-raw @profile-update.json

Example answer

HTTP/1.1 204 No Content

info: Any other non-empty value is applied exactly as provided in the payload.


Response codes

  • OK Response (200): not documented in Swagger. The successful contract is 204 No Content, so no response body is returned.
  • Error (400): the payload is invalid, incomplete or not valid JSON.
  • Error (401): authentication is missing, invalid or expired.
  • Error (403): the caller is not allowed to update this customer profile.
  • Error (404): the customer profile was not found.
PATCH/v1/customers/{customer_id}/profile
See more