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

# Update Customer

Updates a customer's information. All fields are optional — only send what you want to change.

## Authentication

Requires a valid Bearer token. The authenticated user must be a member of the organization.

## Path Parameters

| Parameter        | Type          | Required | Description     |
| ---------------- | ------------- | -------- | --------------- |
| `organizationId` | string (UUID) | Yes      | Organization ID |
| `customerId`     | string        | Yes      | Customer ID     |

## Request Body

All fields are optional.

| Field                 | Type   | Description               |
| --------------------- | ------ | ------------------------- |
| `legalName`           | string | Legal name (Razón Social) |
| `taxId`               | string | RFC del receptor          |
| `taxSystem`           | string | SAT tax system code       |
| `email`               | string | Customer email            |
| `phone`               | string | Phone number              |
| `defaultInvoiceUse`   | string | Default CFDI use code     |
| `addressStreet`       | string | Street name               |
| `addressExterior`     | string | Exterior number           |
| `addressInterior`     | string | Interior number           |
| `addressNeighborhood` | string | Neighborhood (Colonia)    |
| `addressCity`         | string | City                      |
| `addressMunicipality` | string | Municipality              |
| `addressZip`          | string | 5-digit ZIP code          |
| `addressState`        | string | State                     |
| `addressCountry`      | string | Country code              |

## Example Request

```bash theme={null}
curl -X PUT http://localhost:3001/api/organizations/550e8400-e29b-41d4-a716-446655440000/customers/590ce6c56d04f840aa8438af \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "new-billing@dundermifflin.com",
    "phone": "6474019999"
  }'
```

## Example Response

```json theme={null}
{
  "id": "590ce6c56d04f840aa8438af",
  "organizationId": "550e8400-e29b-41d4-a716-446655440000",
  "legalName": "Dunder Mifflin",
  "taxId": "DUM901231AB3",
  "taxSystem": "601",
  "email": "new-billing@dundermifflin.com",
  "phone": "6474019999",
  "defaultInvoiceUse": "G01",
  "address": {
    "street": "Blvd. Atardecer",
    "exterior": "142",
    "interior": null,
    "neighborhood": "Centro",
    "city": "Huatabampo",
    "municipality": "Huatabampo",
    "zip": "86500",
    "state": "Sonora",
    "country": "MEX"
  },
  "createdAt": "2025-01-26T10:00:00Z",
  "updatedAt": "2025-01-26T10:05:00Z"
}
```

## Common Errors

### 400 Bad Request

Invalid field value (e.g. wrong RFC format or ZIP code).

#### Fiscal validation error (CFDI 4.0)

When `taxId`, `taxSystem`, or `defaultInvoiceUse` are updated, the API re-validates the full `taxId` + `taxSystem` + `defaultInvoiceUse` combination against SAT CFDI 4.0 rules. RFC length determines persona type: 12 characters = persona moral, 13 characters = persona física. The régimen and uso CFDI must both be valid for that persona type, and the (uso, régimen) pair must exist in the SAT compatibility matrix.

```json theme={null}
{
  "statusCode": 400,
  "message": "El uso de CFDI \"D01\" no aplica para persona moral (RFC de 12 caracteres)",
  "error": "BAD_REQUEST"
}
```

Use `GET /sat/regimenes-fiscales` and `GET /sat/usos-cfdi` to look up valid codes and compatible combinations.

### 401 Unauthorized

Authentication required.

### 403 Forbidden

User is not a member of this organization.

### 404 Not Found

Customer not found.


## OpenAPI

````yaml PUT /organizations/{organizationId}/customers/{customerId}
openapi: 3.1.0
info:
  title: Timbrix API
  description: >-
    REST API with OAuth2 server for managing organizations, members, and
    webhooks
  version: '1.0'
  contact: {}
servers:
  - url: http://sandbox.mintlify.com
    description: Sandbox environment
  - url: http://localhost:3001/api
    description: Local development
security: []
tags:
  - name: organizations
    description: Organization management endpoints
  - name: oauth
    description: OAuth2 authentication and authorization
  - name: webhooks
    description: Webhook configuration and delivery
  - name: users
    description: User information endpoints
  - name: api-keys
    description: API Keys management and validation
paths:
  /organizations/{organizationId}/customers/{customerId}:
    put:
      tags:
        - customers
      summary: Update a customer
      operationId: CustomersController_update
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: customerId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCustomerDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponseDto'
      security:
        - bearer: []
components:
  schemas:
    UpdateCustomerDto:
      type: object
      properties:
        legalName:
          type: string
          description: Customer legal name
          example: Dunder Mifflin
        taxId:
          type: string
          description: Mexican RFC
          example: ABC101010111
        taxSystem:
          type: string
          description: SAT tax system code
          example: '601'
        email:
          type: string
          description: Customer email
          example: email@example.com
        phone:
          type: string
          description: Customer phone
          example: '6474010101'
        defaultInvoiceUse:
          type: string
          description: Default CFDI use code
          example: G01
        addressStreet:
          type: string
          description: Street name
        addressExterior:
          type: string
          description: Exterior number
        addressInterior:
          type: string
          description: Interior number
        addressNeighborhood:
          type: string
          description: Neighborhood
        addressCity:
          type: string
          description: City
        addressMunicipality:
          type: string
          description: Municipality
        addressZip:
          type: string
          description: ZIP code
        addressState:
          type: string
          description: State
        addressCountry:
          type: string
          description: Country code
    CustomerResponseDto:
      type: object
      properties:
        id:
          type: string
          example: 590ce6c56d04f840aa8438af
        organizationId:
          type: string
          example: org-uuid
        legalName:
          type: string
          example: Dunder Mifflin
        taxId:
          type: string
          example: ABC101010111
        taxSystem:
          type: string
          example: '601'
        email:
          type: string
          example: email@example.com
        phone:
          type: object
          example: '6474010101'
        defaultInvoiceUse:
          type: string
          example: G01
        address:
          $ref: '#/components/schemas/CustomerAddressDto'
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
      required:
        - id
        - organizationId
        - legalName
        - taxId
        - taxSystem
        - email
        - defaultInvoiceUse
        - address
        - createdAt
        - updatedAt
    CustomerAddressDto:
      type: object
      properties:
        street:
          type: string
          example: Blvd. Atardecer
        exterior:
          type: string
          example: '142'
        interior:
          type: object
          example: '4'
        neighborhood:
          type: string
          example: Centro
        city:
          type: string
          example: Huatabampo
        municipality:
          type: string
          example: Huatabampo
        zip:
          type: string
          example: '86500'
        state:
          type: string
          example: Sonora
        country:
          type: string
          example: MEX
      required:
        - street
        - exterior
        - neighborhood
        - city
        - municipality
        - zip
        - state
        - country
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````