> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kwugwo.africa/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a customer

> Modify a customer's profile.

Partially updates the customer. Send only the fields you want to
change; omitted fields keep their existing values.

## Path parameters

<ParamField path="uid" type="string" required>
  Customer ID, `ony.XXXX.YYYY...`.
</ParamField>

## Body parameters

All fields are optional. When sent, the same validation rules as
[Create](/customers/create#body-parameters) apply.

<ParamField body="email" type="string">New email. Must be valid.</ParamField>
<ParamField body="ref" type="string">Your reference (max 150 chars).</ParamField>
<ParamField body="first_name" type="string">Up to 100 chars.</ParamField>
<ParamField body="last_name" type="string">Up to 100 chars.</ParamField>
<ParamField body="billing_address" type="object">Same shape as on create.</ParamField>
<ParamField body="meta" type="object">**Replaces** the existing `meta`; it is not merged.</ParamField>

## Response

Returns the updated customer, same shape as [Get a
customer](/customers/get#response).

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH https://api.kwugwo.africa/v1/onye/ony.VCvr.7K2qPmRtV9xLnQ8sD1cYwHfE \
    -H "Authorization: Bearer $KWUGWO_SECRET_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "first_name": "Adaeze", "meta": { "source": "shopify", "tier": "vip" } }'
  ```

  ```js Node theme={null}
  const onye = await fetch(
    `https://api.kwugwo.africa/v1/onye/${onyeUid}`,
    {
      method: "PATCH",
      headers: {
        Authorization: `Bearer ${process.env.KWUGWO_SECRET_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        first_name: "Adaeze",
        meta: { source: "shopify", tier: "vip" },
      }),
    }
  ).then(r => r.json());
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init("https://api.kwugwo.africa/v1/onye/{$onyeUid}");
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST  => 'PATCH',
      CURLOPT_HTTPHEADER     => [
          'Authorization: Bearer ' . getenv('KWUGWO_SECRET_KEY'),
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode([
          'first_name' => 'Adaeze',
          'meta'       => ['source' => 'shopify', 'tier' => 'vip'],
      ]),
  ]);
  $onye = json_decode(curl_exec($ch), true);
  curl_close($ch);
  ```

  ```python Python theme={null}
  import os, requests

  onye = requests.patch(
      f"https://api.kwugwo.africa/v1/onye/{onye_uid}",
      headers={"Authorization": f"Bearer {os.environ['KWUGWO_SECRET_KEY']}"},
      json={"first_name": "Adaeze", "meta": {"source": "shopify", "tier": "vip"}},
  ).json()
  ```

  ```go Go theme={null}
  body, _ := json.Marshal(map[string]any{
      "first_name": "Adaeze",
      "meta":       map[string]string{"source": "shopify", "tier": "vip"},
  })
  url := fmt.Sprintf("https://api.kwugwo.africa/v1/onye/%s", onyeUid)
  req, _ := http.NewRequest("PATCH", url, bytes.NewReader(body))
  req.Header.Set("Authorization", "Bearer "+os.Getenv("KWUGWO_SECRET_KEY"))
  req.Header.Set("Content-Type", "application/json")
  resp, _ := http.DefaultClient.Do(req)
  defer resp.Body.Close()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "uid": "ony.VCvr.7K2qPmRtV9xLnQ8sD1cYwHfE",
    "email": "ada@example.com",
    "first_name": "Adaeze",
    "last_name": "Okeke",
    "meta": { "source": "shopify", "tier": "vip" }
  }
  ```
</ResponseExample>
