API-V2

Application Programming Interface

InvoiceXpress Documentation

Get

GET /:document-type/:document-id.json

Returns a specific invoice.

Example Request

curl

curl --request GET \
  --url 'https://account_name.app.invoicexpress.com/:document-type/:document-id.json?api_key=YOUR%20API%20KEY%20HERE' \
  --header 'accept: application/json'

Ruby

require 'uri'
require 'net/http'

url = URI("https://account_name.app.invoicexpress.com/:document-type/:document-id.json?api_key=YOUR%20API%20KEY%20HERE")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

response = http.request(request)
puts response.read_body

Node

var http = require("https");

var options = {
  "method": "GET",
  "hostname": "account_name.app.invoicexpress.com",
  "port": null,
  "path": "/:document-type/:document-id.json?api_key=YOUR%20API%20KEY%20HERE",
  "headers": {
    "accept": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();

Python

import http.client

conn = http.client.HTTPSConnection("account_name.app.invoicexpress.com")

headers = { 'accept': "application/json" }

conn.request("GET", "/:document-type/:document-id.json?api_key=YOUR%20API%20KEY%20HERE", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://account_name.app.invoicexpress.com/:document-type/:document-id.json?api_key=YOUR%20API%20KEY%20HERE",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Go

package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://account_name.app.invoicexpress.com/:document-type/:document-id.json?api_key=YOUR%20API%20KEY%20HERE"

    req, _ := http.NewRequest("GET", url, nil)

    req.Header.Add("accept", "application/json")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Path Parameters

NameTypeRequiredDescriptionExample
document-typeIntegerRequiredThe type of invoice you want to get. For example: invoicesinvoice_receiptssimplified_invoicesvat_moss_invoicescredit_notes or debit_notes.invoices
document-idIntegerRequiredThe requested invoice id.42

Responses

200SUCCESS
The invoice was returned successfully.
Invoices Get
401ACCESS DENIED
The API Key parameter is missing or is incorrectly entered.
(Empty Response)
404NOT FOUND
No invoice matches the supplied :document-id.
(Empty Response)

Example Success Body Response

{
  "invoice": {
    "id": 2137287,
    "status": "final",
    "archived": false,
    "type": "Invoice",
    "sequence_number": "6/G",
    "inverted_sequence_number": "G/6",
    "atcud": "ABCD1234-6",
    "sequence_id": "12345",
    "tax_exemption": "M01",
    "date": "04/08/2016",
    "due_date": "19/08/2016",
    "reference": "foo",
    "observations": "foo",
    "retention": "foo",
    "permalink": "https://www.app.invoicexpress.com/documents/213728738ca780a8de4330cad4a5a556360304bd9c57011",
    "saft_hash": "J4ay",
    "sum": 24.39,
    "discount": 0,
    "before_taxes": 24.39,
    "taxes": 5.61,
    "total": 30,
    "currency": "Euro",
    "client": {
      "id": 628535,
      "name": "John",
      "country": "Portugal"
    },
    "items": [
      {
        "name": "Large",
        "description": "foo",
        "unit_price": "24.3902",
        "unit": "foo",
        "quantity": "1.0",
        "tax": {
          "id": 69166,
          "name": "IVA23",
          "value": 23
        },
        "discount": 0,
        "subtotal": 24.39,
        "tax_amount": 5.61,
        "discount_amount": 0,
        "total": 30
      }
    ],
    "mb_reference": {
      "entity": "10611",
      "value": 30,
      "reference": "952000823"
    }
  }
}

Possible values for field atcud:

  • ABCD1234-1 or similar: Unique document identifier to the Tax Authority, when the sequence is registered.
  • N/D: The document’s sequence is relevant for ATCUD but is not registered in the Tax Authority.
  • N/A: The document’s sequence is not relevant for ATCUD and is not registered in the Tax Authority.