---
uuid: 2841a24b-9bdd-40d1-a09d-989949c94dbe
date_created: 2025-10-28T16:02:29.387Z
date_updated: 2026-04-07T09:48:40.789Z
seo_url: create-and-update-customer
category: Customer account
tags: 
  - Customers
routes: 
  - POST /v1/customers
  - GET /v2/customers/{customer_id}/profile
  - PATCH /v1/customers/{customer_id}/profile
---

# Create and update a customer

This scenario explains how to create a new customer account, read the resulting profile, and update the customer data needed by downstream journeys. It fits CRM, assisted-sales, and onboarding flows that must secure a reusable customer record before quotation or booking.

The flow starts with customer creation, reuses the returned `customer_id`, then reads and updates the profile in a controlled way.

## Flow

```mermaid
flowchart LR
    step0["Create a new customer"]
    step1["Retrieve the complete customer profile"]
    step2["Update the customer profile"]
    step0 --> step1
    step1 --> step2
```

## Overview

This scenario helps an application create a customer account and enrich the profile immediately after creation.

## Prerequisites

* A valid authentication context with `authorization`, `accept-language`, and `x-api-key`.
* The identity and contact data required to create the customer.
* The `customer_id` returned by the creation step to continue the flow.

## Expected result

The application creates a reusable customer account, verifies the created profile, and updates the information required for the next sales or booking steps.

## 1 - Create a new customer

Use `POST /v1/customers` to create a customer account before reading or enriching the profile. This step returns the `customer_id` that will be reused by the next profile steps.

#### Prerequisites

* Send `accept-language`, `authorization`, and `x-api-key`.
* Prepare the customer identity and contact fields required by your onboarding flow.
* Add `force_address` only if your integration needs to bypass standard address validation.

#### Calling CURL

```bash
curl -X 'POST' \
  'https://api.clubmed.com/v1/customers' \
  -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' \
  -d '{ ... }'
```

#### Example answer

```json
{
  "id": "123456789",
  "gm_number": "987654321",
  "email": "tom@example.com",
  "identity": {
    "first_name": "Tom",
    "last_name": "Smith"
  },
  "locale": "en-US"
}
```

> **info:** Keep the returned `customer_id` because it becomes the key reference for the profile retrieval and update steps.

***

**Response codes**

* **OK Response (201):** the customer was created and the new account identifiers are returned.
* **Error (400):** the payload is invalid or a required field is missing.
* **Error (401):** authentication is missing, invalid, or expired.
* **Error (404):** non documented in Swagger.

**Related route**: [POST https://api.clubmed.com//v1/customers](https://api.clubmed.com/doc?search=POST%20%2Fv1%2Fcustomers)

## 2 - Retrieve the complete customer profile

Use `GET /v2/customers/{customer_id}/profile` to read the full customer profile after creation or before an update. This step exposes identity, contact data, loyalty information, and locale settings.

#### Prerequisites

* Reuse a valid `customer_id`.
* Send `accept-language`, `authorization`, and `x-api-key`.
* Make sure the authenticated context is allowed to read this customer profile.

#### Calling CURL

```bash
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

```json
{
  "email": "tom@example.com",
  "gm_number": "123456789",
  "first_name": "Tom",
  "last_name": "Smith",
  "phones": [
    {
      "number": "0623456789",
      "type": "MOBILE"
    }
  ],
  "loyalty_program": {
    "status": "EXCLUDED",
    "points": 1200
  },
  "locale": "en-US"
}
```

> **info:** `v2` is the reference profile payload to verify contact data and loyalty context before sending an update.

***

**Response codes**

* **OK Response (200):** returns the detailed customer profile for the selected account.
* **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.

**Related route**: [GET https://api.clubmed.com//v2/customers/{customer\_id}/profile](https://api.clubmed.com/doc?search=GET%20%2Fv2%2Fcustomers%2F%7Bcustomer_id%7D%2Fprofile)

## 3 - Update the customer profile

Use `PATCH /v1/customers/{customer_id}/profile` to update only the customer fields that must change. Missing or undefined fields are ignored, while `null` or empty strings clear the corresponding value.

#### Prerequisites

* Reuse a valid `customer_id`.
* Send `accept-language`, `authorization`, and `x-api-key`.
* Prepare only the fields that really need to change.

#### Calling CURL

```bash
curl -X 'PATCH' \
  'https://api.clubmed.com/v1/customers/123456789/profile' \
  -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' \
  -d '{ ... }'
```

#### Example answer

```http
HTTP/1.1 204 No Content
```

> **info:** Use `null` or an empty string only when you explicitly want to clear an existing profile value.

***

**Response codes**

* **OK Response (204):** the customer profile was updated successfully with no response body.
* **Error (400):** the payload is invalid or one submitted field does not match the route rules.
* **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.

**Related route**: [PATCH https://api.clubmed.com//v1/customers/{customer\_id}/profile](https://api.clubmed.com/doc?search=PATCH%20%2Fv1%2Fcustomers%2F%7Bcustomer_id%7D%2Fprofile)
