AccountingSuite API (preview) is designed to enable industry-standard integration capabilities. The API is organized around RESTful principles. JSON is used for request and response data transfer, including errors.

API endpoint: https://api.accountingsuite.com

You can use the shared demo database for experimenting with the API, that can be accessed at login.accountingsuite.com (e-mail: apidemo@demo.com, password: demo). However, we recommend to sign up for your individual database at login.accountingsuite.com.

Examples in the documentation are given (and tested) using CURL, which is included in Mac OS X, and can be downloaded for Windows from here. The other nice client that can be used for testing is the apigee web console.

You can get support for the API (knowledge base, tickets, and live chat) at accountingsuite.com/support.

Register your application

The first step in connecting your application with AccountingSuite is registering it. To do this make a request submitting appname, redirect_uri, and apisecretkey of your developer account (Settings / Development / apisecretkey), for example:

curl https://oauth.accountingsuite.com/register_app \
-d '{"appname": "Rapid CRM","redirect_uri": "https://dev.company_name.com/accountingsuite_oauth", "apisecretkey": "dGmlayoUnlNcitybVTMu"}'

You will receive back your client_id (application ID), for example:

{"client_id": "O4JaqvBTe2YKhh3iOX2z"}

Send your users to AccountingSuite

Add a Connect with AccountingSuite button to your application to link your users to our endpoint:

https://oauth.accountingsuite.com/authorize?response_type=code&client_id=O4JaqvBTe2YKhh3iOX2z&state=12345

The state parameter is an arbitrary string we will pass back to you, useful for CSRF protection.

If a user already has an AccountingSuite account, they'll be able to give you secure access in just a few clicks. After the user connects, we'll redirect them back to the redirect_uri your provided:

HTTP/1.1 302 Found
Location: https://redirect_uri?code=AUTHORIZATION_CODE&state=12345

Or, if the authorization was denied, we'll include an error instead:

HTTP/1.1 302 Found
Location: https://redirect_uri?error=access_denied&state=12345

After the user has connected

Using the code parameter we sent back to your redirect_uri endpoint, you should make a POST request to our oauth_token endpoint:

curl -X POST https://oauth.accountingsuite.com/oauth_token \
  -d client_secret=dGmlayoUnlNcitybVTMu \
  -d client_id=O4JaqvBTe2YKhh3iOX2z \
  -d code=knbujs4awcvux04qmf7z \
  -d grant_type=authorization_code

client_secret parameter in the request is the apisecretkey of your developer account.

AccountingSuite will return apisecretkey of the client instance that you can use for all API communications. You're done!

{
  "token_type": "bearer",
  "access_token": ACCESS_TOKEN
}
{
  "error": "invalid_grant",
  "error_description": "Authorization code does not exist: AUTHORIZATION_CODE"
}

Sometimes, you just need an apisecretkey to your own account, without going through the hassle of creating an entire OAuth flow. We hear ya. You can just grab the apisecretkey in Settings / Development.

The authentication mechanism supports access of one user name (e-mail address) to multiple databases, for example, if one user performs accounting for multiple entities, of for an external accountant whose multiple clients use AccountingSuite. In this case the API will return an array of authentication information, and an external application using the API is expected to display a choice of databases to the user.

The apisecretkey is then sent in the HTTP header for all communications with the API, for example:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu"

Alternatively you can use the Authorization: Bearer apisecretkey header, for example:

curl -H "Authorization: Bearer dGmlayoUnlNcitybVTMu"

In AccountingSuite a company can be either a customer, a vendor, or both.


Attributes:

"api_code"

Required. Unique identifier of a company used for addressing companies in the API. Assigned automatically by AccountingSuite when a new company is created.

"company_name"

Required. Name of the company, max 150 characters.

"company_code"

This 5-character alphanumeric code (by default is a string formatted consecutive number, for example, "00014", "00015") is automatically generated by AccountingSuite when a new company is created.

"company_type"

Optional. Company type: "customer", "vendor", or "customer+vendor". If no company type is given, then it defaults to a customer.

"website"

Optional. Company's website, max 200 characters.

"price_level"

Optional. Price level, max 25 characters.

"notes"

Optional. Notes.

"cf1_string"

Optional. String custom field 1, max 100 characters.

"cf1_num"

Optional. Number custom field 1.

"cf2_string"

Optional. String custom field 2, max 100 characters.

"cf2_num"

Optional. Number custom field 2.

"cf3_string"

Optional. String custom field 3, max 100 characters.

"cf3_num"

Optional. Number custom field 3.

"cf4_string"

Optional. String custom field 4, max 100 characters.

"cf4_num"

Optional. Number custom field 4.

"cf5_string"

Optional. String custom field 5, max 100 characters.

"cf5_num"

Optional. Number custom field 5.

"lines": {"addresses": []}

Optional. Array of addresses / contacts, one company can have multiple addresses / contacts, each company has to have exactly one default shipping address, and exactly one default billing address.

"api_code"

Required. Unique identifier of an address used for addressing addresses in the API. Assigned automatically by AccountingSuite when a new address is created.

"address_id"

Required. Address or contact label, for example "SFO warehouse", or "sales order confirm", max 25 characters.

"first_name"

Optional. First name.

"middle_name"

Optional. Middle name.

"last_name"

Optional. Last name.

"address_line1"

Optional. Address line 1.

"address_line2"

Optional. Address line 2.

"city"

Optional. City.

"state"

Optional. State, a two character abbreviation of US states is accepted (for example, "CA", "CT").

"zip"

Optional. ZIP code.

"country"

