We are using cookies to improve your experience!

By clicking "Allow all", you agree to use of all cookies. Visit our Privacy Policy to learn more.

Update Customer

PATCH /api/v1/customers/:id

Update an existing customer’s details.

Description

Partially updates a customer record. Only provided fields are modified. Supports updating nested address attributes.

Path Parameters

Parameter Type Required Description
id Integer Yes Customer ID

Query Parameters

None.

Request Headers

Header Value Description
Authorization Bearer <access_token> OAuth 2.0 Bearer token
Content-Type application/json Request body format
Accept application/json Response format

Request Body

(Same structure as Create Customer body; omitted fields remain unchanged.)

Request Example

curl -X PATCH "https://koteshen.com/api/v1/customers/13" \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "customer": {
      "company": "Texas Ins",
      "email": "procurement@texas.com",
      "customer_type": "business",
      "phone": "+27675711214",
      "phone_country": "za",
      "currency": "zar",
      "website": "https://texas.com",
      "notes": "notesy",
      "address_attributes": {
        "line": "1 Mahem Pl",
        "line2": "Unit 23",
        "post_code": "5256",
        "city": "East London",
        "country": "South Africa"
      }
    }
  }'

Response

  • Status Code: 200 OK
  • Content-Type: application/json

Success Response Body

{
  "id": 13,
  "name": "Texas Ins",
  "company": "Texas Ins",
  "customer_type": "business",
  "phone": "+27675711214",
  "phone_country": "za",
  "currency": "zar",
  "email": "procurement@texas.com",
  "website": "https://texas.com",
  "business_id": 1,
  "notes": "notesy",
  "created_at": "2025-10-12T19:00:37.057Z",
  "updated_at": "2025-10-21T11:00:00.000Z",
  "address": {
    "id": 26,
    "line": "1 Mahem Pl",
    "line2": "Unit 23",
    "post_code": "5256",
    "city": "East London",
    "country": "South Africa",
    "created_at": "2025-10-12T19:09:27.300Z",
    "updated_at": "2025-10-21T11:00:00.100Z"
  },
  "url": "https://koteshen.com/api/v1/customers/13.json"
}

Error Responses

  • 401 Unauthorized: { "error": "Unauthorized" }
  • 404 Not Found: { "error": "Customer not found" }
  • 422 Unprocessable Entity: { "errors": { "email": ["has already been taken"] } }

Usage Notes

  • Idempotent: Repeated calls with same data won’t create duplicates.
  • Address updates cascade to linked invoices if applicable.