Zoey REST API reference ยท Interactive version: apidocs.zoey.com

Accounts

Get All

GET https://container-url.zoeysite.com/api/rest/companyAccounts/list

Query parameters:

NameExampleNotes
limit1Limit the response.
page2Paginate the response.
filters[updated_at][gt]2021-07-30Updated At Filter
filters[status][eq]0Is Active Filter.
filters{"updated_at":{"gt":"2021-07-30"}}Filters as json

Count

GET https://container-url.zoeysite.com/api/rest/companyAccounts/count?filters[updated_at][gt]=2022-01-31&filters[status][eq]=0

Count all accounts.

Query parameters:

NameExampleNotes
filters[updated_at][gt]2022-01-31Updated At filter.
filters[status][eq]0Is Active filter.

Get

GET https://container-url.zoeysite.com/api/rest/companyAccounts/account/?id=1

Query parameters:

NameExampleNotes
id1ID of account to fetch info. ( Required )

Ordered Items

GET https://container-url.zoeysite.com/api/rest/companyAccounts/account/:account_id/ordered-items?limit=1&page=2&filter[0][attribute]=created_at&filter[0][lt]=2022-01-31

Query parameters:

NameExampleNotes
limit1Limit the response.
page2Paginate the response.
filter[0][attribute]created_atFilter the response.
filter[0][lt]2022-01-31

Create

POST https://container-url.zoeysite.com/api/rest/companyAccounts/account/

    /** JavaScript Post Data Example **/
    const accountName = "Test Account6"; // needs to be different every time you post.
    const locationId = "_tempLocationId1";
    const locationName = "Test Account";
    const customerId = "586"; // Customer ID
    const customerRoleId = "466"; // Role ID
    const address = {
        "address_type": "billing,shipping",
        "firstname": "John",
        "lastname": "Doe",
        "street": [ "1234 Park Ave" ],
        "city": "New York",
        "region": "New York",
        "region_id": "43",
        "postcode": "12345",
        "country_id": "US",
        "telephone": "1234567890",
        "location_ids": [ locationId ]
    }
    const customer = {
        "customer_id": customerId,
        "is_main_contact": 1,
        "role_id": customerRoleId,
        // customer_data is optional
        "customer_data": {
            "firstname": "first",
            "lastname": "last"
        }
    }
    const location = {
        "id": locationId,
        "name": locationName,
        "status": 1,
        "enable_all_shipping_methods": 1,
        "enable_all_payment_methods": 1,
        "enable_all_invoice_payment_methods": 1,
        "payment_methods": [],
        "customers": [ customer ]
    };
    const netterms = {
        "enabled": "1",
        "term": "net30",
        "credit": "1500",
        "detail": "[store_name] has offered [customer_name] payment terms of [term_name]. Payment is due within [term_period] days for this order"
    }
    const postData = {
        "companyData": {
            "name": accountName,
            "external_id": "TEST 123",
            "enable_all_shipping_methods": 1,
            "enable_all_payment_methods": 1,
            "enable_all_invoice_payment_methods": 1,
            "status": 1,
            "addresses": [ address ],
            "customers": [ customer ],
            "locations": [ location ],
            "netterm": netterm,
            "customer_email_receive_as_cc_setting": 0,
            "customer_email_receive_own_setting": 1,
            "customer_email_setting": 1,
            "customer_manage_address_setting": 1,
            "customer_manage_customer_setting": 1,
            "customer_manage_location_setting": 1,
        }
    }
    console.log(JSON.stringify(postData));

Example request body:

