You can list your available letters with the following URL:

                GET https://api.smallinvoice.com/letter/list/
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
limitintno0Limit the amount of results
pageintno1When limiting the results, specifies page
sortstringnodatedate
due
number
Sorts the list by the available values
sorttypestringnodescasc
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/letter/list/limit/100/page/2/sort/date/sorttype/asc/
    

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.
pageintCurrent page that was passed in on the request
pagesintTotal number of pages available
countintTotal number of objects available
itemscollectionCollection of letter Objects
invoice

Example content of data variable:

    {
        "error":false,
        "page":1,
        "pages":1,
        "count":1,
        "items":[
            {
                "id":2,
                "client_id":16,
                "client_address_id":11,
                "client_contact_id":0,
                "date":"2013-02-25",
                "title":"Letter to John Doe",
                "status":7,
                "pages":1
            }
        ]
    }
    

You can get your letter with the following URL:

                GET https://api.smallinvoice.com/letter/get/
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the letter


Example: Making a request for letter with id 5

                GET https://api.smallinvoice.com/letter/get/id/5
            

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.
itemobjectObject of letter

Example content of data variable:

    {
        "error":false,
        "item":{
            "id":2,
            "client_id":16,
            "client_address_id":11,
            "client_contact_id":0,
            "date":"2013-02-25",
            "title":"Letter to Jane Doe",
            "status":7,
            "pages":1
        }
    }
    

You can get your letter as pdf with the following URL:

                GET https://api.smallinvoice.com/letter/pdf/
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the letter


Example: Making a request for letter with id 5

                GET https://api.smallinvoice.com/letter/pdf/id/5
            

Response

NameTypeNotes
HTTP Bodyapplication/pdfThe PDF in raw format

You can get a letter preview in PNG form for each page of a document with the following URL:

                GET https://api.smallinvoice.com/letter/preview/
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the letter
pageintno1The page you want to retreive
sizeintno595240
595
600
972
1240
The size in pixels


Example: Getting second page in size 1240 for letter with id 5

                GET https://api.smallinvoice.com/letter/preview/id/5/page/2/size/1240
            

Response

NameTypeNotes
HTTP Bodyimage/pngThe image in raw format

You can add a new letter with the following URL:

                POST https://api.smallinvoice.com/letter/add
            

Body parameters

NameTypeRequiredDefaultNotes
client_idintyesClient's id
client_address_idintyesClient's address id
client_contact_idintno0Client's contact id
datedateyesDate of letter
titlestringnoTitle of the letter


Example: Creating a new letter

                POST https://api.smallinvoice.com/letter/add/
            

Example content of data variable:
{
    "client_id":16,
    "client_address_id":11,
    "client_contact_id":0,
    "date":"2013-02-25",
    "title":"Letter to Jane Doe",
    "status":7,
    "pages":1
}

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.
idintThe Id of the letter Object that was created

Example response:

    {
        "error":false,
        "id": 43
    }
    

You can edit an letter with the following URL:

                POST https://api.smallinvoice.com/letter/edit
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the letter

Body parameters

NameTypeNotes
client_idintClient's id
client_address_idintClient's address id
client_contact_idintClient's contact id
datedateDate of letter
titlestringTitle of the letter


Example: Editing an letter with id 5

                POST https://api.smallinvoice.com/letter/edit/id/5
            

Example content of data variable:
{
    "client_id":16,
    "client_address_id":11,
    "client_contact_id":0,
    "date":"2013-02-25",
    "title":"Letter to John Doe",
    "status":7,
    "pages":1
}

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.

Example response:

    {
        "error":false
    }
    

You can delete an letter with the following URL:

                POST https://api.smallinvoice.com/letter/delete/
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the letter


Example: Making a request for deleting letter with id 5

                POST https://api.smallinvoice.com/letter/delete/id/5
            

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.

Example response:

    {
        "error":false
    }
    

You can email your letter with the following URL:

                POST https://api.smallinvoice.com/letter/email
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the letter

Body parameters

NameTypeRequiredDefaultNotes
subjectstringYesSubject of email
bodystringYesContent of the email
afterstatusintNoThe status the document should take after sending
recipientscollectionYesList of recipients. See example


Example: Sending an letter with id 5 via email

                POST https://api.smallinvoice.com/letter/email/id/5
            

Example content of data variable
{
  "subject" : "Email subject",
  "body" : "Email body",
  "afterstatus" : 1,
  "recipients" : [
      {
        "cc" : false,
        "email" : "email@domain.com",
        "name" : "Client Name"
      }
    ]
}
     

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.

Example response:

    {
        "error":false
    }
    

You can send your letter via postmail with the following URL:

                POST https://api.smallinvoice.com/letter/post
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the letter

Body parameters

NameTypeRequiredDefaultNotes
speedintYes1 = Priority / 2 = Economy
colorintNo00 = B/W / 1 = Color
sendstatusintNoThe status the document should be sent in
afterstatusintNoThe status the document should take after sending


Example: Sending an letter with id 5 via postmail

                POST https://api.smallinvoice.com/letter/post/id/5
            

Example content of data variable
{
  "afterstatus" : 1,
  "sendstatus" : 1,
  "speed" : 1
}
     

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.

Example response:

    {
        "error":false
    }
    

You can change status of your letter with the following URL:

                POST https://api.smallinvoice.com/letter/status/
            

URL Parameters

NameTypeRequiredDefaultOptionsNotes
idintyesThe Id of the letter

Body parameters

NameTypeRequiredDefaultNotes
statusintYesSee Status Types


Example: Making a request for letter with id 5

                POST https://api.smallinvoice.com/letter/status/id/5
            

Example content of data variable
{
  "status" : 1
}
     

Response

NameTypeNotes
errorbooleanIs true if an error occured
errorcodeintCode of the error. Only returned if error is true.
errormessagestringInformational message about the error. Only returned if error is true.

Example response:

    {
        "error":false
    }