Invoices
List
GET /invoices.(json|xml)
Returns a collection of invoices associated with the authenticated users account. The results will be paginated. You can use the following optional parameters to traverse the results.
- per_page – Number of results per page (default: 20)
- page – Page in result-set
- client – ID of the client to scope the invoices
Sample JSON Response
Status: 200 OK [ { "invoice": { "shipping_amount": "´0.00", "created_at": "2010-09-22T19:22:27Z", "total_billed": "´1600.00", "line_items": [ { "price": "60.00", "name_and_description": "Site Revamp", "quantity": 25.0, "sort_order": null, "total": "1500.00", "id": 32677, "unit": "hour" }, { "price": "10.00", "name_and_description": "Domain Registration", "quantity": 10.0, "sort_order": null, "total": "100.00", "id": 32678, "unit": "domain" } ], "notes": "Please write a cheque in favor of MyCompany Inc.", "tax2_compound": null, "updated_at": "2010-09-22T19:22:28Z", "discount_amount": "´0.00", "date": "2010-09-23", "hash_key": "Mu7wJCZh", "id": 9297, "tax_amount": "´0.00", "client": { "name": "ABC Inc.", "id": 6470 }, "payment_options": null, "total_due": "´1600.00", "due_date": "2010-10-23", "tax2_amount": "´0.00", "sub_total": "´1600.00", "summary": "Online Presence for the company", "paid_total": "´0.00", "invoice_no": "IN-0001", "state": "sent", "allow_partial_payments": false } } ]
Sample XML Response
Status: 200 OK <?xml version="1.0" encoding="UTF-8"?> <invoices type="array"> <invoice> <shipping-amount>₴0.00</shipping-amount> <created-at>2010-09-22T19:22:27Z</created-at> <total-billed>₴1600.00</total-billed> <line-items type="array"> <line-item> <price>60.00</price> <name-and-description>Site Revamp</name-and-description> <quantity type="float">25.0</quantity> <sort-order nil="true"></sort-order> <total>1500.00</total> <id type="integer">32677</id> <unit>hour</unit> </line-item> <line-item> <price>10.00</price> <name-and-description>Domain Registration</name-and-description> <quantity type="float">10.0</quantity> <sort-order nil="true"></sort-order> <total>100.00</total> <id type="integer">32678</id> <unit>domain</unit> </line-item> </line-items> <notes>Please write a cheque in favor of MyCompany Inc.</notes> <tax2-compound nil="true"></tax2-compound> <updated-at>2010-09-22T19:22:28Z</updated-at> <discount-amount>₴0.00</discount-amount> <date>2010-09-23</date> <hash-key>Mu7wJCZh</hash-key> <id type="integer">9297</id> <tax-amount>₴0.00</tax-amount> <client> <name>ABC Inc.</name> <id type="integer">6470</id> </client> <payment-options nil="true"></payment-options> <total-due>₴1600.00</total-due> <due-date>2010-10-23</due-date> <tax2-amount>₴0.00</tax2-amount> <sub-total>₴1600.00</sub-total> <summary>Online Presence for the company</summary> <paid-total>₴0.00</paid-total> <invoice-no>IN-0001</invoice-no> <state>sent</state> <allow-partial-payments>false</allow-partial-payments> </invoice> </invoices>
Show Top
GET /invoices/#{id}.(json|xml)
Returns a single invoice belongs to the business of the authenticated user.
Sample JSON Response
Status: 200 OK { "invoice": { "shipping_amount": "´0.00", "created_at": "2010-09-22T19:22:27Z", "total_billed": "´1600.00", "line_items": [ { "price": "60.00", "name_and_description": "Site Revamp", "quantity": 25.0, "sort_order": null, "total": "1500.00", "id": 32677, "unit": "hour" }, { "price": "10.00", "name_and_description": "Domain Registration", "quantity": 10.0, "sort_order": null, "total": "100.00", "id": 32678, "unit": "domain" } ], "notes": "Please write a cheque in favour of MyCompany Inc.", "tax2_compound": null, "updated_at": "2010-09-22T19:22:28Z", "discount_amount": "´0.00", "date": "2010-09-23", "hash_key": "Mu7wJCZh", "id": 9297, "tax_amount": "´0.00", "client": { "name": "ABC Inc.", "id": 6470 }, "payment_options": null, "total_due": "´1600.00", "due_date": "2010-10-23", "tax2_amount": "´0.00", "sub_total": "´1600.00", "summary": "Online Presence for the company", "paid_total": "´0.00", "invoice_no": "IN-0001", "state": "sent", "allow_partial_payments": false } }
Sample XML Response
Status: 200 OK <?xml version="1.0" encoding="UTF-8"?> <invoice> <shipping-amount>₴0.00</shipping-amount> <created-at>2010-09-22T19:22:27Z</created-at> <total-billed>₴1600.00</total-billed> <line-items type="array"> <line-item> <price>60.00</price> <name-and-description>Site Revamp</name-and-description> <quantity type="float">25.0</quantity> <sort-order nil="true"></sort-order> <total>1500.00</total> <id type="integer">32677</id> <unit>hour</unit> </line-item> <line-item> <price>10.00</price> <name-and-description>Domain Registration</name-and-description> <quantity type="float">10.0</quantity> <sort-order nil="true"></sort-order> <total>100.00</total> <id type="integer">32678</id> <unit>domain</unit> </line-item> </line-items> <notes>Please write a cheque in favour of MyCompany Inc.</notes> <tax2-compound nil="true"></tax2-compound> <updated-at>2010-09-22T19:22:28Z</updated-at> <discount-amount>₴0.00</discount-amount> <date>2010-09-23</date> <hash-key>Mu7wJCZh</hash-key> <id type="integer">9297</id> <tax-amount>₴0.00</tax-amount> <client> <name>ABC Inc.</name> <id type="integer">6470</id> </client> <payment-options nil="true"></payment-options> <total-due>₴1600.00</total-due> <due-date>2010-10-23</due-date> <tax2-amount>₴0.00</tax2-amount> <sub-total>₴1600.00</sub-total> <summary>Online Presence for the company</summary> <paid-total>₴0.00</paid-total> <invoice-no>IN-0001</invoice-no> <state>sent</state> <allow-partial-payments>false</allow-partial-payments> </invoice>
Create Top
POST /invoices.(json|xml)
Creates a new invoice under authenticated users account. Only client_id is required, all other parameters are optional. Returns the created invoice as the response.
Note
If the date or invoice_no is not set, they will take the following default values.
date – todays date
invoice_no – next in sequence based on last invoice number. (IN-0001 if its the first invoice)
Sample JSON Request
{ "invoice": { "tax": "25.00", "line_items_attributes": [ { "name_and_description": "Sample Item", "price": 25.0, "quantity": 1, "unit": "hour" }, { "name_and_description": "Another Entry", "price": 150.0, "quantity": 1, "unit": "KM" } ], "discount": "10%", "notes": "We can add notes too", "date": "2010/09/25", "shipping": "10.00", "client_id": 4, "due_date": "2010/10/25", "summary": "This is a sample invoice", "invoice_no": "IN-NEW", "allow_partial_payments": true } }
Sample JSON Response
Status: 201 Created Location: http://example.curdbee.com/invoices/#{id} { "invoice": { "id": #{id}, ... } }
Sample XML Request
<?xml version="1.0" encoding="UTF-8"?> <invoice> <tax>25.00</tax> <discount>10%</discount> <line-items-attributes type="array"> <line-items-attribute> <price type="float">25.0</price> <name-and-description>Sample Item</name-and-description> <quantity type="integer">1</quantity> <unit>hour</unit> </line-items-attribute> <line-items-attribute> <price type="float">150.0</price> <name-and-description>Another Entry</name-and-description> <quantity type="integer">1</quantity> <unit>KM</unit> </line-items-attribute> </line-items-attributes> <notes>We can add notes too</notes> <shipping>10.00</shipping> <date type="date">2010-09-25</date> <client-id type="integer">4</client-id> <due-date type="date">2010-10-25</due-date> <summary>This is a sample invoice</summary> <invoice-no>IN-NEW</invoice-no> <allow-partial-payments>true</allow-partial-payments> </invoice>
Sample XML Response
Status: 201 Created Location: http://example.curdbee.com/invoices/#{id} <invoice> ... </invoice>
Update Top
PUT /invoices/#{id}.(json|xml)
Updates an existing invoice that belongs to authenticated users account. Returns the updated invoice.
Sample JSON Request
{ "invoice": { "line_items_attributes": [ { "_delete": true, "id": 25 }, { "price": 76.0, "name_and_description": "Another Entry:Modified", "id": 26 }, { "price": 150.0, "name_and_description": "New Entry: Appending to the existing invoice", "quantity": 1, "unit": "hourly" } ], "due_date": "2010/10/28", "invoice_no": "IN-EDIT" } }
Sample JSON Response
Status: 200 OK Location: http://example.curdbee.com/invoices/#{id} { "invoice": { "id": #{id}, ... } }
Sample XML Request
<?xml version="1.0" encoding="UTF-8"?> <invoice> <line-items-attributes type="array"> <line-items-attribute> <-delete type="boolean">true</-delete> <id type="integer">25</id> </line-items-attribute> <line-items-attribute> <price type="float">76.0</price> <name-and-description>Another Entry:Modified</name-and-description> <id type="integer">26</id> </line-items-attribute> <line-items-attribute> <price type="float">150.0</price> <name-and-description>New Entry: Appending to the existing invoice</name-and-description> <quantity type="integer">1</quantity> <unit>hourly</unit> </line-items-attribute> </line-items-attributes> <due-date>2010/10/28</due-date> <invoice-no>IN-EDIT</invoice-no> </invoice>
Sample XML Response
Status: 200 OK Location: http://example.curdbee.com/invoices/#{id} <invoice> <id>#{id}</id> ... </invoice>
Duplicate Top
Updated 16/06/2011 – this function is now deprecated.
Close Top
POST /invoices/#{id}/close.(json|xml)
Closes an existing invoice belongs to the business of the authenticated user.
Sample XML/JSON Response
Status: 200 OK
Reopen Top
POST /invoices/#{id}/reopen.(json|xml)
Reopens a closed invoice belongs to the business of the authenticated user.
Sample XML/JSON Response
Status: 200 OK
Deliver Top
POST /deliver/invoice/#{id}.(json|xml)
Delivers an existing invoice that belongs to authenticated users account.
Sample JSON Request
{ "delivery": { "blind_copy": [ "admin@example.com" ], "recipients": [ "test@example.com" ] } }
Sample JSON Response
Status: 200 OK
Sample XML Request
<?xml version="1.0" encoding="UTF-8"?> <delivery> <blind-copy>admin@example.com</blind-copy> <blind-copy>admin2@example.com</blind-copy> <recipients>test@example.com</recipients> <recipients>test2@example.com</recipients> </delivery>
Sample XML Response
Status: 200 OK
Delete Top
DELETE /invoices/#{id}.(json|xml)
Deletes an existing invoice that belongs to authenticated users account.
Sample JSON/XML Response
Status: 200 OK

Invoices