{
    "companyData": {
        "name": "New Account Name",
        "external_id": "TEST 123",
        "enable_all_shipping_methods": 1,
        "enable_all_payment_methods": 1,
        "enable_all_invoice_payment_methods": 1,
        "status": 1,
        "addresses": [
            {
                "address_type": "billing,shipping",
                "firstname": "John",
                "lastname": "Doe",
                "street": [
                    "1234 Park Ave"
                ],
                "city": "New York",
                "region": "New York",
                "region_id": "43",
                "postcode": "12345",
                "country_id": "US",
                "telephone": "1234567890",
                "location_ids": [
                    "_tempLocationId1"
                ]
            }
        ],
        "customers": [
            {
                "customer_id": "4",
                "is_main_contact": 1,
                "role_id": "6"
            }
        ],
        "locations": [
            {
                "id": "_tempLocationId1",
                "name": "New Account Location Name",
                "status": 1,
                "enable_all_shipping_methods": 1,
                "enable_all_payment_methods": 1,
                "enable_all_invoice_payment_methods": 1,
                "payment_methods": [],
                "netterm": [],
                "storecredit": [],
                "customers": [
                    {
                        "customer_id": "4",
                        "is_main_contact": 1,
                        "role_id": "6"
                    }
                ]
            }
        ],
        "netterm": {
            "enabled": "1",
            "term": "net30",
            "credit": "1500",
            "detail": "[store_name] has offered [customer_name] payment terms of [term_name]. Payment is due within [term_period] days for this order"
        },
        "customer_email_receive_as_cc_setting": 0,
        "customer_email_receive_own_setting": 1,
        "customer_email_setting": 1,
        "customer_manage_address_setting": 1,
        "customer_manage_customer_setting": 1,
        "customer_manage_location_setting": 1
    }
}

Example response (Create), HTTP 200:

{
    "company_id": "2"
}

Example response (Location Address), HTTP 200:

{
    "company_id": "21"
}

Update

PUT https://container-url.zoeysite.com/api/rest/companyAccounts/account/

Param Type Description
companyId string ID for the company being updated. ( You can provide a non-numeric id for reference when creating a new layout. )
companyData CompanyData Data being updated.

CompanyData

Data to update set on an account.

Param Type Description
name string Name of the company.
status int 0 for inactive, or 1 for active.
new_customer_group_id string Customer Group ID. This customer group will be assigned to new customers added to this account by the Account Owner.
sales_rep_user_ids array List of Sales Rep User IDs.
customer_manage_customer_setting int Allow Owner to Add Customers. 0 or 1
customer_manage_location_setting int Allow Owner to Manage Locations. 0 or 1
customer_manage_address_setting int Allow Owner to Manage Addresses. 0 or 1
addresses array List of address objects described below. This will replace all address data.
address_updates array List of address objects described below. This will update provided address data.
locations array List of location objects described below. This will replace all location data.
location_updates array List of location objects described below. This will update provided location data.
payment_methods array List of payment methods allowed by this account. This will replace all payment method data.
shipping_methods array List of shipping methods allowed by this account. This will replace all shipping method data.
netterm object Used to configure netterm for the account. netterm object described below.
enable_all_shipping_methods int Should allow all shipping methods. 0 or 1
enable_all_payment_methods int Should allow all payment methods. 0 or 1
enable_all_invoice_payment_methods int Should allow all payment methods for invoicing. 0 or 1
storecredit StoreCreditData Store Credit config defined below
tax_class_id int null

Location

location Type Description
location.id string ID of the location being updated.
location.name string Name of the location.
location.status string Enable/Disable the location. 0 or 1
location.customers string This will replace all customers.
location.customer_updates array List of customer_update objects used to remove customer.
location.payment_methods array List of payment methods allowed by this location. This will replace all payment method data.
location.payment_method_updates array List of payment_method_update objects used to remove payment method.
location.shipping_methods array List of shipping methods allowed by this location. This will replace all shipping method data.
location.shipping_method_updates array List of shipping_method_update objects used to remove shipping method.
location.is_default_location number 1 or 0. Set to 1 if you want to make this the default location.

Customer Update

customer_update Type Description
customer_update.customer_id string Used to look up the customer to edit. Isn't required if using customer_email
customer_update.customer_email string Used to look up the customer to edit. Isn't required if using customer_id
customer_update.is_deleted number Remove customer. 1 or 0
customer_update.role_id string ID of the role. Isn't required if using role_label
customer_update.role_label string Label of the role. Isn't requied if using role_id
customer_update.is_main number Set customer as a Main Contact. 1 or 0
customer_update.is_default_main number Set customer as a default Main Contact. 1 or 0
customer_update.customer_data object Optional. Set customer attribute data such as firstname.

