1. Home
  2. API v2.0
  3. Documents
  4. Add Document

Add Document

Method: /documents.[format]

Contexts:

SalesBinder Documents have 3 different “context” values to determine what type of document you want to create:

Estimates Context ID: 4 Invoices Context ID: 5 Purchase Order Context ID: 11

Note:
  – all three contexts share the same fields and data types outlined below
  – including a context is required for successfully saving a new account (see examples below)

Document Fields:

Name Data Type Description
customer_id String Customer ID
context_id String Determines if it’s an estimate, invoice, or PO
issue_date String The date this document was issued (in YYYY-MM-DD format)
shipping_address String This is used when the shipping address is different than the mailing address

Document Items Fields:

Name Data Type Description
item_id String Item ID
description String Used for overriding the items actual description
quantity String The quantity of this item added to the order
price String The price you’re selling each unit for
cost String Optional: The cost per unit
tax String Optional: Tax 1 rate for this item
tax2 String Optional: Tax 2 rate for this item

Permissions Required:

  • Billing Management
  • Modify Invoices and/or Modify Estimates

Syntax

https://[subdomain].salesbinder.com/api/2.0/documents.json

HTTP Request Type: POST

Example JSON Data to Submit

{  
   "document":{  
      "context_id":5,
      "customer_id":"549490bc-d15c-433c-8e48-03d8a2d10228",
      "issue_date":"2017-02-08",
      "document_items":[  
         {  
            "quantity":2,
            "tax":8,
            "price":134,
            "weight":1,
            "item_id":"58014db1-8dd8-4133-87ca-337f6882ca98"
         }
      ]
   }
}

Success

If you have been successful in updating a document, the response will return the updated data object along with a “message” value of “Saved” as seen below.

Example XML Data to Submit

<?xml version="1.0" encoding="UTF-8" ?>
<document>
  <context_id>5</context_id>
  <customer_id>549490bc-d15c-433c-8e48-03d8a2d10228</customer_id>
  <issue_date>2017-02-08</issue_date>
  <document_items>
    <quantity>2</quantity>
    <tax>8</tax>
    <price>134</price>
    <weight>1</weight>
    <item_id>58014db1-8dd8-4133-87ca-337f6882ca98</item_id>
  </document_items>
</document>
Was this article helpful to you? Yes No