Optional. Country, a two letter abbreviation is accepted (http://en.wikipedia.org/wiki/ISO_3166-1).

"phone"

Optional. Phone number.

"cell"

Optional. Cell number.

"email"

Optional. E-mail address.

"sales_tax_code"

Optional. Sales tax code, max 25 characters.

"notes"

Optional. Notes.

"default_shipping"

Optional. Indication if the address is a default shipping address. A company has to have exactly one default shipping address. Whenever an address is set to be the default shipping address, the previous default shipping will be changed to false.

"default_billing"

Optional. Indication if the address is a default billing address. A company has to have exactly one default billing address. Whenever an address is set to be the default billing address, the previous default shipping will be changed to false.


Creating a new Company

Definition:

POST https://api.accountingsuite.com/companies

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-d '{"company_name": "SF Bay Distribution","company_type": "customer","lines": {"addresses": [{"address_id": "SFO warehouse","first_name": "John","last_name": "Sheldon","default_billing": true,"default_shipping": true},{"address_id": "order confirm","first_name": "Jennifer","last_name": "Aniston"}]}}' \
https://api.accountingsuite.com/companies

Example response:

{
  "lines": {
    "addresses": [
      {
        "address_id": "order confirm",
        "address_line1": "",
        "address_line2": "",
        "phone": "",
        "last_name": "Aniston",
        "country": "",
        "cell": "",
        "default_shipping": "false",
        "zip": "",
        "sales_tax_code": "",
        "notes": "",
        "first_name": "Jennifer",
        "middle_name": "",
        "default_billing": "false",
        "email": "",
        "city": "",
        "address_code": "00049",
        "api_code": "82f93fd7-7705-11e3-8058-e3003205b13a",
        "state": ""
      },
      {
        "address_id": "SFO warehouse",
        "address_line1": "",
        "address_line2": "",
        "phone": "",
        "last_name": "Sheldon",
        "country": "",
        "cell": "",
        "default_shipping": "true",
        "zip": "",
        "sales_tax_code": "",
        "notes": "",
        "first_name": "John",
        "middle_name": "",
        "default_billing": "true",
        "email": "",
        "city": "",
        "address_code": "00048",
        "api_code": "82f93fd6-7705-11e3-8058-e3003205b13a",
        "state": ""
      }
    ]
  },
  "company_code": "00031",
  "cf5_string": "",
  "website": "",
  "cf1_num": 0,
  "cf2_string": "",
  "cf5_num": 0,
  "company_name": "SF Bay Distribution",
  "cf2_num": 0,
  "notes": "",
  "company_type": "customer",
  "price_level": "",
  "cf3_string": "",
  "cf3_num": 0,
  "cf4_string": "",
  "api_code": "82f93fd5-7705-11e3-8058-e3003205b13a",
  "cf1_string": "",
  "cf4_num": 0
}

Retrieving a Company

Definition:

GET https://api.accountingsuite.com/companies/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
https://api.accountingsuite.com/companies/82f93fd5-7705-11e3-8058-e3003205b13a

Example response:

The response will be the same as the "Creating a new Company" response.


Updating a Company

Definition:

PUT https://api.accountingsuite.com/companies/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X PUT \
-d '{"company_name": "SF Bay Logistics"}' \
https://api.accountingsuite.com/companies/82f93fd5-7705-11e3-8058-e3003205b13a

Example response:

The response will be the same as the "Creating a new Company" response.


Deleting a Company

Definition:

DELETE https://api.accountingsuite.com/companies/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X DELETE \
https://api.accountingsuite.com/companies/8962abd4-7805-11e3-8058-e3003205b13a

Example response:

{
  "message": "Burger King has been deleted.",
  "status": "success"
}

List Companies

Definition:

GET https://api.accountingsuite.com/companies

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
https://api.accountingsuite.com/companies

Example response: *has been updated to be sorted by the company_name

{
    "companies": [
    {
      "lines": {
        "addresses": [
          {
            "address_id": "primary",
            "address_line1": "",
            "address_line2": "",
            "phone": "",
            "last_name": "Aldo",
            "country": "",
            "cell": "",
            "default_shipping": "true",
            "zip": "",
            "sales_tax_code": "",
            "notes": "",
            "first_name": "Jane",
            "middle_name": "",
            "default_billing": "true",
            "email": "",
            "city": "",
            "address_code": "00012",
            "api_code": "63182480-400d-11e3-827d-af4343366b37",
            "state": ""
          }
        ]
      },
      "company_code": "00009",
      "cf5_string": "",
      "website": "",
      "cf1_num": 0,
      "cf2_string": "",
      "cf5_num": 0,
      "company_name": "LA times",
      "cf2_num": 0,
      "notes": "",
      "company_type": "customer+vendor",
      "price_level": "",
      "cf3_string": "",
      "cf3_num": 0,
      "cf4_string": "",
      "api_code": "6318247f-400d-11e3-827d-af4343366b37",
      "cf1_string": "",
      "cf4_num": 0
    },
    {
      "lines": {
        "addresses": [
          {
            "address_id": "order confirm",
            "address_line1": "",
            "address_line2": "",
            "phone": "",
            "last_name": "Aniston",
            "country": "",
            "cell": "",
            "default_shipping": "false",
            "zip": "",
            "sales_tax_code": "",
            "notes": "",
            "first_name": "Jennifer",
            "middle_name": "",
            "default_billing": "false",
            "email": "",
            "city": "",
            "address_code": "00049",
            "api_code": "82f93fd7-7705-11e3-8058-e3003205b13a",
            "state": ""
          },
          {
            "address_id": "SFO warehouse",
            "address_line1": "",
            "address_line2": "",
            "phone": "",
            "last_name": "Sheldon",
            "country": "",
            "cell": "",
            "default_shipping": "true",
            "zip": "",
            "sales_tax_code": "",
            "notes": "",
            "first_name": "John",
            "middle_name": "",
            "default_billing": "true",
            "email": "",
            "city": "",
            "address_code": "00048",
            "api_code": "82f93fd6-7705-11e3-8058-e3003205b13a",
            "state": ""
          }
        ]
      },
      "company_code": "00031",
      "cf5_string": "",
      "website": "",
      "cf1_num": 0,
      "cf2_string": "",
      "cf5_num": 0,
      "company_name": "SF Bay Logistics",
      "cf2_num": 0,
      "notes": "",
      "company_type": "customer",
      "price_level": "",
      "cf3_string": "",
      "cf3_num": 0,
      "cf4_string": "",
      "api_code": "82f93fd5-7705-11e3-8058-e3003205b13a",
      "cf1_string": "",
      "cf4_num": 0
    },
    {
      "lines": {
        "addresses": [
          {
            "address_id": "Primary",
            "address_line1": "",
            "address_line2": "",
            "phone": "",
            "last_name": "",
            "country": "",
            "cell": "",
            "default_shipping": "false",
            "zip": "",
            "sales_tax_code": "",
            "notes": "",
            "first_name": "",
            "middle_name": "",
            "default_billing": "false",
            "email": "",
            "city": "",
            "address_code": "00011",
            "api_code": "98b27cca-2d2c-11e3-827d-af4343366b37",
            "state": ""
          }
        ]
      },
      "company_code": "00008",
      "cf5_string": "",
      "website": "",
      "cf1_num": 0,
      "cf2_string": "",
      "cf5_num": 0,
      "company_name": "SoCal distributor",
      "cf2_num": 0,
      "notes": "",
      "company_type": "customer",
      "price_level": "",
      "cf3_string": "",
      "cf3_num": 0,
      "cf4_string": "",
      "api_code": "98b27cc9-2d2c-11e3-827d-af4343366b37",
      "cf1_string": "",
      "cf4_num": 0
    }
  ]
}

In AccountingSuite items are products and services that are sold or bought.


Attributes

"api_code"

Required. Unique identifier of an item used for addressing items in the API. Assigned automatically by AccountingSuite when a new item is created.

"item_code"

Required. An item code, max 50 characters.

"item_description"

Required. An item description, max 150 characters.

"item_type"

Optional. Either "product" or "service". For the "product" type AccountingSuite will track inventory balances, and won't allow creating a transaction if there is no sufficient inventory balances. The "service" type is used for services, or for inventory items that do not require balance or cost of good sold tracking. If no item type is given, it will default to a service.

"item_category"

Optional. An item category, max 25 characters.

"unit_of_measure"

Optional. An item unit of measure, max 25 characters.

"cf1_string"

Optional. String custom field 1, max 100 characters.

"cf1_num"

Optional. Number custom field 1.

"cf2_string"

Optional. String custom field 2, max 100 characters.

"cf2_num"

Optional. Number custom field 2.

"cf3_string"

Optional. String custom field 3, max 100 characters.

"cf3_num"

Optional. Number custom field 3.

"cf4_string"

Optional. String custom field 4, max 100 characters.

"cf4_num"

Optional. Number custom field 4.

"cf5_string"

Optional. String custom field 5, max 100 characters.

"cf5_num"

Optional. Number custom field 5.


Creating a new Item

Definition:

POST https://api.accountingsuite.com/items

Example requests:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-d '{"item_code":"FrigidaireDF288","item_description":"Frigidaire DF288 air conditioner","item_type":"product"}' \
https://api.accountingsuite.com/items
curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-d '{"item_code": "shipping international","item_description": "shipping fee","item_type": "service","unit_of_measure": "each"}' \
https://api.accountingsuite.com/items

Example responses:

{
  "cf5_string": "",
  "costing_method": "weighted_average",
  "cf1_num": 0,
  "cf2_string": "",
  "cf5_num": 0,
  "category": "",
  "item_price": 0,
  "cf2_num": 0,
  "cogs_account": "5000",
  "cf3_string": "",
  "unit_of_measure": "",
  "item_code": "FrigidaireDF288",
  "inventory_or_expense_account": "1300",
  "cf3_num": 0,
  "item_type": "product",
  "income_account": "4000",
  "item_description": "Frigidaire DF288 air conditioner",
  "cf4_string": "",
  "price_levels": [],
  "api_code": "298924c5-7709-11e3-8058-e3003205b13a",
  "cf1_string": "",
  "cf4_num": 0
}
{
  "cf5_string": "",
  "cf1_num": 0,
  "cf2_string": "",
  "cf5_num": 0,
  "category": "",
  "item_price": 0,
  "cf2_num": 0,
  "cogs_account": "",
  "cf3_string": "",
  "unit_of_measure": "each",
  "item_code": "shipping international",
  "inventory_or_expense_account": "6000",
  "cf3_num": 0,
  "item_type": "service",
  "income_account": "4000",
  "item_description": "shipping fee",
  "cf4_string": "",
  "price_levels": [],
  "api_code": "068a71d5-770a-11e3-8058-e3003205b13a",
  "cf1_string": "",
  "cf4_num": 0
}

Retrieving an Item

Definition:

GET https://api.accountingsuite.com/items/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
https://api.accountingsuite.com/items/298924c5-7709-11e3-8058-e3003205b13a

Example response:

The response will be the same as the "Creating a new Item" response.


Updating an Item

Definition

PUT https://api.accountingsuite.com/items/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X PUT \
-d '{"item_code": "FrigidaireDF288 AC","item_description": "Frigidaire DF288 AC 200W"}' \
https://api.accountingsuite.com/items/298924c5-7709-11e3-8058-e3003205b13a

Example response:

The response will be the same as the "Creating a new Item" response.


Deleting an Item

Definition:

DELETE https://api.accountingsuite.com/items/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X DELETE \
https://api.accountingsuite.com/items/fed273f4-7805-11e3-8058-e3003205b13a

Example response:

{
  "message": "Galaxy S6 has been deleted.",
  "status": "success"
}

List Items

Definition:

GET https://api.accountingsuite.com/items

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
https://api.accountingsuite.com/items

Example response: *has been updated to be sorted by the item_code

{
    "items": [
      {
      "cf5_string": "",
      "costing_method": "weighted_average",
      "cf1_num": 0,
      "cf2_string": "",
      "cf5_num": 0,
      "category": "",
      "item_price": 0,
      "cf2_num": 0,
      "cogs_account": "5000",
      "cf3_string": "",
      "unit_of_measure": "",
      "item_code": "FrigidaireDF288 AC",
      "inventory_or_expense_account": "1300",
      "cf3_num": 0,
      "item_type": "product",
      "income_account": "4000",
      "item_description": "Frigidaire DF288 AC 200W",
      "cf4_string": "",
      "price_levels": [],
      "api_code": "298924c5-7709-11e3-8058-e3003205b13a",
      "cf1_string": "",
      "cf4_num": 0
    },
    {
      "cf5_string": "",
      "cf1_num": 0,
      "cf2_string": "",
      "cf5_num": 0,
      "category": "",
      "item_price": 0,
      "cf2_num": 0,
      "cogs_account": "",
      "cf3_string": "",
      "unit_of_measure": "each",
      "item_code": "shipping international",
      "inventory_or_expense_account": "6000",
      "cf3_num": 0,
      "item_type": "service",
      "income_account": "4000",
      "item_description": "shipping fee",
      "cf4_string": "",
      "price_levels": [],
      "api_code": "068a71d5-770a-11e3-8058-e3003205b13a",
      "cf1_string": "",
      "cf4_num": 0
    },
    {
      "cf5_string": "",
      "cf1_num": 0,
      "cf2_string": "",
      "cf5_num": 0,
      "category": "",
      "item_price": 0,
      "cf2_num": 0,
      "cogs_account": "",
      "cf3_string": "",
      "unit_of_measure": "",
      "item_code": "impl. consulting",
      "inventory_or_expense_account": "6000",
      "cf3_num": 0,
      "item_type": "service",
      "income_account": "4000",
      "item_description": "RMP implementation",
      "cf4_string": "",
      "price_levels": [],
      "api_code": "cf0298bf-400c-11e3-827d-af4343366b37",
      "cf1_string": "",
      "cf4_num": 0
    }
    ]
}

In AccountingSuite a Cash Sale is a sales document that records receiving a payment from a customer (any payment form - check, credit card, cash, etc.), shipping of goods, and/or performing services. A business case for using this AccountingSuite API object, is, for example, a notification from an e-commerce system that a sale was recorded and the shipment needs to be made.


Attributes

"api_code"

Required. Unique identifier of a cash sale used for addressing cash sales in the API. Assigned automatically by AccountingSuite when a new cash sale is created.

"customer_api_code"

Required. A customer api_code.

"ship_to_api_code"

Required. A customer's ship to address api_code.

"cash_sale_number"

This 6-character alphanumeric number (by default is a string formatted consecutive number, for example, "000021", "000022") is automatically generated by AccountingSuite when a new cash sale is created.

"date"

Required. Document date, a date is accepted in the "yyyy-mm-dd" format.

"ref_num"

Optional. External transaction number, for example a number in the e-commerce system.

"memo"

Optional. Transaction memo.

"sales_tax_total"

Optional. Total amount of sales tax in the transaction.

"doc_total"

Required. Total amount of the transaction.

"line_subtotal"

Optional. Sum of line totals.

"discount"

Optional. Discount amount.

"discount_percent"

Optional. Discount percentage for the transaction.

"subtotal"

Optional. Total amount after discounts.

"shipping"

Optional. Cost of shipping.

"lines": {"line_items": []}"

Required. Transaction line items.

"api_code"

Required. Item api_code.

"price"

Required. Item price.

"quantity"

Required. Item quantity.

"line_total"

Required. Line total.


Creating a new Cash Sale

Definition:

POST https://api.accountingsuite.com/cashsales

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-d '{"customer_api_code": "01c386d3-515a-11e3-8058-e3003205b13a","ship_to_api_code": "01c386d4-515a-11e3-8058-e3003205b13a","date":"2013-05-24", "ref_num":"trx0023487", "memo":"magento_sale","doc_total":900, "lines": {"line_items": [{"api_code": "cf02f093-2861-11e3-b6b3-c6f64a6bdc57","price": 350,"quantity": 2,"line_total": 700},{"api_code": "f88c86a3-2862-11e3-b6b3-c6f64a6bdc57","price": 200,"quantity": 1,"line_total": 200}]}}' \
https://api.accountingsuite.com/cashsales

Note: The API creates a cash sale draft that needs to be approved (posted) manually in AccountingSuite.

Example response:

{
  "lines": {
    "line_items": [
      {
        "price": 350,
        "item_description": "Frigidaire DF28 air conditioner",
        "quantity": 2,
        "api_code": "cf02f093-2861-11e3-b6b3-c6f64a6bdc57",
        "line_total": 700,
        "item_code": "FrigidaireDF28"
      },
      {
        "price": 200,
        "item_description": "abc5x",
        "quantity": 1,
        "api_code": "f88c86a3-2862-11e3-b6b3-c6f64a6bdc57",
        "line_total": 200,
        "item_code": "abc5"
      }
    ]
  },
  "company_code": "00014",
  "doc_total": 900,
  "memo": "magento_sale",
  "date": "2013-05-24",
  "sales_tax_total": 0,
  "payment_method": "Cash",
  "customer_api_code": "01c386d3-515a-11e3-8058-e3003205b13a",
  "company_name": "West Coast Logistics",
  "ship_to_address_code": "00022",
  "ship_to_address_id": "SFO warehouse",
  "ref_num": "trx0023487",
  "ship_to_api_code": "01c386d4-515a-11e3-8058-e3003205b13a",
  "cash_sale_number": "000011",
  "api_code": "b0aae594-77d3-11e3-8058-e3003205b13a"
}

Retrieving a Cash Sale

Definition:

GET https://api.accountingsuite.com/cashsales/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
https://api.accountingsuite.com/cashsales/b0aae594-77d3-11e3-8058-e3003205b13a

Example response:

The response will be the same as the "Creating a new Cash Sale" response.


Updating a Cash Sale

Definition:

PUT https://api.accountingsuite.com/cashsales/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X PUT \
-d '{"customer_api_code": "01c386d3-515a-11e3-8058-e3003205b13a","ship_to_api_code": "01c386d4-515a-11e3-8058-e3003205b13a","date":"2014-01-24", "ref_num":"trx0023487", "memo":"magento_sale","doc_total":880, "lines": {"line_items": [{"api_code": "cf02f093-2861-11e3-b6b3-c6f64a6bdc57","price": 340,"quantity": 2,"line_total": 680},{"api_code": "f88c86a3-2862-11e3-b6b3-c6f64a6bdc57","price": 200,"quantity": 1,"line_total": 200}]}}' \
https://api.accountingsuite.com/cashsales/b0aae594-77d3-11e3-8058-e3003205b13a

Example response:

The response will be the same as the "Creating a new Cash Sale" response.


Deleting a Cash Sale

Definition:

DELETE https://api.accountingsuite.com/cashsales/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X DELETE \
https://api.accountingsuite.com/cashsales/b0aae594-77d3-11e3-8058-e3003205b13a

Example response:

{
  "message": "Cash Sale # 000011 from 1\/24\/2014 12:00:00 AM has been deleted.",
  "status": "success"
}

List Cash Sales

Definition:

GET https://api.accountingsuite.com/cashsales

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
https://api.accountingsuite.com/cashsales

Example response: *has been updated to be sorted by the date

{
    "cash_sales": [
        {
            "company_code": "00006",
            "doc_total": 2200,
            "memo": "magento_sale",
            "date": "2013-04-22",
            "sales_tax_total": 0,
            "payment_method": "Cash",
            "ref_num": "trx0023487",
            "company_name": "West Coast Logistics",
            "ship_to_address_code": "00007",
            "ship_to_address_id": "order confirm",
            "cash_sale_number": "000001",
            "api_code": "13d55a73-515a-11e3-8058-e3003205b13a"
        }
    ]
}

In AccountingSuite a Sales Invoice is a sales document that records a customer liability, shipping of goods, and/or performing services. A business case for using this AccountingSuite API object, is, for example, creating an invoice that a customer needs to pay in 30 days.


Attributes

"api_code"

Required. Unique identifier of a sales invoice used for addressing sales invoices in the API. Assigned automatically by AccountingSuite when a new sales invoice is created.

"customer_api_code"

Required. A customer api_code.

"ship_to_api_code"

Required. A customer's ship to address api_code.

"sales_invoice_number"

This 6-character alphanumeric number (by default is a string formatted consecutive number, for example, "000021", "000022") is automatically generated by AccountingSuite when a new sales invoice is created.

"date"

Required. Document date, a date is accepted in the "yyyy-mm-dd" format.

"due_date"

Required. Due date, a date is accepted in the "yyyy-mm-dd" format.

"ref_num"

Optional. External transaction number, for example a number in the e-commerce system.

"memo"

Optional. Transaction memo.

"sales_tax_total"

Optional. Total amount of sales tax in the transaction.

"doc_total"

Required. Total amount of the transaction.

"line_subtotal"

Optional. Sum of line totals.

"discount"

Optional. Discount amount.

"discount_percent"

Optional. Discount percentage for the transaction.

"subtotal"

Optional. Total amount after discounts.

"shipping"

Optional. Cost of shipping.

"lines": {"line_items": []}"

Required. Transaction line items.

"api_code"

Required. Item api code.

"price"

Required. Item price.

"quantity"

Required. Item quantity.

"line_total"

Required. Line total.


Creating a new Sales Invoice

Definition:

POST https://api.accountingsuite.com/invoices

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-d '{"customer_api_code": "01c386d3-515a-11e3-8058-e3003205b13a","ship_to_api_code": "01c386d4-515a-11e3-8058-e3003205b13a","date":"2013-05-24", "due_date":"2013-05-24", "ref_num":"trx0023487", "memo":"magento_sale","doc_total":900, "lines": {"line_items": [{"api_code": "cf02f093-2861-11e3-b6b3-c6f64a6bdc57","price": 350,"quantity": 2,"line_total": 700},{"api_code": "f88c86a3-2862-11e3-b6b3-c6f64a6bdc57","price": 200,"quantity": 1,"line_total": 200}]}}' \
https://api.accountingsuite.com/invoices

Note: The API creates a sales invoice draft that needs to be approved (posted) manually in AccountingSuite.

Example response:

{
  "lines": {
    "line_items": [
      {
        "price": 350,
        "item_description": "Frigidaire DF28 air conditioner",
        "quantity": 2,
        "api_code": "cf02f093-2861-11e3-b6b3-c6f64a6bdc57",
        "line_total": 700,
        "item_code": "FrigidaireDF28"
      },
      {
        "price": 200,
        "item_description": "abc5x",
        "quantity": 1,
        "api_code": "f88c86a3-2862-11e3-b6b3-c6f64a6bdc57",
        "line_total": 200,
        "item_code": "abc5"
      }
    ]
  },
  "company_code": "00014",
  "doc_total": 900,
  "memo": "magento_sale",
  "due_date": "2013-05-24",
  "date": "2013-05-24",
  "sales_tax_total": 0,
  "customer_api_code": "01c386d3-515a-11e3-8058-e3003205b13a",
  "company_name": "West Coast Logistics",
  "invoice_number": "000004",
  "ship_to_address_id": "SFO warehouse",
  "ref_num": "trx0023487",
  "ship_to_api_code": "01c386d4-515a-11e3-8058-e3003205b13a",
  "api_code": "bfab0c24-77d6-11e3-8058-e3003205b13a"
}

Retrieving a Sales Invoice

Definition:

GET https://api.accountingsuite.com/invoices/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
https://api.accountingsuite.com/invoices/bfab0c24-77d6-11e3-8058-e3003205b13a

Example response:

The response will be the same as the "Creating a new Sales Invoice" response.


Updating a Sales Invoice

Definition:

PUT https://api.accountingsuite.com/invoices/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X PUT \
-d '{"customer_api_code": "01c386d3-515a-11e3-8058-e3003205b13a","ship_to_api_code": "01c386d4-515a-11e3-8058-e3003205b13a","date":"2014-02-24", "due_date":"2014-05-24", "ref_num":"trx0023487", "memo":"magento_sale","doc_total":1100, "lines": {"line_items": [{"api_code": "cf02f093-2861-11e3-b6b3-c6f64a6bdc57","price": 350,"quantity": 2,"line_total": 700},{"api_code": "f88c86a3-2862-11e3-b6b3-c6f64a6bdc57","price": 200,"quantity": 2,"line_total": 400}]}}' \
https://api.accountingsuite.com/invoices/bfab0c24-77d6-11e3-8058-e3003205b13a

Example response:

The response will be the same as the "Creating a new Sales Invoice" response.


Deleting a Sales Invoice

Definition:

DELETE https://api.accountingsuite.com/invoices/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X DELETE \
https://api.accountingsuite.com/invoices/1aa8d363-2863-11e3-b6b3-c6f64a6bdc57

Example response:

{
  "message": "Invoice # 000002 from 5\/24\/2013 12:00:00 AM has been deleted.",
  "status": "success"
}

List Sales Invoices

Definition:

GET https://api.accountingsuite.com/invoices

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
https://api.accountingsuite.com/invoices

Example response: *has been updated to be sorted by the date

{
    "cash_sales": [
    {
      "company_code": "00014",
      "doc_total": 900,
      "memo": "magento_sale",
      "due_date": "2013-05-24",
      "date": "2013-05-24",
      "sales_tax_total": 0,
      "company_name": "West Coast Logistics",
      "invoice_number": "000004",
      "ship_to_address_code": "00022",
      "ship_to_address_id": "SFO warehouse",
      "ref_num": "trx0023487",
      "api_code": "bfab0c24-77d6-11e3-8058-e3003205b13a"
    },
    {
      "company_code": "00007",
      "doc_total": 1100,
      "memo": "magento_sale",
      "due_date": "2013-06-24",
      "date": "2013-05-24",
      "sales_tax_total": 0,
      "company_name": "Carnival Cruises",
      "invoice_number": "000002",
      "ship_to_address_code": "00010",
      "ship_to_address_id": "order confirm",
      "ref_num": "trx0023487",
      "api_code": "1aa8d363-2863-11e3-b6b3-c6f64a6bdc57"
    }
  ]
}

In AccountingSuite a Sales Order is a contract sales document that indicates what goods and services will be shipped or provided to the customer, and the expected delivery/service date. A business case for using this AccountingSuite API object, is, for example, creating an sales order from an e-commerce system.


Attributes

"api_code"

Required. Unique identifier of a sales order used for addressing sales orders in the API. Assigned automatically by AccountingSuite when a new sales order is created.

"customer_api_code"

Required. A customer api_code.

"ship_to_api_code"

Optional. A customer's ship to address api_code.

"bill_to_api_code"

Optional. A customer's ship to address api_code.

"ship_to_address_id"

Optional. Address or contact label, for example "SFO warehouse", or "sales order confirm", max 25 characters.

"ship_to_first_name"

Optional. First name.

"ship_to_middle_name"

Optional. Middle name.

"ship_to_last_name"

Optional. Last name.

"ship_to_address_line1"

Optional. Address line 1.

"ship_to_address_line2"

Optional. Address line 2.

"ship_to_city"

Optional. City.

"ship_to_state"

Optional. State, a two character abbreviation of US states is accepted (for example, "CA", "CT").

"ship_to_zip"

Optional. ZIP code.

"ship_to_country"

Optional. Country, a two letter abbreviation is accepted (http://en.wikipedia.org/wiki/ISO_3166-1).

"ship_to_phone"

Optional. Phone number.

"ship_to_cell"

Optional. Cell number.

"ship_to_email"

Optional. E-mail address.

"ship_to_sales_tax_code"

Optional. Sales tax code, max 25 characters.

"ship_to_notes"

Optional. Notes.

"bill_to_address_id"

Optional. Address or contact label, for example "SFO warehouse", or "sales order confirm", max 25 characters.

"bill_to_first_name"

Optional. First name.

"bill_to_middle_name"

Optional. Middle name.

"bill_to_last_name"

Optional. Last name.

"bill_to_address_line1"

Optional. Address line 1.

"bill_to_address_line2"

Optional. Address line 2.

"bill_to_city"

Optional. City.

"bill_to_state"

Optional. State, a two character abbreviation of US states is accepted (for example, "CA", "CT").

"bill_to_zip"

Optional. ZIP code.

"bill_to_country"

Optional. Country, a two letter abbreviation is accepted (http://en.wikipedia.org/wiki/ISO_3166-1).

"bill_to_phone"

Optional. Phone number.

"bill_to_cell"

Optional. Cell number.

"bill_to_email"

Optional. E-mail address.

"bill_to_sales_tax_code"

Optional. Sales tax code, max 25 characters.

"bill_to_notes"

Optional. Notes.

"so_number"

This 6-character alphanumeric number (by default is a string formatted consecutive number, for example, "000021", "000022") is automatically generated by AccountingSuite when a new sales order is created.

"external_id"

Optional. For storing a record ID from an external system, ie. a CRM system.

"date"

Required. Document date, a date is accepted in the "yyyy-mm-dd" format.

"ref_num"

Optional. External transaction number, for example a number in the e-commerce system.

"memo"

Optional. Transaction memo.

"sales_tax_total"

Optional. Total amount of sales tax in the transaction.

"doc_total"

Required. Total amount of the transaction.

"line_subtotal"

Optional. Sum of line totals.

"discount"

Optional. Discount amount.

"discount_percent"

Optional. Discount percentage for the transaction.

"subtotal"

Optional. Total amount after discounts.

"shipping"

Optional. Cost of shipping.

"cf1_string"

Optional. String custom field 1, max 100 characters.

"lines": {"line_items": []}"

Required. Transaction line items.

"api_code"

Required. Item api code.

"price"

Required. Item price.

"quantity"

Required. Item quantity.

"line_total"

Required. Line total.


Creating a new Sales Order

Definition:

POST https://api.accountingsuite.com/salesorders

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-d '{"customer_api_code": "82f93fd5-7705-11e3-8058-e3003205b13a","ship_to_api_code": "82f93fd6-7705-11e3-8058-e3003205b13a", "bill_to_address_id": "LA office","bill_to_first_name": "Silvia", "bill_to_address_line1":"Alley of Stars","date":"2013-05-24", "ref_num":"trx0023487xyz", "memo":"magento_sale","doc_total":900, "lines": {"line_items": [{"api_code": "298924c5-7709-11e3-8058-e3003205b13a","price": 350,"quantity": 2,"line_total": 700},{"api_code": "068a71d5-770a-11e3-8058-e3003205b13a","price": 200,"quantity": 1,"line_total": 200}]}}' \
https://api.accountingsuite.com/salesorders

Note: The API creates a sales order draft that needs to be approved (posted) manually in AccountingSuite.

Example response:

{
  "bill_to_notes": "",
  "bill_to_country": "",
  "ship_to_state": "",
  "date": "2013-05-24",
  "doc_total": 900,
  "ship_to_zip": "",
  "ship_to_address_line1": "",
  "memo": "magento_sale",
  "ship_to_sales_tax_code": "",
  "ship_to_address_line2": "",
  "bill_to_sales_tax_code": "",
  "bill_to_address_line1": "Alley of Stars",
  "bill_to_address_line2": "",
  "bill_to_state": "",
  "bill_to_cell": "",
  "ship_to_email": "",
  "bill_to_city": "",
  "bill_to_zip": "",
  "bill_to_email": "",
  "so_number": "000014",
  "cf1_string": "",
  "ship_to_middle_name": "",
  "ship_to_first_name": "John",
  "bill_to_middle_name": "",
  "ref_num": "trx0023487xyz",
  "bill_to_first_name": "Silvia",
  "api_code": "4eafaaa6-7711-11e3-8058-e3003205b13a",
  "bill_to_api_code": "4eafaaa5-7711-11e3-8058-e3003205b13a",
  "ship_to_phone": "",
  "ship_to_cell": "",
  "line_items": [
    {
      "price": 350,
      "Product": "FrigidaireDF288 AC",
      "quantity": 2,
      "api_code": "298924c5-7709-11e3-8058-e3003205b13a",
      "line_total": 700
    },
    {
      "price": 200,
      "Product": "shipping international",
      "quantity": 1,
      "api_code": "068a71d5-770a-11e3-8058-e3003205b13a",
      "line_total": 200
    }
  ],
  "ship_to_notes": "",
  "bill_to_phone": "",
  "ship_to_country": "",
  "ship_to_address_id": "SFO warehouse",
  "ship_to_api_code": "82f93fd6-7705-11e3-8058-e3003205b13a",
  "ship_to_city": "",
  "bill_to_address_id": "LA office",
  "company": "SF Bay Logistics",
  "customer_api_code": "82f93fd5-7705-11e3-8058-e3003205b13a",
  "sales_tax_total": 0
}

Retrieving a Sales Order

Definition:

GET https://api.accountingsuite.com/salesorders/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
https://api.accountingsuite.com/salesorders/4eafaaa6-7711-11e3-8058-e3003205b13a

Example response:

The response will be the same as the "Creating a new Sales Order" response.


Updating a Sales Order

Definition:

PUT https://api.accountingsuite.com/salesorders/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X PUT \
-d '{"customer_api_code": "82f93fd5-7705-11e3-8058-e3003205b13a","ship_to_api_code": "82f93fd6-7705-11e3-8058-e3003205b13a", "bill_to_address_id": "LA office","bill_to_first_name": "Silvia", "bill_to_address_line1":"Alley of Stars","date":"2014-02-24", "ref_num":"trx0023487xyz", "memo":"magento_sale","doc_total":1250, "lines": {"line_items": [{"api_code": "298924c5-7709-11e3-8058-e3003205b13a","price": 350,"quantity": 3,"line_total": 1050},{"api_code": "068a71d5-770a-11e3-8058-e3003205b13a","price": 200,"quantity": 1,"line_total": 200}]}}' \
https://api.accountingsuite.com/salesorders/4eafaaa6-7711-11e3-8058-e3003205b13a

Example response:

The response will be the same as the "Creating a new Sales Order" response.


Deleting a Sales Order

Definition:

DELETE https://api.accountingsuite.com/salesorders/{API_CODE}

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X DELETE \
https://api.accountingsuite.com/salesorders/4eafaaa6-7711-11e3-8058-e3003205b13a

Example response:

{
  "message": "Sales Order # 000015 from 5\/30\/2015 12:00:00 AM has been deleted.",
  "status": "success"
}

List Sales Orders

Definition:

GET https://api.accountingsuite.com/salesorders

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
https://api.accountingsuite.com/salesorders

Example response: *has been updated to be sorted by the date

{
  "Sales_Orders": [
    {
      "bill_to_notes": "",
      "bill_to_country": "",
      "ship_to_state": "",
      "date": "2013-05-24",
      "doc_total": 1000,
      "ship_to_zip": "",
      "ship_to_address_line1": "First St.",
      "memo": "magento_sale",
      "ship_to_sales_tax_code": "",
      "ship_to_address_line2": "",
      "bill_to_sales_tax_code": "",
      "bill_to_address_line1": "Alley of Stars",
      "bill_to_address_line2": "",
      "bill_to_state": "",
      "bill_to_cell": "",
      "ship_to_email": "",
      "bill_to_city": "",
      "bill_to_zip": "",
      "bill_to_email": "",
      "so_number": "000004",
      "cf1_string": "",
      "ship_to_middle_name": "",
      "ship_to_first_name": "John",
      "bill_to_middle_name": "",
      "ref_num": "trx0023487xyz",
      "bill_to_first_name": "Silvia",
      "api_code": "983b6b69-52ed-11e3-8058-e3003205b13a",
      "bill_to_api_code": "05124aa1-5fac-11e3-8058-e3003205b13a",
      "ship_to_phone": "",
      "ship_to_cell": "",
      "line_items": [
        {
          "price": 350,
          "Product": "setup fee",
          "quantity": 2,
          "api_code": "f88c86a3-2862-11e3-b6b3-c6f64a6bdc57",
          "line_total": 700
        },
        {
          "price": 300,
          "Product": "api calls",
          "quantity": 1,
          "api_code": "e4f59283-2862-11e3-b6b3-c6f64a6bdc57",
          "line_total": 300
        }
      ],
      "ship_to_notes": "",
      "bill_to_phone": "",
      "ship_to_country": "",
      "ship_to_address_id": "SFO warehouse 3",
      "ship_to_api_code": "05124aa0-5fac-11e3-8058-e3003205b13a",
      "ship_to_city": "",
      "bill_to_address_id": "LA office",
      "company": "West Coast Distribution",
      "customer_api_code": "c5187cd3-2861-11e3-b6b3-c6f64a6bdc57",
      "sales_tax_total": 0
    },
    {
      "bill_to_notes": "",
      "bill_to_country": "",
      "ship_to_state": "",
      "date": "2013-05-24",
      "doc_total": 1100,
      "ship_to_zip": "",
      "ship_to_address_line1": "First St.",
      "memo": "magento_sale",
      "ship_to_sales_tax_code": "",
      "ship_to_address_line2": "",
      "bill_to_sales_tax_code": "",
      "bill_to_address_line1": "Alley of Stars",
      "bill_to_address_line2": "",
      "bill_to_state": "",
      "bill_to_cell": "",
      "ship_to_email": "",
      "bill_to_city": "",
      "bill_to_zip": "",
      "bill_to_email": "",
      "so_number": "000007",
      "cf1_string": "",
      "ship_to_middle_name": "",
      "ship_to_first_name": "John",
      "bill_to_middle_name": "",
      "ref_num": "trx0023487xyz",
      "bill_to_first_name": "Silvia",
      "api_code": "3ca9969e-669c-11e3-8058-e3003205b13a",
      "bill_to_api_code": "05124aa1-5fac-11e3-8058-e3003205b13a",
      "ship_to_phone": "",
      "ship_to_cell": "",
      "line_items": [
        {
          "price": 350,
          "Product": "setup fee",
          "quantity": 2,
          "api_code": "f88c86a3-2862-11e3-b6b3-c6f64a6bdc57",
          "line_total": 700
        },
        {
          "price": 400,
          "Product": "api calls",
          "quantity": 1,
          "api_code": "e4f59283-2862-11e3-b6b3-c6f64a6bdc57",
          "line_total": 300
        }
      ],
      "ship_to_notes": "",
      "bill_to_phone": "",
      "ship_to_country": "",
      "ship_to_address_id": "SFO warehouse 3",
      "ship_to_api_code": "05124aa0-5fac-11e3-8058-e3003205b13a",
      "ship_to_city": "",
      "bill_to_address_id": "LA office",
      "company": "West Coast Distribution",
      "customer_api_code": "c5187cd3-2861-11e3-b6b3-c6f64a6bdc57",
      "sales_tax_total": 0
    },
    {
      "bill_to_notes": "",
      "bill_to_country": "",
      "ship_to_state": "",
      "date": "2013-05-24",
      "doc_total": 1200,
      "ship_to_zip": "",
      "ship_to_address_line1": "First St.",
      "memo": "magento_sale",
      "ship_to_sales_tax_code": "",
      "ship_to_address_line2": "",
      "bill_to_sales_tax_code": "",
      "bill_to_address_line1": "Alley of Stars",
      "bill_to_address_line2": "",
      "bill_to_state": "",
      "bill_to_cell": "",
      "ship_to_email": "",
      "bill_to_city": "",
      "bill_to_zip": "",
      "bill_to_email": "",
      "so_number": "000008",
      "cf1_string": "",
      "ship_to_middle_name": "",
      "ship_to_first_name": "John",
      "bill_to_middle_name": "",
      "ref_num": "trx0023487xyz",
      "bill_to_first_name": "Silvia",
      "api_code": "0abaf2aa-68f2-11e3-8058-e3003205b13a",
      "bill_to_api_code": "05124aa1-5fac-11e3-8058-e3003205b13a",
      "ship_to_phone": "",
      "ship_to_cell": "",
      "line_items": [
        {
          "price": 350,
          "Product": "setup fee",
          "quantity": 2,
          "api_code": "f88c86a3-2862-11e3-b6b3-c6f64a6bdc57",
          "line_total": 700
        },
        {
          "price": 500,
          "Product": "api calls",
          "quantity": 1,
          "api_code": "e4f59283-2862-11e3-b6b3-c6f64a6bdc57",
          "line_total": 500
        }
      ],
      "ship_to_notes": "",
      "bill_to_phone": "",
      "ship_to_country": "",
      "ship_to_address_id": "SFO warehouse 3",
      "ship_to_api_code": "05124aa0-5fac-11e3-8058-e3003205b13a",
      "ship_to_city": "",
      "bill_to_address_id": "LA office",
      "company": "West Coast Distribution",
      "customer_api_code": "c5187cd3-2861-11e3-b6b3-c6f64a6bdc57",
      "sales_tax_total": 0
    },
    {
      "bill_to_notes": "",
      "bill_to_country": "",
      "ship_to_state": "",
      "date": "2013-11-16T12:38:13-08",
      "doc_total": 225,
      "ship_to_zip": "",
      "ship_to_address_line1": "",
      "memo": "",
      "ship_to_sales_tax_code": "",
      "ship_to_address_line2": "",
      "bill_to_sales_tax_code": "",
      "bill_to_address_line1": "",
      "bill_to_address_line2": "",
      "bill_to_state": "",
      "bill_to_cell": "",
      "ship_to_email": "",
      "bill_to_city": "",
      "bill_to_zip": "",
      "bill_to_email": "",
      "so_number": "000001",
      "cf1_string": "",
      "ship_to_middle_name": "",
      "ship_to_first_name": "John",
      "bill_to_middle_name": "",
      "ref_num": "",
      "bill_to_first_name": "",
      "api_code": "02c8fe5f-4eff-11e3-8058-e3003205b13a",
      "bill_to_api_code": "00000000-0000-0000-0000-000000000000",
      "ship_to_phone": "",
      "ship_to_cell": "",
      "line_items": [
        {
          "price": 125,
          "Product": "api calls",
          "quantity": 1,
          "api_code": "e4f59283-2862-11e3-b6b3-c6f64a6bdc57",
          "line_total": 125
        },
        {
          "price": 50,
          "Product": "ddd",
          "quantity": 2,
          "api_code": "635ed471-323a-11e3-827d-af4343366b37",
          "line_total": 100
        }
      ],
      "ship_to_notes": "",
      "bill_to_phone": "",
      "ship_to_country": "",
      "ship_to_address_id": "SFO warehouse",
      "ship_to_api_code": "63182480-400d-11e3-827d-af4343366b37",
      "ship_to_city": "",
      "bill_to_address_id": "",
      "company": "West Coast Distribution",
      "customer_api_code": "6318247f-400d-11e3-827d-af4343366b37",
      "sales_tax_total": 0
    },
    {
      "bill_to_notes": "",
      "bill_to_country": "",
      "ship_to_state": "",
      "date": "2014-01-02T12:05:06-08",
      "doc_total": 230,
      "ship_to_zip": "",
      "ship_to_address_line1": "",
      "memo": "",
      "ship_to_sales_tax_code": "",
      "ship_to_address_line2": "",
      "bill_to_sales_tax_code": "",
      "bill_to_address_line1": "",
      "bill_to_address_line2": "",
      "bill_to_state": "",
      "bill_to_cell": "",
      "ship_to_email": "",
      "bill_to_city": "",
      "bill_to_zip": "",
      "bill_to_email": "",
      "so_number": "000014",
      "cf1_string": "",
      "ship_to_middle_name": "",
      "ship_to_first_name": "",
      "bill_to_middle_name": "",
      "ref_num": "",
      "bill_to_first_name": "",
      "api_code": "2c37b770-73e9-11e3-8c19-12313f072907",
      "bill_to_api_code": "00000000-0000-0000-0000-000000000000",
      "ship_to_phone": "",
      "ship_to_cell": "",
      "line_items": [
        {
          "price": 90,
          "Product": "FrigidaireDF28 AC",
          "quantity": 2,
          "api_code": "61062b60-cf4a-11e2-960c-22000ac508d9",
          "line_total": 180
        },
        {
          "price": 50,
          "Product": "Coca Cola",
          "quantity": 1,
          "api_code": "52fa5933-5159-11e3-8058-e3003205b13a",
          "line_total": 50
        }
      ],
      "ship_to_notes": "",
      "bill_to_phone": "",
      "ship_to_country": "",
      "ship_to_address_id": "Primary",
      "ship_to_api_code": "0844a2bb-6900-11e3-8058-e3003205b13a",
      "ship_to_city": "",
      "bill_to_address_id": "",
      "company": "Apple5",
      "customer_api_code": "0844a2ba-6900-11e3-8058-e3003205b13a",
      "sales_tax_total": 0
    }
  ]
}

In AccountingSuite a Purchase Order is a contract purchase document that indicates what goods and services will be delivered or provided to us, and the expected delivery/service date. A business case for using this AccountingSuite API object, is, for example, creating an purchase order to the vendor when an order is created in an e-commerce system.


Attributes

"api_code"

Required. Unique identifier of a purchase order used for addressing purchase orders in the API. Assigned automatically by AccountingSuite when a new sales order is created.

"customer_api_code"

Required. A customer api_code.

"address_api_code

Optional. The purchase address api_code.

"purchase_address_id"

Optional. Address or contact label, for example "SFO warehouse", or "sales order confirm", max 25 characters.

"purchase_first_name"

Optional. First name.

"purchase_middle_name"

Optional. Middle name.

"purchase_last_name"

Optional. Last name.

"purchase_address_line1"

Optional. Address line 1.

"purchase_address_line2"

Optional. Address line 2.

"purchase_city"

Optional. City.

"purchase_state"

Optional. State, a two character abbreviation of US states is accepted (for example, "CA", "CT").

"purchase_zip"

Optional. ZIP code.

"purchase_country"

Optional. Country, a two letter abbreviation is accepted (http://en.wikipedia.org/wiki/ISO_3166-1).

"purchase_phone"

Optional. Phone number.

"purchase_cell"

Optional. Cell number.

"purchase_email"

Optional. E-mail address.

"purchase_sales_tax_code"

Optional. Sales tax code, max 25 characters.

"purchase_notes"

Optional. Notes.

"ds_customer_api_code"

Optional. A dropship customer api_code.

"ds_address_api_code

Optional. The dropship address api_code.

"po_number"

Optional. This alphanumeric number can be automatically generated by the AccountingSuite Document Numbering feature, or manually entered by the user.

"po_date"

Required. Document date, a date is accepted in the "yyyy-mm-dd" format.

"delivery_date"

Optional. Expected delivery date, a date is accepted in the "yyyy-mm-dd" format.

"doc_total"

Required. Total amount of the transaction.

"memo"

Optional. Transaction memo.

"project"

Optional. Transaction project

"class"

Optional. Transaction class

"lines": {"line_items": []}"

Required. Transaction line items.

"api_code"

Required. Item api code.

"price"

Required. Item price.

"quantity"

Required. Item quantity.

"unit_of_measure"

Optional. An item unit of measure, max 25 characters.

"line_total"

Required. Line total.

"project"

Optional. Line project.

"class"

Optional. Line class.


Creating a new Purchase Order

Definition:

POST https://api.accountingsuite.com/purchaseorders

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-d '{"customer_api_code": "093589b0-845f-11e3-bb7f-12313f072907","address_api_code": "093589b1-845f-11e3-bb7f-12313f072907", "po_date":"2013-05-24", "memo":"this is a test","doc_total":700, "lines": {"line_items": [{"api_code": "5fcdf810-78c1-11e3-90ed-12313f072907","price": 350,"quantity": 2,"line_total": 700}]}}' \
https://api.accountingsuite.com/purchaseorders

Example response:

{
  "purchase_city": "",
  "purchase_country": "",
  "purchase_zip": "",
  "purchase_state": "",
  "purchase_email": "",
  "doc_total": 700,
  "ds_address_id": "",
  "memo": "this is a test",
  "ds_address_api_code": "00000000-0000-0000-0000-000000000000",
  "purchase_sales_tax_code": "",
  "purchase_notes": "",
  "delivery_date": "",
  "ds_customer_api_code": "00000000-0000-0000-0000-000000000000",
  "ds_customer": "",
  "po_date": "2013-05-24",
  "api_code": "c04af300-8852-11e3-bb7f-12313f072907",
  "class": "",
  "purchase_first_name": "Jennifer",
  "project": "",
  "purchase_cell": "",
  "line_items": [
    {
      "line_total": 700,
      "class": "",
      "price": 350,
      "unit_of_measure": "",
      "quantity": 2,
      "item": "stillwork??",
      "project": "",
      "item_description": "three as and three bs",
      "api_code": "5fcdf810-78c1-11e3-90ed-12313f072907"
    }
  ],
  "purchase_phone": "",
  "purchase_middle_name": "",
  "purchase_address_line2": "",
  "purchase_address_line1": "",
  "company": "San Francisco Giants",
  "purchase_address_id": "att park",
  "po_number": "000011",
  "address_api_code": "093589b1-845f-11e3-bb7f-12313f072907",
  "customer_api_code": "093589b0-845f-11e3-bb7f-12313f072907"
}

In AccountingSuite a Cash Receipt is a document that records a customer payment that can be linked to a sales invoice. A business case for using this AccountingSuite API object, is, for example, recording a payment of an invoice by customer. If your goal is to record an instant (POS) sale use the Cash Sale document instead.


Attributes

"company_name"

Required. A customer name. If a system finds a customer the transaction will use the existing customer record. If a customer is not found a new one will be created.

"date"

Required. Document date, a date is accepted in the "yyyy-mm-dd" format.

"amount"

Required. Transaction amount.

"ref_num"

Optional. Transaction reference number, for example, a Stripe credit card transaction ID.

"memo"

Optional. Transaction memo.


Creating a new Cash Receipt

Definition:

POST https://api.accountingsuite.com/cashreceipts

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-d '{"company_name": "SoCal distributor","date":"2013-10-01", "ref_num":"trx0023487", "memo":"Invoice 230042 from 09/05/13","amount":900}' \
https://api.accountingsuite.com/cashreceipts

Webhooks are a very convenient tool for integrating with external systems. For example, you can notify your shipping system in real-time that a Cash Sale was created in AccountingSuite. The external system will receive information about the id of the object that was created / modified / deleted, after that you can make an API call to retrieve extended information about the object.

Webhooks can be set up in AccountingSuite in Settings / Development. We currently support webhooks for all objects that are exposed via the API - Companies, Items, Cash Sales, Sales Invoices, Cash Receipts, and Sales Orders.

A webhook example:

{ 
"action": "update", 
"cf5_string": "", 
"cf1_num": 0, 
"costing_method": "weighted_average", 
"cf5_num": 0, 
"resource": "items", 
"cf2_string": "", 
"category": "", 
"item_price": 33, 
"cf2_num": 0, 
"cogs_account": "5000", 
"cf3_string": "", 
"apisecretkey": "", 
"item_code": "key3", 
"inventory_or_expense_account": "1300", 
"cf3_num": 0, 
"item_type": "product", 
"income_account": "4000", 
"item_description": "key3", 
"cf4_string": "", 
"api_code": "a4adb622-5c71-11e3-bec3-001c42734aa6", 
"cf1_string": "", 
"cf4_num": 0 
}

If an invalid request is submitted, an error message will return to let the user know what might have gone wrong. Here are some examples of errors that might occur.


Creating a new Company

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-d '{"company_name": "google","company_type": "customer+vendor"}' \
https://api.accountingsuite.com/companies

Example response:

{
  "message": "[company_name] : The company already exists.",
  "status": "error",
  "api_code": "6da16a40-cf29-11e2-960c-22000ac508d9"
}

Updating a Company

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X PUT \
-d '{"lines": {"addresses": [{"first_name": "Alex","last_name": "Brown","default_billing": true,"default_shipping": true}]}}' \
https://api.accountingsuite.com/companies/82f93fd5-7705-11e3-8058-e3003205b13a

Example response:

{
  "status": "error",
  "message1": "[address.address_id] : This is required to create a new address.",
  "message2": "[address.api_code] : This is required to update an existing address."
}

Creating a new Item

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-d '{"item_code":"Kit Kat","item_description":"Chocolate Wafers","item_type":"product","item_category": "candy"}' \
https://api.accountingsuite.com/items

Example response:

{
  "message": "[item_category] : The category does not exist. You must create the item category first.",
  "status": "error"
}

Updating an Item

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X PUT \
-d '{"item_description": "new version 4.0","item_type": "service"}' \
https://api.accountingsuite.com/items/298924c5-7709-11e3-8058-e3003205b13a

Example response:

{
  "message": "[item_type] : Cannot change the item type.",
  "status": "error"
}

Deleting an Item

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-X DELETE \
https://api.accountingsuite.com/items/298924c5-7709-11e3-8058-e3003205b13a

Example response:

{
  "message": "Failed to delete. There are linked objects to this item.",
  "status": "error",
  "item_code": "FrigidaireDF288 AC"
}

Creating a Sales Order

Example request:

curl -H "apisecretkey: dGmlayoUnlNcitybVTMu" \
-d '{"customer_api_code": "82f93fd5-7705-11e3-8058-e3003205b13a","ship_to_api_code": "92f93fd6-7705-11e3-8058-e3003205b13a", "date":"2013-05-24", "ref_num":"trx0023487xyz", "memo":"magento_sale","doc_total":900, "lines": {"line_items": [{"api_code": "298924c5-7709-11e3-8058-e3003205b13a","price": 350,"quantity": 2,"line_total": 700},{"api_code": "068a71d5-770a-11e3-8058-e3003205b13a","price": 200,"quantity": 1,"line_total": 200}]}}' \
https://api.accountingsuite.com/salesorders

Example response:

{
  "message": "[ship_to_api_code] : Shipping Address does not belong to the Company.",
  "status": "error"
}