Invoices

Get a list of all invoices

ENDPOINT
  GET /invoices

SAMPLE CALL
  curl -u [your_bullet_username]:[your_api_key] https://accounts-app-intl.bullethq.com/api/v1/invoices


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
[{
    "id": 117332,
    "currency": "EUR",
    "invoiceNumber": "004",
    "dueDate": "2014-08-14",
    "issueDate": "2014-07-15",
    "draft": true,
    "clientName": "My Client",
    "clientId": 41426,
    "poNumber": "",
    "outstandingAmount": "99.63",
    "invoiceLines": [{
        "id": 129520,
        "quantity": 9.00,
        "rate": "9.00",
        "salesTaxCode": "STANDARD_2012",
        "description": "desc",
        "item": "Day"
    }]
}, {
    "id": 117357,
    "currency": "EUR",
    "invoiceNumber": "005",
    "dueDate": "2014-01-31",
    "issueDate": "2014-01-01",
    "draft": true,
    "clientName": "My Client",
    "clientId": 41426,
    "poNumber": "",
    "outstandingAmount": "78.72",
    "invoiceLines": [{
        "id": 129545,
        "quantity": 8.00,
        "rate": "8.00",
        "salesTaxCode": "STANDARD_2012",
        "description": "8",
        "item": "Day"
    }]
}]

Create an invoice

Its possible to create invoices in different currencies, just supply the three letter currency code for "currency" field. Also, instead of the "clientName" it is also possible to pass "clientId". To find out the id of your clients, you can use the Clients api call. "salesTaxCode" is a mandatory parameter when creating and updating invoices. Sales Taxes for your company must be set up in Bullet before you start using the api. When creating a sales tax, you have to set a unique string "code" to identify the sales tax. It is this value that should be used for "salesTaxCode" field.

ENDPOINT
  POST /invoices


SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    --data @createInvoice.json \
    -X POST \
    https://accounts-app-intl.bullethq.com/api/v1/invoices/

SAMPLE createInvoice.json

  {
    "clientName": "Bob",
    "currency": "EUR",
    "issueDate": "2013-01-01",
    "dueDate": "2013-02-01",
    "draft": true,
    "invoiceLines": [
        {
            "quantity": 4,
            "rate": "400",
            "salesTaxCode": "STANDARD_2012",
            "description": "Work",
            "item": "Day"
        }
    ]
  }

RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 1,
    "invoiceNumber": "001",
    "currency": "EUR",
    "outstandingAmount": "1,968.00",
    "dueDate": "2013-02-01",
    "issueDate": "2013-01-01",
    "draft": true,
    "clientName": "My Client",
    "clientId": 1,
    "invoiceLines": [{
        "id": 1,
        "quantity": 4,
        "rate": "400.00",
        "salesTaxCode": "STANDARD_2012",
        "description": "Work",
        "item": "Day"
    }]
}

Get an invoice

ENDPOINT
  GET /invoices/[invoice_id]


SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    -X GET \
    https://accounts-app-intl.bullethq.com/api/v1/invoices/1


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 1,
    "invoiceNumber": "001",
    "currency": "EUR",
    "outstandingAmount": "2,214.00",
    "dueDate": "2013-02-01",
    "issueDate": "2013-01-01",
    "draft": true,
    "clientName": "Bobby",
    "clientId": 2,
    "invoiceLines": [{
        "id": 1,
        "quantity": 4,
        "rate": "450.00",
        "salesTaxCode": "STANDARD_2012",
        "description": "Jan-Feb Web Development Work",
        "item": "Day"
    }]
}

Update an invoice

"salesTaxCode" is a mandatory parameter when creating and updating invoices. Sales Taxes for your company must be set up in Bullet before you start using the api. When creating a sales tax, you have to set a unique string "code" to identify the sales tax. It is this value that should be used for "salesTaxCode" field.

When updating the invoice it is necessary to put the "id" of the element in the body aswell as the url otherwise you might get an error complaining that "invoiceNumber" is already used

ENDPOINT
  PUT /invoices/[invoice_id]

SAMPLE updateInvoice.json

{
    "id" : 1,
    "clientName": "Bobby",
    "currency": "EUR",
    "invoiceNumber": "001",
    "issueDate": "2013-01-01",
    "dueDate": "2013-02-01",
    "draft": true,
    "invoiceLines": [
        {
            "id": "1",
            "quantity": 4,
            "rate": "450",
            "salesTaxCode": "STANDARD_2012",
            "description": "Jan-Feb Web Development Work",
            "item": "Day"
        }
    ]
}


SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    --data @updateInvoice.json \
    -X PUT \
    https://accounts-app-intl.bullethq.com/api/v1/invoices/1


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 1,
    "outstandingAmount": "2,214.00",
    "invoiceNumber": "001",
    "currency": "EUR",
    "dueDate": "2013-02-01",
    "issueDate": "2013-01-01",
    "draft": true,
    "clientName": "Bobby",
    "clientId": 2,
    "invoiceLines": [{
        "id": 1,
        "quantity": 4,
        "rate": "450.00",
        "salesTaxCode": "STANDARD_2012",
        "description": "Jan-Feb Web Development Work",
        "item": "Day"
    }]
}

Delete an invoice

ENDPOINT
  DELETE /invoices/[invoice_id]

SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key]
    -H "Accept: application/json"
    -H "Content-type: application/json"
    -X DELETE
    https://accounts-app-intl.bullethq.com/api/v1/invoices/1

RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 1,
    "outstandingAmount": "2,214.00",
    "invoiceNumber": "001",
    "currency": "EUR",
    "dueDate": "2013-02-01",
    "issueDate": "2013-01-01",
    "draft": true,
    "clientName": "Bobby",
    "clientId": 2,
    "invoiceLines": [{
        "id": 1,
        "quantity": 4,
        "rate": "450.00",
        "salesTaxCode": "STANDARD_2012",
        "description": "Jan-Feb Web Development Work",
        "item": "Day"
    }]
}

Add a invoice line

ENDPOINT
  POST /invoices/[invoice_id]/invoiceLines/

SAMPLE addInvoiceLine.json

{
    "quantity": 5,
    "rate": "200",
    "salesTaxCode": "STANDARD_2012",
    "description": "Play",
    "item": "Day"
}

SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    --data @addInvoiceLine.json \
    -X POST \
    https://accounts-app-intl.bullethq.com/api/v1/invoices/1/invoiceLines


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 2,
    "quantity": 5,
    "rate": "200.00",
    "salesTaxCode": "STANDARD_2012",
    "description": "Play",
    "item": "Day"
}

Update a invoice line

ENDPOINT
  PUT /invoices/[invoice_id]/invoiceLines/[invoice_line_id]

SAMPLE updateInvoiceLine.json

{
    "quantity": 50,
    "rate": "100.00",
    "salesTaxCode": "STANDARD_2012",
    "description": "Play",
    "item": "Day"
}


SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    --data @updateInvoiceLine.json \
    -X PUT \
    https://accounts-app-intl.bullethq.com/api/v1/invoices/1/invoiceLines/2


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 2,
    "quantity": 50,
    "rate": "100.00",
    "salesTaxCode": "STANDARD_2012",
    "description": "Play",
    "item": "Day"
}

Delete a invoice line

ENDPOINT
  DELETE /invoices/[invoice_id]/invoiceLines/[invoice_line_id]


SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    -X DELETE \
    https://accounts-app-intl.bullethq.com/api/v1/invoices/1/invoiceLines/2


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 2,
    "quantity": 50,
    "rate": "100.00",
    "salesTaxCode": "STANDARD_2012",
    "description": "Play",
    "item": "Day"
}