Skip to main content
Version: 2019-05-29 (Current)

Update a Customer

Update an existing customer's information including description, email, metadata, and default card. All parameters are optional - only provide the fields you want to update.


๐Ÿ”‘API Credentials

Request Parametersโ€‹

Required - 1 fieldPath Parameters
โ–ผ
`id`STRING(required)
The customer ID to update (must start with cust_).
Example:"cust_test_5xuy4w91xqz7d1w9u0t"
Constraints:Must be a valid customer ID
Additional - 4 fieldsOptional Parameters

Responsesโ€‹

200

Customer updated successfully

Customer object returned with updated information.

Update behavior:
  • Only provided fields are updated
  • Unprovided fields remain unchanged
  • Metadata is merged (not replaced)
  • If card is provided, a new card is added and becomes default
  • Previous cards remain attached but are no longer default

400

Bad request

Request validation failed. Check the error message for details.

Common causes:
  • Invalid email format
  • Invalid metadata format
  • Metadata exceeds 15,000 characters

401

Unauthorized

Authentication failed. Invalid or missing API key.

Common causes:
  • Missing Authorization header
  • Invalid secret key
  • Using public key instead of secret key
  • Incorrect HTTP Basic Auth format

404

Not found

Customer or token not found.

Common causes:
  • Customer ID does not exist
  • Token ID does not exist
  • Token has already been used

Code samplesโ€‹

curl https://api.omise.co/customers/cust_test_5xuy4w91xqz7d1w9u0t \
-X PATCH \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "email=john.updated@example.com" \
-d "description=John Doe - Premium Member"

Error and result codesโ€‹

Common Error Codesโ€‹

CodeDescriptionResolution
bad_requestInvalid parametersCheck email format and metadata
authentication_failureInvalid API keyVerify your secret key is correct
not_foundCustomer not foundVerify customer ID exists
used_tokenToken already usedGenerate a new token
invalid_cardInvalid card tokenCheck token is valid

Update Fieldsโ€‹

FieldDescription
emailUpdated customer email
descriptionUpdated customer description
default_cardNew default card (if card provided)
metadataMerged metadata object
cardsList of all cards (includes new card if added)

Try it outโ€‹

Required - 1 fields
โ–ผ
Additional - 4 fields