---
search:
  tags:
    - Customers
    - PUT
seo:
  description: >-
    Any signed in user. Patches a customer's name, phone, national id,…
    Reference for the PUT /api/v1/customers/{customerId} endpoint in the
    PharmaFlow API.
sidebar:
  label: Update a customer
  badge: PUT
title: Update a customer
type: openapi-operation
---
Any signed in user. Patches a customer's name, phone, national id, notes, or credit fields. An empty patch is refused with 400 and an unknown customer with 404; money stays strings.

`PUT /api/v1/customers/{customerId}`

**Request body** (`application/json`, required)

- `name` (string | null)
- `phone` (string | null)
- `national_id` (string | null)
- `notes` (string | null)
- `credit_limit` (number | null)
- `is_credit_allowed` (boolean | null)

Request body example:

```json
{
  "name": "string",
  "phone": "string",
  "national_id": "string",
  "notes": "string",
  "credit_limit": 0,
  "is_credit_allowed": true
}
```

**Responses**

- `200` — Customer updated
- `400` — No fields to update, or a field fails validation
- `401` — Not authenticated
- `404` — Customer not found

Response example, 200:

```json
{
  "id": "string",
  "name": "string",
  "phone": "string",
  "national_id": "string",
  "notes": "string",
  "image_url": "string",
  "credit_limit": "string",
  "current_balance": "string",
  "is_credit_allowed": true,
  "created_at": "string",
  "updated_at": "string",
  "is_deleted": true
}
```
