Invoices
You can list your available invoices with the following URL:
GET https://api.smallinvoice.com/invoice/list/
URL Parameters
| Name | Type | Required | Default | Options | Notes |
|---|---|---|---|---|---|
| limit | int | no | 0 | Limit the amount of results | |
| page | int | no | 1 | When limiting the results, specifies page | |
| sort | string | no | date | date due number | Sorts the list by the available values |
| sorttype | string | no | desc | asc desc | Defines the way of sorting |
Example: Making a request with 100 Results, getting second page, and sorting by date ascending
GET https://api.smallinvoice.com/invoice/list/limit/100/page/2/sort/date/sorttype/asc/
Response
| Name | Type | Notes |
|---|---|---|
| error | boolean | Is true if an error occured |
| errorcode | int | Code of the error. Only returned if error is true. |
| errormessage | string | Informational message about the error. Only returned if error is true. |
| page | int | Current page that was passed in on the request |
| pages | int | Total number of pages available |
| count | int | Total number of objects available |
| items | collection | Collection of invoice Objects |
Example content of data variable:
{
"error":false,
"page":1,
"pages":1,
"count":2,
"items":[
{
"id":77,
"number":10000,
"client_id":16,
"client_name":"John Doe",
"client_address_id":11,
"client_contact_id":0,
"currency":"CHF",
"title":"Rechnung Nr. {1} \/ Kunden Nr. {2}",
"period":"",
"date":"2013-02-25",
"due":"2013-03-27",
"account_id":0,
"esr":0,
"esr_number":"",
"esr_position":0,
"lsvplus":0,
"dd":0,
"discount":0,
"discount_type":0,
"conditions":"",
"introduction":"",
"language":"de",
"paypal":0,
"paypal_url":"",
"vat_included":0,
"totalamount":0,
"status":7,
"pages":1,
"positions":[
{
"type":1,
"number":null,
"name":"Service Y",
"description":"Cleaning house",
"cost":0,
"unit":1,
"amount":1,
"vat":8,
"discount":null
},
{
"type":2,
"number":null,
"name":"Product X",
"description":"Repairing car",
"cost":0,
"unit":7,
"amount":1,
"vat":8,
"discount":null
}
]
}
]
}
You can get your invoice with the following URL:
GET https://api.smallinvoice.com/invoice/get/
URL Parameters
| Name | Type | Required | Default | Options | Notes |
|---|---|---|---|---|---|
| id | int | yes | The Id of the invoice |
Example: Making a request for invoice with id 5
GET https://api.smallinvoice.com/invoice/get/id/5
Response
| Name | Type | Notes |
|---|---|---|
| error | boolean | Is true if an error occured |
| errorcode | int | Code of the error. Only returned if error is true. |
| errormessage | string | Informational message about the error. Only returned if error is true. |
| item | object | Object of invoice |
Example content of data variable:
{
"error":false,
"item":{
"id":77,
"number":10000,
"client_id":16,
"client_name":"Jane Doe",
"client_address_id":11,
"client_contact_id":0,
"currency":"CHF",
"title":"Rechnung Nr. {1} \/ Kunden Nr. {2}",
"period":"",
"date":"2013-02-25",
"due":"2013-03-27",
"account_id":0,
"esr":0,
"esr_number":"",
"esr_position":0,
"lsvplus":0,
"dd":0,
"discount":0,
"discount_type":0,
"conditions":"",
"introduction":"",
"language":"de",
"paypal":0,
"paypal_url":"",
"vat_included":0,
"totalamount":0,
"status":7,
"pages":1,
"positions":[
{
"type":1,
"number":null,
"name":"Service Y",
"description":"Cleaning house",
"cost":0,
"unit":1,
"amount":1,
"vat":8,
"discount":null
},
{
"type":2,
"number":null,
"name":"Product X",
"description":"Repairing car",
"cost":0,
"unit":7,
"amount":1,
"vat":8,
"discount":null
}
]
}
}
You can get your invoice as pdf with the following URL:
GET https://api.smallinvoice.com/invoice/pdf/
URL Parameters
| Name | Type | Required | Default | Options | Notes |
|---|---|---|---|---|---|
| id | int | yes | The Id of the invoice |
Example: Making a request for invoice with id 5
GET https://api.smallinvoice.com/invoice/pdf/id/5
Response
| Name | Type | Notes |
|---|---|---|
| HTTP Body | application/pdf | The PDF in raw format |
You can get a invoice preview in PNG form for each page of a document with the following URL:
GET https://api.smallinvoice.com/invoice/preview/
URL Parameters
| Name | Type | Required | Default | Options | Notes |
|---|---|---|---|---|---|
| id | int | yes | The Id of the invoice | ||
| page | int | no | 1 | The page you want to retreive | |
| size | int | no | 595 | 240 595 600 972 1240 | The size in pixels |
Example: Getting second page in size 1240 for invoice with id 5
GET https://api.smallinvoice.com/invoice/preview/id/5/page/2/size/1240
Response
| Name | Type | Notes |
|---|---|---|
| HTTP Body | image/png | The image in raw format |
You can add a new invoice with the following URL:
POST https://api.smallinvoice.com/invoice/add
Body parameters
| Name | Type | Required | Default | Notes |
|---|---|---|---|---|
| number | string | no | Next higher number | Your invoice number |
| client_id | int | yes | Client's id | |
| client_address_id | int | yes | Client's address id | |
| client_contact_id | int | no | 0 | Client's contact id |
| currency | string | yes | Three-letter currency code | |
| title | string | no | Title of the invoice | |
| period | string | no | ||
| date | date | yes | Date of invoice in YYYY-MM-DD format | |
| due | date | yes | Latest payment date in YYYY-MM-DD format | |
| account_id | int | no | Id for Account Object | |
| esr | int | no | 0 | If invoice has ESR |
| esr_number | int | no | Next higher esr-number | ESR number |
| esr_position | int | no | Positioning of ESR. 0 = additional page, 1 = first page, 2 = last page | |
| lsvplus | int | no | If LSV+ is active | |
| dd | int | no | If DebitDirect is active | |
| discount | float | no | 0 | Discount amount |
| discount_type | int | no | 0 | See Discount Types |
| introduction | string | no | Introduction text printed above positions | |
| conditions | string | no | Text printed below positions | |
| language | string | yes | Two-letter language code | |
| paypal | int | no | 0 | PayPal account payment |
| vat_included | int | no | 0 | If VAT is included in positions' prices |
| positions | collection | yes | Collection of Position Objects |
Example: Creating a new invoice
POST https://api.smallinvoice.com/invoice/add/
Example content of data variable:
{
"number":10000,
"client_id":16,
"client_name":"John Doe",
"client_address_id":11,
"client_contact_id":0,
"currency":"CHF",
"title":"Rechnung Nr. {1} \/ Kunden Nr. {2}",
"period":"",
"date":"2013-02-25",
"due":"2013-03-27",
"account_id":0,
"esr":0,
"esr_number":"",
"esr_position":0,
"lsvplus":0,
"dd":0,
"discount":0,
"discount_type":0,
"conditions":"",
"introduction":"",
"language":"de",
"paypal":0,
"vat_included":0,
"positions":[
{
"type":2,
"number":null,
"name":"Product X",
"description":"Repairing car",
"cost":0,
"unit":1,
"amount":1,
"vat":8,
"discount":null
},
{
"type":1,
"number":null,
"name":"Service Y",
"description":"Cleaning house",
"cost":0,
"unit":7,
"amount":1,
"vat":8,
"discount":null
}
]
}
Response
| Name | Type | Notes |
|---|---|---|
| error | boolean | Is true if an error occured |
| errorcode | int | Code of the error. Only returned if error is true. |
| errormessage | string | Informational message about the error. Only returned if error is true. |
| id | int | The Id of the invoice Object that was created |
Example response:
{
"error":false,
"id": 43
}
You can edit an invoice with the following URL:
POST https://api.smallinvoice.com/invoice/edit
URL Parameters
| Name | Type | Required | Default | Options | Notes |
|---|---|---|---|---|---|
| id | int | yes | The Id of the invoice |
Body parameters
| Name | Type | Notes |
|---|---|---|
| number | string | Your invoice number |
| client_id | int | Client's id |
| client_address_id | int | Client's address id |
| client_contact_id | int | Client's contact id |
| currency | string | Three-letter currency code |
| title | string | Title of the invoice |
| period | string | |
| date | date | Date of invoice in YYYY-MM-DD format |
| due | date | Latest payment date in YYYY-MM-DD format |
| account_id | int | Id for Account Object |
| esr | int | If invoice has ESR |
| esr_number | int | ESR number |
| esr_position | int | Positioning of ESR. 0 = additional page, 1 = first page, 2 = last page |
| lsvplus | int | If LSV+ is active |
| dd | int | If DebitDirect is active |
| discount | float | Discount amount |
| discount_type | int | See Discount Types |
| introduction | string | Introduction text printed above positions |
| conditions | string | Text printed below positions |
| language | string | Two-letter language code |
| paypal | int | PayPal account payment |
| vat_included | int | If VAT is included in positions' prices |
| positions | collection | Collection of Position Objects |
Example: Editing an invoice with id 5
POST https://api.smallinvoice.com/invoice/edit/id/5
Example content of data variable:
{
"number":10000,
"client_id":16,
"client_name":"Jane Doe",
"client_address_id":11,
"client_contact_id":0,
"currency":"CHF",
"title":"Rechnung Nr. {1} \/ Kunden Nr. {2}",
"period":"",
"date":"2013-02-25",
"due":"2013-03-27",
"account_id":0,
"esr":0,
"esr_number":"",
"esr_position":0,
"lsvplus":0,
"dd":0,
"discount":0,
"discount_type":0,
"conditions":"",
"introduction":"",
"language":"de",
"paypal":0,
"vat_included":0,
}
Response
| Name | Type | Notes |
|---|---|---|
| error | boolean | Is true if an error occured |
| errorcode | int | Code of the error. Only returned if error is true. |
| errormessage | string | Informational message about the error. Only returned if error is true. |
Example response:
{
"error":false
}
You can delete an invoice with the following URL:
POST https://api.smallinvoice.com/invoice/delete/
URL Parameters
| Name | Type | Required | Default | Options | Notes |
|---|---|---|---|---|---|
| id | int | yes | The Id of the invoice |
Example: Making a request for deleting invoice with id 5
POST https://api.smallinvoice.com/invoice/delete/id/5
Response
| Name | Type | Notes |
|---|---|---|
| error | boolean | Is true if an error occured |
| errorcode | int | Code of the error. Only returned if error is true. |
| errormessage | string | Informational message about the error. Only returned if error is true. |
Example response:
{
"error":false
}
You can email your invoice with the following URL:
POST https://api.smallinvoice.com/invoice/email
URL Parameters
| Name | Type | Required | Default | Options | Notes |
|---|---|---|---|---|---|
| id | int | yes | The Id of the invoice |
Body parameters
| Name | Type | Required | Default | Notes |
|---|---|---|---|---|
| subject | string | Yes | Subject of email | |
| body | string | Yes | Content of the email | |
| status | int | No | The status the document should be sent in | |
| afterstatus | int | No | The status the document should take after sending | |
| recipients | collection | Yes | List of recipients. See example |
Example: Sending an invoice with id 5 via email
POST https://api.smallinvoice.com/invoice/email/id/5
Example content of data variable
{
"subject" : "Email subject",
"body" : "Email body",
"status" : 1,
"afterstatus" : 1,
"recipients" : [
{
"cc" : false,
"email" : "email@domain.com",
"name" : "Client Name"
}
]
}
Response
| Name | Type | Notes |
|---|---|---|
| error | boolean | Is true if an error occured |
| errorcode | int | Code of the error. Only returned if error is true. |
| errormessage | string | Informational message about the error. Only returned if error is true. |
Example response:
{
"error":false
}
You can send your invoice via postmail with the following URL:
POST https://api.smallinvoice.com/invoice/post
URL Parameters
| Name | Type | Required | Default | Options | Notes |
|---|---|---|---|---|---|
| id | int | yes | The Id of the invoice |
Body parameters
| Name | Type | Required | Default | Notes |
|---|---|---|---|---|
| speed | int | Yes | 1 = Priority / 2 = Economy | |
| color | int | No | 0 | 0 = B/W / 1 = Color |
| sendstatus | int | No | The status the document should be sent in | |
| afterstatus | int | No | The status the document should take after sending |
Example: Sending an invoice with id 5 via postmail
POST https://api.smallinvoice.com/invoice/post/id/5
Example content of data variable
{
"afterstatus" : 1,
"sendstatus" : 1,
"speed" : 1
}
Response
| Name | Type | Notes |
|---|---|---|
| error | boolean | Is true if an error occured |
| errorcode | int | Code of the error. Only returned if error is true. |
| errormessage | string | Informational message about the error. Only returned if error is true. |
Example response:
{
"error":false
}
You can change status of your invoice with the following URL:
POST https://api.smallinvoice.com/invoice/status/
URL Parameters
| Name | Type | Required | Default | Options | Notes |
|---|---|---|---|---|---|
| id | int | yes | The Id of the invoice |
Body parameters
| Name | Type | Required | Default | Notes |
|---|---|---|---|---|
| status | int | Yes | See Status Types |
Example: Making a request for invoice with id 5
POST https://api.smallinvoice.com/invoice/status/id/5
Example content of data variable
{
"status" : 1
}
Response
| Name | Type | Notes |
|---|---|---|
| error | boolean | Is true if an error occured |
| errorcode | int | Code of the error. Only returned if error is true. |
| errormessage | string | Informational message about the error. Only returned if error is true. |
Example response:
{
"error":false
}
You can add a payment to your invoice with the following URL:
POST https://api.smallinvoice.com/invoice/payment
URL Parameters
| Name | Type | Required | Default | Options | Notes |
|---|---|---|---|---|---|
| id | int | yes | The Id of the invoice |
Body parameters
| Name | Type | Required | Default | Notes |
|---|---|---|---|---|
| amount | float | Yes | ||
| date | date | No | Example 2012-04-02 | |
| type | int | No | 1 | 1 = payment, 2 = cash discount |
| keep_status | int | No | 0 | If invoice should automatically adapt status |
Example: Sending an invoice with id 5 via postmail
POST https://api.smallinvoice.com/invoice/payment/id/5
Example content of data variable
{
"amount" : 140.50,
"date" : "2012-05-12",
"type" : 1,
"keep_status" : 0
}
Response
| Name | Type | Notes |
|---|---|---|
| error | boolean | Is true if an error occured |
| errorcode | int | Code of the error. Only returned if error is true. |
| errormessage | string | Informational message about the error. Only returned if error is true. |
Example response:
{
"error":false
}
