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

# Update Customer

> Update an existing customer for your My Virtual Office account

# Update Customer

Update one or more fields of an existing customer. Only fields provided in the request body will be modified.

## Authentication

<ParamField header="X-API-Key" type="string" required>
  Your API key. Can also be provided via `Authorization: Bearer` header.
</ParamField>

## Path Parameters

<ParamField path="id" type="string" required>
  The UUID of the customer to update.
</ParamField>

## Request Body

At least one field must be provided.

<ParamField body="first_name" type="string">
  Customer's first name. Maximum 100 characters.
</ParamField>

<ParamField body="last_name" type="string">
  Customer's last name. Maximum 100 characters.
</ParamField>

<ParamField body="email" type="string">
  Customer's email address. Must be a valid email format and unique for your account.
</ParamField>

<ParamField body="company_name" type="string">
  Company name. Maximum 200 characters.
</ParamField>

<ParamField body="legal_entity" type="string">
  Legal entity type (e.g., "GmbH", "LLC"). Maximum 100 characters.
</ParamField>

<ParamField body="language" type="string">
  Preferred language for communications. Must be either `en` or `de`.
</ParamField>

<ParamField body="status" type="string">
  Customer status. Must be one of `active`, `inactive`, or `suspended`. Inactive or suspended customers cannot log in to the portal.
</ParamField>

<ParamField body="address_data" type="object">
  Customer's address information.

  <Expandable title="address_data properties">
    <ParamField body="street" type="string">
      Street address. Maximum 200 characters.
    </ParamField>

    <ParamField body="city" type="string">
      City name. Maximum 100 characters.
    </ParamField>

    <ParamField body="postal_code" type="string">
      Postal/ZIP code. Maximum 20 characters.
    </ParamField>

    <ParamField body="country" type="string">
      Country name or code. Maximum 100 characters.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="postal_redirect_address" type="object">
  Address to which postal mail should be forwarded for this customer.

  <Expandable title="postal_redirect_address properties">
    <ParamField body="street" type="string">
      Street address. Maximum 200 characters.
    </ParamField>

    <ParamField body="city" type="string">
      City name. Maximum 100 characters.
    </ParamField>

    <ParamField body="postal_code" type="string">
      Postal/ZIP code. Maximum 20 characters.
    </ParamField>

    <ParamField body="country" type="string">
      Country name or code. Maximum 100 characters.
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="id" type="string">
  Unique identifier for the customer (UUID)
</ResponseField>

<ResponseField name="seller_id" type="string">
  Your seller account ID (UUID)
</ResponseField>

<ResponseField name="first_name" type="string">
  Customer's first name
</ResponseField>

<ResponseField name="last_name" type="string">
  Customer's last name
</ResponseField>

<ResponseField name="email" type="string">
  Customer's email address
</ResponseField>

<ResponseField name="company_name" type="string | null">
  Company name if provided
</ResponseField>

<ResponseField name="legal_entity" type="string | null">
  Legal entity type if provided
</ResponseField>

<ResponseField name="language" type="string | null">
  Preferred language
</ResponseField>

<ResponseField name="address_data" type="object | null">
  Address information if provided
</ResponseField>

<ResponseField name="postal_redirect_address" type="object | null">
  Postal redirect address if set
</ResponseField>

<ResponseField name="status" type="string">
  Customer status (`active`, `inactive`, or `suspended`)
</ResponseField>

<ResponseField name="source" type="string">
  Source of customer creation (e.g., "api")
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp of when the customer was created
</ResponseField>

<ResponseField name="updated_at" type="string">
  ISO 8601 timestamp of when the customer was last updated
</ResponseField>

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH https://app-api.my-virtual-office.com/api/customers/550e8400-e29b-41d4-a716-446655440000 \
    -H "X-API-Key: sk_live_your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "first_name": "Jane",
      "company_name": "Acme Corp",
      "language": "en"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://app-api.my-virtual-office.com/api/customers/550e8400-e29b-41d4-a716-446655440000',
    {
      method: 'PATCH',
      headers: {
        'X-API-Key': 'sk_live_your_api_key_here',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        first_name: 'Jane',
        company_name: 'Acme Corp',
        language: 'en',
      }),
    }
  );

  const customer = await response.json();
  ```

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

  response = requests.patch(
      'https://app-api.my-virtual-office.com/api/customers/550e8400-e29b-41d4-a716-446655440000',
      headers={
          'X-API-Key': 'sk_live_your_api_key_here',
          'Content-Type': 'application/json',
      },
      json={
          'first_name': 'Jane',
          'company_name': 'Acme Corp',
          'language': 'en',
      }
  )

  customer = response.json()
  ```
</CodeGroup>

## Example Response

```json 200 OK theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "seller_id": "660e8400-e29b-41d4-a716-446655440001",
  "first_name": "Jane",
  "last_name": "Doe",
  "email": "john.doe@example.com",
  "company_name": "Acme Corp",
  "legal_entity": "GmbH",
  "language": "en",
  "address_data": {
    "street": "Musterstraße 123",
    "city": "Berlin",
    "postal_code": "10115",
    "country": "Germany"
  },
  "postal_redirect_address": {
    "street": "Weiterleitungsstraße 5",
    "city": "München",
    "postal_code": "80331",
    "country": "Germany"
  },
  "status": "active",
  "source": "api",
  "created_at": "2024-01-15T10:30:00.000Z",
  "updated_at": "2024-02-20T14:15:00.000Z"
}
```

## Error Responses

<ResponseExample>
  ```json 400 Bad Request theme={null}
  {
    "error": "Bad Request",
    "message": "body must NOT have fewer than 1 properties"
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json 401 Unauthorized theme={null}
  {
    "error": "Unauthorized",
    "message": "API key is required. Provide it via X-API-Key header or Authorization Bearer token."
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json 404 Not Found theme={null}
  {
    "error": "Not Found",
    "message": "Customer not found"
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json 409 Conflict theme={null}
  {
    "error": "Conflict",
    "message": "A customer with this email already exists"
  }
  ```
</ResponseExample>

## Error Codes

| HTTP Code | Error                 | Description                                           |
| --------- | --------------------- | ----------------------------------------------------- |
| 400       | Bad Request           | Invalid request body or no fields provided            |
| 401       | Unauthorized          | Missing or invalid API key                            |
| 404       | Not Found             | Customer not found or does not belong to your account |
| 409       | Conflict              | Email address already exists for another customer     |
| 500       | Internal Server Error | Unexpected server error                               |
