Skip to main content

Sync customers

The sync customers API is a single API endpoint that you can use to send customer data into TRAEDE.

Creating vs updating customers

TRAEDE will use customer number to determine if a customer already exists and we are trying to create a new customer or updating an existing one. For instance, if you send a customer with customer number 1000 TRAEDE will look for an existing one. If one exists this customer will be used. If one does not exist it will be created.

Updating customer numbers of existing customers

Due to the above sync model you are not able to update customer numbers using the customer sync API. This is because if you pass a new customer number, then it will be used to create a new customer instead of updating the one you are trying to update.

Deleting customers

You can delete customers by passing along delete: true to the customer data. Note that customers with production orders and other data cannot be deleted. TRAEDE will return an error response if the delete was unsuccessful for any reason

POST /customers/sync

Endpoint: POST /customers/sync

ParameterRequiredDefaultDescription
customers.*YesAn array of customers to update

Suppliers

ParameterData typeRequiredDefaultDescription
customer_numberstringYesThe item number of the customer. We use this to determine if a customer already exists and we are updating it or we are creating a new one
namestringIf new customerThe name of the customer
currencystringIf new customerWhat is the currency of the customer
discount_percentagefloatWhat discount percentage should the customer have. Should be a number between 0 and 100
activebooleantrueShould this customer be active for selling?
payment_termPayment termWhich payment terms should the customer have
addresses_sync_modestringIf addresses key existsShould either be replace to replace existing addresses, or append to append to existing addresses
addresses_sync_keystringIf addresses key existsShould either be address_title or remote_erp_id. This will determine whether to use title field or remote_erp_id field to determine if you are creating a new address or updating an existing one
addressesArray<Address>Addresses of the customer

Payment term

ParameterRequiredDefaultDescription
payment_term_idYes, if no payment_term_code is supplied
payment_term_codeYes, if no payment_term_id is supplied

Addresses

ParameterData typeRequiredDefaultDescription
titlestringYesThe title of the address. This is for internal use, so you know the difference between addresses. In TRAEDE we use Primary address for invoice address, and Shipping address for delivery address. But you can use whatever you want
namestringYesThis is the name of the receiver on the address. So this is the "top line" in the address. For B2B customers this is typically the name of the company, and for B2C customers this is typically the name of the receiver
addressstringYesThis the the address line
address_2stringAn optional extra line for the address
zipstringYesZip code
citystringYesCity
regionstringState, region, etc
countrystringYesCountry code must be a 2-letter code like DK, US, GB

Example

POST /production/customers/sync

{
"customers": [
{
"customer_number": "1000",
"name": "A customer",
"currency": "USD",
"payment_term": {
"payment_term_code": "30-days"
}
}
]
}