API-V2

Application Programming Interface

InvoiceXpress Documentation

Create treasury movement

POST /api/v3/clients/:client-id/treasury_movements.json

Creates a new client’s treasury movement.

Example Request

curl

curl --request POST \
  --url 'https://account_name.app.invoicexpress.com/api/v3/clients/:client-id/treasury_movements.json?api_key=YOUR%20API%20KEY%20HERE' \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{"treasury_movement":{"value":123.45,"movement_type":"Reimbursement","payment_method":"MB","date":"2023-04-28","serie":"2023"}}'

Ruby

require 'uri'
require 'net/http'

url = URI("https://account_name.app.invoicexpress.com/api/v3/clients/:client-id/treasury_movements.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::Post.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request.body = "{\"treasury_movement\":{\"value\":123.45,\"movement_type\":\"Reimbursement\",\"payment_method\":\"MB\",\"date\":\"2023-04-28\",\"serie\":\"2023\"}}"

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

Node

var http = require("https");

var options = {
  "method": "POST",
  "hostname": "account_name.app.invoicexpress.com",
  "port": null,
  "path": "/api/v3/clients/:client-id/treasury_movements.json?api_key=YOUR%20API%20KEY%20HERE",
  "headers": {
    "accept": "application/json",
    "content-type": "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.write(JSON.stringify({ treasury_movement: { value: 123.45, movement_type: 'Reimbursement', payment_method: 'MB', date: '2023-04-28', serie: '2023' }}));
req.end();

Python

import http.client

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

payload = "{\"treasury_movement\":{\"value\":123.45,\"movement_type\":\"Reimbursement\",\"payment_method\":\"MB\",\"date\":\"2023-04-28\",\"serie\":\"2023\"}}"

headers = {
  'accept': "application/json",
  'content-type': "application/json"
}

conn.request("POST", "/api/v3/clients/:client-id/treasury_movements.json?api_key=YOUR%20API%20KEY%20HERE", payload, 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/api/v3/clients/:client-id/treasury_movements.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 => "POST",
  CURLOPT_POSTFIELDS => "{\"treasury_movement\":{\"value\":123.45,\"movement_type\":\"Reimbursement\",\"payment_method\":\"MB\",\"date\":\"2023-04-28\",\"serie\":\"2023\"}}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: 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"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://account_name.app.invoicexpress.com/api/v3/clients/:client-id/treasury_movements.json?api_key=YOUR%20API%20KEY%20HERE"

    payload := strings.NewReader("{\"treasury_movement\":{\"value\":123.45,\"movement_type\":\"Reimbursement\",\"payment_method\":\"MB\",\"date\":\"2023-04-28\",\"serie\":\"2023\"}}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("accept", "application/json")
    req.Header.Add("content-type", "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
client-idIntegerRequiredThe ID of the client you want to create a treasury movement.42

Request Body

NameTypeRequiredDescription
treasury_movementObjectRequiredTreasury movement data to be created
valueNumberRequiredTreasury movement value
movement_typeStringRequiredTreasury movement type can be Reimbursement or Payment
payment_methodStringTreasury movement can be CC “Cartão de crédito”, CD “Cartão de débito”, CH “Cheque bancário”, CI “Crédito documentário internacional”, CO “Cheque ou cartão oferta”, CS “Compensação de saldos de conta corrente”, DE “Dinheiro electrónico”, LC “Letra comercial”, MB “Referências de pagamento para Multibanco”, NU “Numerário”, or “Outros meios aqui não assinalados”, PR “Permuta de bens”, TB “Transferência bancária ou débito direto autorizado”, TR “Ticket restaurante”
dateStringRequiredTreasury movement date
serieStringSerie to create the document
observationStringSo if necessary

Example Request Body

{
  "treasury_movement": {
    "value": 123.45,
    "movement_type": "Reimbursement",
    "payment_method": "MB",
    "date": "2023-04-28",
    "serie": "2023"
  }
}

Responses

201SUCCESSAccounts Create response
401ACCESS DENIED
The API Key parameter is missing or is incorrectly entered.
(Empty Response)
404NOT FOUND
No client matches the supplied client-id.
(Empty Response)
422UNPROCESSABLE ENTITY
Some parameters were incorrect.
(Empty Response)

Example Success Body Response

{
  "treasury_movement": {
    "value": 123.45,
    "movement_type": "Reimbursement",
    "payment_method": "MB",
    "date": "2023-04-28",
    "serie": "2023",
    "observation": null
  }
}

Create treasury movement