Skip to main content

Customer

Manage customer records including contact information, addresses, and bank accounts.

Quick Reference

EndpointMethodDescription
/api/v1/customersPOSTCreate a new customer
/api/v1/customersGETList all customers
/api/v1/customers/:idGETGet specific customer
/api/v1/customers/:idPUTUpdate customer
/api/v1/customers/:idDELETEDelete customer

API Endpoints

Create Customer

Create a new customer record.

POST /api/v1/customers
curl -X POST 'https://api.finan.one/open/api/v1/customers' \
-H 'Content-Type: application/json' \
-H 'x-client-id: YOUR_CLIENT_ID' \
-H 'x-signature: YOUR_SIGNATURE' \
-H 'x-timestamp: 1699999999' \
-d '{
"general_info": {
"name": "Nguyen Van B",
"customer_code": "CUST20231122",
"phone": "0933456789",
"phone_code": "+84",
"email": "[email protected]",
"type": "personal",
"tax_id": "123456789",
"contact_persons": [
{
"name": "Jane Smith",
"phone_number": "987654321",
"email": "[email protected]"
}
],
"custom_tag": "VIP"
},
"address": {
"country": "Vietnam",
"province": "Ho Chi Minh",
"district": "District 1",
"ward": "Ben Thanh Ward",
"address": "123 Le Loi Street",
"zip_code": "100000"
},
"bank_accounts": [
{
"bank_code": "201",
"bank_name": "Vietcombank",
"account_holder_name": "Nguyen Van B",
"account_number": "123456789012"
}
]
}'

Request Body

general_info (required)

FieldTypeRequiredDescription
namestringCustomer full name
customer_codestringUnique customer identifier
phonestringPhone number
phone_codestringInternational dialing code (e.g., +84)
emailstringEmail address
typestringpersonal or company
tax_idstringTax identification number
contact_personsarrayContact persons (required for company type)
custom_tagstringCustom label (e.g., VIP)

contact_persons (required for company type)

FieldTypeRequiredDescription
namestringContact person name
phone_numberstringContact phone
emailstringContact email

address (optional)

FieldTypeDescription
countrystringCountry
provincestringProvince/State
districtstringDistrict
wardstringWard
addressstringStreet address
zip_codestringPostal code

bank_accounts (optional)

FieldTypeDescription
bank_codestringBank code. See Code Reference
bank_namestringBank name
account_holder_namestringAccount holder name
account_numberstringAccount number

Response

{
"message": { "content": "Thực thi API thành công" },
"code": 102001,
"request_id": "abc123...",
"data": {
"customer_id": "550e8400-e29b-41d4-a716-446655440000",
"general_info": {
"name": "Nguyen Van B",
"customer_code": "CUST20231122",
"phone": "0933456789",
"email": "[email protected]",
"type": "personal"
},
"address": {
"country": "Vietnam",
"province": "Ho Chi Minh",
"district": "District 1"
},
"bank_accounts": [
{
"bank_code": "201",
"bank_name": "Vietcombank",
"account_number": "123456789012"
}
],
"created_at": "2024-01-20T14:00:00Z"
}
}
tip

Ensure customer_code is unique within your system to prevent duplicate records.


Get Customers

Retrieve all customers.

GET /api/v1/customers
curl -X GET 'https://api.finan.one/open/api/v1/customers' \
-H 'Content-Type: application/json' \
-H 'x-client-id: YOUR_CLIENT_ID' \
-H 'x-signature: YOUR_SIGNATURE' \
-H 'x-timestamp: 1699999999'

Response

{
"message": { "content": "Thực thi API thành công" },
"code": 102000,
"request_id": "abc123...",
"data": [
{
"customer_id": "550e8400-e29b-41d4-a716-446655440000",
"general_info": {
"name": "Nguyen Van B",
"customer_code": "CUST20231122",
"type": "personal"
},
"created_at": "2024-01-20T14:00:00Z"
}
]
}
Get Single Customer
GET /api/v1/customers/:customer_id

Update Customer

Replace an existing customer's data. This is a full replace operation — all required fields must be included, and omitted optional fields will be cleared.

PUT /api/v1/customers/:customer_id
Full Replace, Not Partial Update

You must include general_info.type and all fields you want to keep. Fields not included (e.g., address, bank_accounts) will be reset to empty.

curl -X PUT 'https://api.finan.one/open/api/v1/customers/550e8400-e29b-41d4-a716-446655440000' \
-H 'Content-Type: application/json' \
-H 'x-client-id: YOUR_CLIENT_ID' \
-H 'x-signature: YOUR_SIGNATURE' \
-H 'x-timestamp: 1699999999' \
-d '{
"general_info": {
"name": "Updated Customer Name",
"customer_code": "CUST20231122",
"phone": "0933456789",
"phone_code": "+84",
"email": "[email protected]",
"type": "personal",
"custom_tag": "Priority Customer"
},
"address": {
"country": "Vietnam",
"province": "Ho Chi Minh"
}
}'

Response

{
"message": { "content": "Thực thi API thành công" },
"code": 102000,
"request_id": "abc123...",
"data": {
"customer_id": "550e8400-e29b-41d4-a716-446655440000",
"general_info": {
"name": "Updated Customer Name",
"email": "[email protected]"
},
"updated_at": "2024-01-21T10:00:00Z"
}
}

Delete Customer

Delete a customer record.

DELETE /api/v1/customers/:customer_id
curl -X DELETE 'https://api.finan.one/open/api/v1/customers/550e8400-e29b-41d4-a716-446655440000' \
-H 'Content-Type: application/json' \
-H 'x-client-id: YOUR_CLIENT_ID' \
-H 'x-signature: YOUR_SIGNATURE' \
-H 'x-timestamp: 1699999999'

Response

{
"message": { "content": "Thực thi API thành công" },
"code": 102001,
"request_id": "abc123...",
"data": "success"
}
Dependencies

Deletion may fail if the customer has pending invoices or active contracts. Resolve dependencies first.


Next Steps