Shipping Method Update

shipping_method_update Type Description
shipping_method_update.method string Used to look up the method to delete.
shipping_method_update.is_deleted string Delete the shipping method. 1 or 0

Payment Method Update

payment_method_update Type Description
payment_method_update.method string Used to look up the method to delete.
payment_method_update.is_deleted string Delete the payment method. 1 or 0

Invoice Payment Method Update

invoice_payment_method_update Type Description
invoice_payment_method_update.method string Used to look up the method to delete.
invoice_payment_method_update.is_deleted string Delete the payment method. 1 or 0

Address

address Type Description
address.id string Used to look up the address.
address.location_ids string[] Used to connect address to a location. Not required for billing address.
address.address_type string billing, shipping, or billing,shipping
address.email string email
address.prefix string Name prefix. (Mrs., Mr.)
address.firstname string First name.
address.middlename string Middle name.
address.lastname string Last name.
address.suffix string Name suffix. (Sr., Jr.)
address.company string Address company.
address.street string Address street. Separate lines using \n.
address.city string Address city.
address.region string Address region. Only used if country doesn't support region_id.
address.region_id string Address region. Only used if supported by the country.
address.postcode string Postal or zipcode.
address.country_id string Country ID. (US, UK)
address.vat_id string VAT ID.
address.telephone string Telephone.
address.fax string Fax number.
address.zoey_shipping_type number Set to 1 for "Residential", set to 0 for "Commercial"
address.is_default_shipping_address number 1 or 0. Set to 1 if you want to make this the default shipping address. Must match the address_type.
address.is_default_billing_address number 1 or 0. Set to 1 if you want to make this the default billing address. Must match the address_type.

Address Update

address_update Type Description
address_update.address_id string Used to look up the address to delete.
address_update.is_deleted string Delete the shipping method. 1 or 0

Net Term

netterm Type Description
netterm.enabled string Enable/Disable netterms for this account 0 or 1
netterm.term string One of the following. net10, net15, net20, net30, net45, net60, net90, net120, net_xy
netterm.credit number The amount of credit being applied to the account term.
netterm.detail number Descriptive paragraph about the term details.
netterm.xy_days number Term days when term is set to net_xy.
netterm.xy_discount_days number Discount Within (days) when term is set to net_xy.
netterm.xy_discount_amount number Discount Amount (%) when term is set to net_xy.
netterm.xy_late_fee number Late Fee (%) when term is set to net_xy.

StoreCreditData

storecredit Type Description
storecredit.is_enabled string Enable/Disable storecredit for this account 0 or 1
storecredit.send_email string Send email after updating balanace. 0 or 1
storecredit.balance number The new credit set to the account.
storecredit.comment string A comment added to the store credit balance history.

Example request body:

{
    "companyId": "4",
    "companyData" : {
        "name": "New Company Name",
        "status": "1",
        "type": "0", // (0 - Account, 1 - Opportunity, 2 - Lead)
        "new_customer_group_id": "1",
        "sales_rep_user_ids": ["13058631632732613440", "10932762742589794610"],
        "customer_manage_customer_setting": "1",
        "customer_manage_location_setting": "1",
        "customer_manage_address_setting": "1",
        "shipping_methods": [ "flatrate_flatrate" ],
        "payment_methods": [ "checkmo", "purchaseorder" ],
        "invoice_payment_methods": [ "authorizenet" ],
        "netterm": {
            "enabled": "1",
            "term": "net10",
            "credit": 10000,
            "detail": "[store_name] has offered [customer_name] payment terms of [term_name]. Payment is due within [term_period] days for this order, after-which interest may be due. Invoices may be paid via Check, Wire Transfer, Cache or Credit Card by call customer support at [store_phone]."
        },
        "enable_all_shipping_methods": "1",
        "enable_all_payment_methods": "1",
        "enable_all_invoice_payment_methods": "1"
    }
}