Introduction
Welcome to the Onlinefact API! You can use our API to access Onlinefa t API endpoints, which can get information on products, customers or other information in the database.
We have language bindings in PHP and Curl! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
Authentication
To authorize, use this code:
$api_key = "api_key_here";
$api_secret = "api_secret_here";
$endpoint = "api_endpoint_here";
$query_parameters = "?limit=10&page=2";
$ch = curl_init('https://api.onlinefact.be/'.$endpoint.$query_parameters);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $api_key.":".$api_secret);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
# With shell, you can just pass the correct header with each request
curl "https://api.onlinefact.be/api_endpoint_here" \
-u "api_key_here:api_secret_here"
The Onlinefact API uses basic authentication. You can create the API key and secret via the Onlinefact Portal (https://admin.onlinefact.be)
In the portal you go to the menu 'configuration' -> 'settings' -> tab 'API'
Products
Parameter | Type | Description |
---|---|---|
product_id | integer | Unique identifier for the resource. [read-only] |
reference | string | Unique SKU |
reference2 | string | |
barcode | string | the barcode of the product, can be EAN13 of any other type |
description | string | Product name |
price_excl | decimal | Product price excl VAT |
tax | decimal | VAT percentage of product |
price_incl | decimal | Product price incl VAT |
purchaseprice_excl | decimal | Purchase price excl VAT |
costprice_excl | decimal | Cost price excl VAT (Average purchase price of items in stock) |
stock | decimal | amount of inventory |
stock_comment | string | comment for stock change |
categorie_id | integer | primary category ID |
brand_id | integer | brand ID |
webshop | boolean | may this product be visible on webshop |
dropship | boolean | webshop has always stock of this product |
endoflife | boolean | webshop can max sell stock amount, when stock = 0 the product will go offline |
free_zone | text | long description of the product (html) |
binloc | string | location of the product |
binloc2 | string | alternative location of the product |
datemodified | date-time | date and time of last modification [read-only] |
supplier | string | supplier of the product |
HBK | decimal | amount of open client orders [read-only] |
HBL | decimal | amount of open supplier orders [read-only] |
managestock | boolean | does this product needs stock calculation |
lastsold | date | date the product is last sold [read-only] |
categories | array | |
barcodes | array | |
images | array | |
attributes | array |
Products - categories
Parameter | Type | Description |
---|---|---|
categorie_id | integer | Unique identifier for the resource. |
Products - barcodes
Parameter | Type | Description |
---|---|---|
barcode | string | the barcode of the product, can be EAN13 of any other type. |
Products - images
Parameter | Type | Description |
---|---|---|
image_id | integer | Unique identifier for the resource. [read-only] |
order | integer | the order of the image |
datemodified | date-time | date and time of last modification [read-only] |
image_url | string | URL of the image. [read-only] |
Products - languages
Parameter | Type | Description |
---|---|---|
description | string | Product name in specified language |
free_zone | text | long description of the product (html) in specified language |
Products - attributes
Parameter | Type | Description |
---|---|---|
product_id | integer | Unique identifier for the resource. [read-only] |
reference | string | Unique SKU |
barcode | string | the barcode of the product, can be EAN13 of any other type |
stock | decimal | amount of inventory |
addprice | decimal | price difference |
webshop | boolean | may this product be visible on webshop |
dropship | boolean | webshop has always stock of this product |
endoflife | boolean | webshop can max sell stock amount, when stock = 0 the product will go offline |
HBK | decimal | amount of open client orders [read-only] |
HBL | decimal | amount of open supplier orders [read-only] |
attribute_items | array |
Products - attributes - attribute_items
Parameter | Type | Description |
---|---|---|
attribute_id | integer | Unique identifier for the resource. [read-only] |
attribute | string | Reference of the option |
attribute_name | string | Name of the option |
attribute_group_id | integer | ID of the option group (eg: 1 = Size, 2 = Color) |
lastsold | date | date the product is last sold [read-only] |
Get All Products
$ch = curl_init('https://api.onlinefact.be/products/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/products" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
[
{
"product_id":"8",
"reference":"MENTOS",
"reference2":"",
"barcode":"80723028",
"description":"Mentos White",
"price_excl":"3.301900",
"tax":"6.0",
"price_incl":"3.50",
"stock":"-27.00",
"categorie_id":"155",
"brand_id":"0",
"webshop":"0",
"dropship":"0",
"endoflife":"0",
"free_zone":"",
"binloc":"",
"binloc2":"",
"datemodified":"2022-10-25 11:47:14",
"supplier":"",
"HBK":"0",
"HBL":"21",
"managestock":"1",
"lastsold":"20-10-2022",
"categories":[
"155"
],
"barcodes":[
"80723028"
],
"languages":{
"NL":{
"description":"Mentos White",
"free_zone":""
},
"FR":{
"description":"Mentos Blanc",
"free_zone":""
}
},
"images":[
{
"image_id":"2",
"order":"1",
"datemodified":"2022-10-25 11:47:08",
"image_url":"https:\/\/admin.onlinefact.be\/image.php?image=cHJvZHVjdGltYWdlfDE1fDh8Mg=="
},
{
"image_id":"1",
"order":"2",
"datemodified":"2022-10-25 11:46:54",
"image_url":"https:\/\/admin.onlinefact.be\/image.php?image=cHJvZHVjdGltYWdlfDE1fDh8MQ=="
}
]
},
{
"product_id":"8105",
"reference":"P8105",
"reference2":"",
"barcode":"1501328314675",
"description":"Bloes Zomerprint",
"price_excl":"24.752100",
"tax":"21.0",
"price_incl":"29.95",
"stock":"-1.00",
"categorie_id":"0",
"brand_id":"0",
"webshop":"0",
"dropship":"0",
"endoflife":"0",
"free_zone":"",
"binloc":"",
"binloc2":"",
"datemodified":"2022-10-11 10:06:21",
"supplier":"",
"HBK":"0",
"HBL":"0",
"prodstocka":"1",
"categories":[
],
"images":[
],
"languages":{
"NL":{
"description":"Bloes Zomerprint",
"free_zone":""
},
"FR":{
"description":"",
"free_zone":""
}
},
"attributes":[
{
"product_id":"8107",
"reference":"P8105.L",
"barcode":"1463808308362",
"stock":"-1.00",
"addprice":0,
"webshop":"0",
"dropship":"0",
"endoflife":"0",
"hbk":"0",
"hbl":"0",
"attribute_items":[
{
"attribute_id":"5",
"attribute":"L",
"attribute_name":"Large",
"attribute_group_id":"1",
"lastsold":"11-10-2022"
}
]
},
{
"product_id":"8106",
"reference":"P8105.M",
"barcode":"1535955444924",
"stock":"-4.00",
"addprice":0,
"webshop":"0",
"dropship":"0",
"endoflife":"0",
"hbk":"5",
"hbl":"0",
"attribute_items":[
{
"attribute_id":"4",
"attribute":"M",
"attribute_name":"Medium",
"attribute_group_id":"1",
"lastsold":"11-10-2022"
}
]
},
{
"product_id":"8105",
"reference":"P8105.S",
"barcode":"1501328314675",
"stock":"-1.00",
"addprice":0,
"webshop":"0",
"dropship":"0",
"endoflife":"0",
"hbk":"0",
"hbl":"0",
"attribute_items":[
{
"attribute_id":"3",
"attribute":"S",
"attribute_name":"Small ",
"attribute_group_id":"1",
"lastsold":"11-10-2022"
}
]
}
]
}
]
This endpoint retrieves all products.
HTTPS Request
GET https://api.onlinefact.be/products/?PARAMETER=VALUE
Query Parameters
Parameter | Default | Description |
---|---|---|
limit | 100 | limit results (max 1000). |
page | 1 | page number of result. |
from_id | products added sinds this product_id | |
from_datemodified | products changed sinds this timestamp | |
description | part of description | |
reference | ||
reference2 | ||
categorie_id | ||
brand_id | ||
webshop | 1 = visible on webshop, 0 = NOT visible on webshop | |
dropship | 1 = dropshop ON , 0 = dropshop OFF | |
binloc | name of stock location | |
barcode |
Get a Specific Product
$ch = curl_init('https://api.onlinefact.be/products/8/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/products/8/" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
{
"product_id":"8",
"reference":"MENTOS",
"reference2":"",
"barcode":"80723028",
"description":"Mentos White",
"price_excl":"3.301900",
"tax":"6.0",
"price_incl":"3.50",
"stock":"-27.00",
"categorie_id":"155",
"brand_id":"0",
"webshop":"0",
"dropship":"0",
"endoflife":"0",
"free_zone":"",
"binloc":"",
"binloc2":"",
"datemodified":"2022-10-25 11:47:14",
"supplier":"",
"HBK":"0",
"HBL":"21",
"managestock":"1",
"lastsold":"20-10-2022",
"categories":[
"155"
],
"barcodes":[
"80723028"
],
"languages":{
"NL":{
"description":"Mentos White",
"free_zone":""
},
"FR":{
"description":"Mentos Blanc",
"free_zone":""
}
},
"images":[
{
"image_id":"2",
"order":"1",
"datemodified":"2022-10-25 11:47:08",
"image_url":"https:\/\/admin.onlinefact.be\/image.php?image=cHJvZHVjdGltYWdlfDE1fDh8Mg=="
},
{
"image_id":"1",
"order":"2",
"datemodified":"2022-10-25 11:46:54",
"image_url":"https:\/\/admin.onlinefact.be\/image.php?image=cHJvZHVjdGltYWdlfDE1fDh8MQ=="
}
]
}
This endpoint retrieves a specific product.
HTTPS Request
GET https://api.onlinefact.be/products/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the product to retrieve |
Add a Product
$data_string = '{"reference":"MENTOS",
"barcode":"80723028",
"description":"Mentos White 25pack",
"tax":"6",
"price_incl":"3.50",
"categorie_id":"155",
"supplier":"Carrefour",
"managestock":"1"
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/products/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/products/" \
-X POST \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{"reference":"MENTOS",
"barcode":"80723028",
"description":"Mentos White 25pack",
"tax":"6",
"price_incl":"3.50",
"categorie_id":"155",
"supplier":"Carrefour",
"managestock":"1"
}'
The above command returns JSON structured like this:
{
"product_id":"8",
"reference":"MENTOS",
"reference2":"",
"barcode":"80723028",
"description":"Mentos White 25pack",
"price_excl":"3.301900",
"tax":"6.0",
"price_incl":"3.50",
"stock":"0",
"categorie_id":"155",
"brand_id":"0",
"webshop":"0",
"dropship":"0",
"endoflife":"0",
"free_zone":"",
"binloc":"",
"binloc2":"",
"datemodified":"2022-10-25 11:47:14",
"supplier":"Carrefour",
"HBK":"0",
"HBL":"0",
"managestock":"1",
"categories":[
],
"barcodes":[
],
"images":[
]
}
This endpoint add a product.
HTTPS Request
POST https://api.onlinefact.be/products/
URL Parameters
Parameter | Description |
---|---|
reference | The unique SKU of the product |
Update a Product
$data_string = '{
"description":"Mentos White 25pack",
"supplier":"Carrefour"
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/products/8/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/products/8/" \
-X PUT \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{
"description":"Mentos White 25pack",
"supplier":"Carrefour"
}'
The above command returns JSON structured like this:
{
"product_id":"8",
"reference":"MENTOS",
"reference2":"",
"barcode":"80723028",
"description":"Mentos White 25pack",
"price_excl":"3.301900",
"tax":"6.0",
"price_incl":"3.50",
"stock":"-27.00",
"categorie_id":"155",
"brand_id":"0",
"webshop":"0",
"dropship":"0",
"endoflife":"0",
"free_zone":"",
"binloc":"",
"binloc2":"",
"datemodified":"2022-10-25 11:47:14",
"supplier":"Carrefour",
"HBK":"0",
"HBL":"21",
"managestock":"1",
"lastsold":"20-10-2022",
"categories":[
"155"
],
"barcodes":[
"80723028"
],
"images":[
]
}
This endpoint updates a specific product.
HTTPS Request
PUT https://api.onlinefact.be/products/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the product to update |
Delete a product
$ch = curl_init("https://api.onlinefact.be/products/8/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/products/8/" \
-X DELETE \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
{
"product_id": "8",
"deleted" : "success"
}
This endpoint deletes a specific product.
HTTPS Request
DELETE https://api.onlinefact.be/products/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the product to delete |
Categories
Parameter | Type | Description |
---|---|---|
category_id | integer | Unique identifier for the resource. [read-only] |
parent_id | integer | id of parent category |
name | string | Name of category. |
product_count | integer | number of products in category. [read-only] |
category_stock | decimal | items in stock in this category. [read-only] |
datemodified | date-time | date and time of last modification [read-only] |
sort_order | integer | sequence of display this categorie [read-only] (can only be changed in de backoffice) |
Get All Categories
$ch = curl_init('https://api.onlinefact.be/categories/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/categories/" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
[
{
"category_id":"5",
"parent_id":"0",
"name":"Clothes",
"product_count":"1",
"category_stock":"26.00",
"sort_order":"1",
"datemodified":"2022-10-25 11:47:14"
},
{
"category_id":"6",
"parent_id":"5",
"name":"T-shirts",
"product_count":"1",
"category_stock":"10.00",
"sort_order":"2",
"datemodified":"2022-10-25 11:47:14"
}
]
This endpoint retrieves all categories.
HTTPS Request
GET https://api.onlinefact.be/categories/
Query Parameters
Parameter | Default | Description |
---|---|---|
limit | 100 | limit results (max 1000). |
page | 1 | page number of result. |
Get a Specific Category
$ch = curl_init('https://api.onlinefact.be/categories/5/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/categories/5/" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
{
"category_id":"5",
"parent_id":"0",
"name":"Clothes",
"product_count":"1",
"category_stock":"26.00",
"sort_order":"1",
"datemodified":"2022-10-25 11:47:14"
}
This endpoint retrieves a specific category.
HTTPS Request
GET https://api.onlinefact.be/categories/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the category to retrieve |
Add a Category
$data_string = '{
"name":"Schoes",
"parent_id":5
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/categories/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/categories/" \
-X POST \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{
"name":"Shoes",
"parent_id":5
}'
The above command returns JSON structured like this:
{
"category_id":"8",
"parent_id":"5",
"name":"Shoes",
"product_count":"0",
"category_stock":"0.00",
"sort_order":"6",
"datemodified":"2022-10-25 11:47:14"
}
This endpoint add a categorie.
HTTPS Request
POST https://api.onlinefact.be/categories/
URL Parameters
Parameter | Description |
---|---|
name | name of the categorie |
parent_id | id of parent category |
Update a categorie
$data_string = '{
"name":"Jeans"
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/categories/8/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/categories/8/" \
-X PUT \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{
"name":"Jeans",
}'
The above command returns JSON structured like this:
{
"category_id":"8",
"parent_id":"5",
"name":"Jeans",
"product_count":"0",
"category_stock":"0.00",
"sort_order":"6",
"datemodified":"2022-10-25 11:47:14"
}
This endpoint updates a specific category.
HTTPS Request
PUT https://api.onlinefact.be/categories/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the catgory to update |
Delete a Category
$ch = curl_init("https://api.onlinefact.be/categories/8/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/categories/8/" \
-X DELETE \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
{
"category_id": "8",
"deleted" : "success"
}
This endpoint deletes a specific category.
HTTPS Request
DELETE https://api.onlinefact.be/categories/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the category to delete |
Brands
Parameter | Type | Description |
---|---|---|
brand_id | integer | Unique identifier for the resource. [read-only] |
name | string | Name of brand. |
datemodified | date-time | date and time of last modification [read-only] |
Get All Brands
$ch = curl_init('https://api.onlinefact.be/brands/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/brands/" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
[
{
"brand_id":"2",
"name":"Adidas",
"datemodified":"2022-10-25 11:47:14"
},
{
"brand_id":"3",
"name":"Coca Cola",
"datemodified":"2022-10-25 11:47:14"
},
{
"brand_id":"4",
"name":"Levis",
"datemodified":"2022-10-25 11:47:14"
}
]
This endpoint retrieves all brands.
HTTPS Request
GET https://api.onlinefact.be/brands/
Query Parameters
Parameter | Default | Description |
---|---|---|
limit | 100 | limit results (max 1000). |
page | 1 | page number of result. |
Get a Specific Brand
$ch = curl_init('https://api.onlinefact.be/brands/3/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/brands/3/" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
{
"brand_id":"3",
"name":"Coca Cola",
"datemodified":"2022-10-25 11:47:14"
}
This endpoint retrieves a specific brand.
HTTPS Request
GET https://api.onlinefact.be/brands/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the brand to retrieve |
Add a Brand
$data_string = '{
"name":"Samsung"
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/brands/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/brands/" \
-X POST \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{
"name":"Samsung"
}'
The above command returns JSON structured like this:
{
"brand_id":"75",
"name":"Samsung",
"datemodified":"2022-10-25 11:47:14"
}
This endpoint add a brand.
HTTPS Request
POST https://api.onlinefact.be/brands/
URL Parameters
Parameter | Description |
---|---|
name | name of the brand |
Update a brand
$data_string = '{
"name":"Apple"
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/brands/76/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/brands/76/" \
-X PUT \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{
"name":"Apple",
}'
The above command returns JSON structured like this:
{
"brand_id":"76",
"name":"Apple",
"datemodified":"2022-10-25 11:47:14"
}
This endpoint updates a specific brand.
HTTPS Request
PUT https://api.onlinefact.be/brands/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the brand to update |
Delete a Brand
$ch = curl_init("https://api.onlinefact.be/brands/76/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/brands/76/" \
-X DELETE \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
{
"brand_id": "76",
"deleted" : "success",
"datemodified":"2022-10-25 11:47:14"
}
This endpoint deletes a specific brand.
HTTPS Request
DELETE https://api.onlinefact.be/brands/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the brand to delete |
Customers
Parameter | Type | Description |
---|---|---|
customer_id | integer | Unique identifier for the resource. [read-only] |
reference | string | Unique code. |
taxnr | string | National TAX number. |
name | string | Name or company. |
name2 | string | |
address | string | Address of customer |
address2 | string | |
zip | string | Postal code for invoice |
city | string | City for invoice |
country_id | integer | ISO 3166-1 numeric code of the country |
country_iso | integer | ISO 3166-2 alpha-2 code of the country |
language_id | integer | 0 = default, 1 = NL, 2 = FR, 3 = EN, 4 = DE, 6 = TR |
mobile | string | Mobile phone number |
phone | string | Landline phone number |
string | Default email address of customer | |
birthdate | date | Birthdate of customer |
type | integer | 1 = customer, 2 = supplier, 3 = customer and supplier |
expirationdays | integer | Default days when document expires |
discount | decimal | fixed discount percentage on all products |
barcode | string | barcode of the loyalty card |
loyalty_points | integer | number of loyalty points collected |
delivery_name | string | Delivery address name |
delivery_address | string | Delivery address |
delivery_zip | string | Delivery address zip |
delivery_city | string | Delivery address city |
delivery_country | string | Delivery address country name |
datemodified | date-time | date and time of last modification [read-only] |
Get All Customers
$ch = curl_init('https://api.onlinefact.be/customers/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/customers" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
[
{
"customer_id":"23",
"reference":"DATACON",
"taxnr":"BE0894069190",
"name":"BVBA DATACON",
"name2":"",
"address":"Schootstraat 191",
"address2":"",
"zip":"3550",
"city":"Heusden-Zolder",
"country_id":"56",
"country_iso":"BE",
"mobile":"",
"phone":"+3211743319",
"email":"info@datacon-bvba.be",
"birthdate":"1981-12-31",
"type":"3",
"expirationdays":"14",
"discount":"0.00",
"barcode":"1000123",
"loyalty_points":10,
"delivery_name":"",
"delivery_address":"",
"delivery_zip":"",
"delivery_country":"",
"datemodified":"2022-10-25 11:47:14"
},
{
"customer_id":"67",
"reference":"ONLINEFACT",
"taxnr":"BE0123456789",
"name":"Onlinefact",
"name2":"Kristof Moons",
"address":"Schootstraat 191",
"address2":null,
"zip":"3550",
"city":"Heusden-Zolder",
"country_id":"56",
"country_iso":"BE",
"mobile":"011743319",
"phone":"",
"email":"info@onlinefact.be",
"birthdate":"0000-00-00",
"type":"1",
"expirationdays":"14",
"discount":"0.00",
"barcode":"1000124",
"loyalty_points":35,
"delivery_name":null,
"delivery_address":null,
"delivery_zip":null,
"delivery_country":null,
"datemodified":"2022-10-22 11:41:10"
}
]
This endpoint retrieves all customers.
HTTPS Request
GET https://api.onlinefact.be/customers/
Query Parameters
Parameter | Default | Description |
---|---|---|
limit | 100 | limit results (max 1000). |
page | 1 | page number of result. |
from_id | customer added sinds this customer_id | |
from_datemodified | customers changed sinds this timestamp | |
name | part of name | |
address | part of address | |
phone | part of phone number | |
mobile | part of mobile number |
Get a Specific Customer
$ch = curl_init('https://api.onlinefact.be/customers/23/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/customers/23/" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
{
"customer_id":"23",
"reference":"DATACON",
"taxnr":"BE0894069190",
"name":"BVBA DATACON",
"name2":"",
"address":"Schootstraat 191",
"address2":"",
"zip":"3550",
"city":"Heusden-Zolder",
"country_id":"56",
"country_iso":"BE",
"mobile":"",
"phone":"+3211743319",
"email":"info@datacon-bvba.be",
"birthdate":"1981-12-31",
"type":"3",
"expirationdays":"14",
"discount":"0.00",
"barcode":"1000123",
"loyalty_points":10,
"delivery_name":"",
"delivery_address":"",
"delivery_zip":"",
"delivery_country":"",
"datemodified":"2022-10-25 11:47:14"
}
This endpoint retrieves a specific customer.
HTTPS Request
GET https://api.onlinefact.be/customers/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the customer to retrieve |
Add a Customer
$data_string = '{
"reference":"DATACON",
"taxnr":"BE0894069190",
"name":"BVBA DATACON",
"address":"Kerkstraat 123",
"zip":"1000",
"city":"Brussels",
"country_id":"56",
"phone":"+3211743319",
"email":"info@datacon-bvba.be",
"birthdate":"1981-12-31",
"type":"3"
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/customers/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/customers/" \
-X POST \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{
"reference":"DATACON",
"taxnr":"BE0894069190",
"name":"BVBA DATACON",
"address":"Kerkstraat 123",
"zip":"1000",
"city":"Brussels",
"country_id":"56",
"phone":"+3211743319",
"email":"info@datacon-bvba.be",
"birthdate":"1981-12-31",
"type":"3"
}'
The above command returns JSON structured like this:
{
"customer_id":"23",
"reference":"DATACON",
"taxnr":"BE0894069190",
"name":"BVBA DATACON",
"name2":"",
"address":"Kerkstraat 123",
"address2":"",
"zip":"1000",
"city":"Brussels",
"country_id":"56",
"country_iso":"BE",
"mobile":"",
"phone":"+3211743319",
"email":"info@datacon-bvba.be",
"birthdate":"1981-12-31",
"type":"3",
"expirationdays":"14",
"discount":"0.00",
"barcode":"1000123",
"delivery_name":"",
"delivery_address":"",
"delivery_zip":"",
"delivery_country":"",
"datemodified":"2022-10-25 11:47:14"
}
This endpoint add a customer.
HTTPS Request
POST https://api.onlinefact.be/customers/
URL Parameters
Parameter | Description |
---|---|
reference | Unique code (if empty Onlinefact will generate unique id) |
Update a Customer
$data_string = '{
"address":"Kerkstraat 123",
"zip":"1000",
"city":"Brussels",
"loyalty_points":{"action":"add","amount":10}
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/customers/23/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/customers/23/" \
-X PUT \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{
"address":"Kerkstraat 123",
"zip":"1000",
"city":"Brussels",
"loyalty_points":{"action":"add","amount":10}
}'
The above command returns JSON structured like this:
{
"customer_id":"23",
"reference":"DATACON",
"taxnr":"BE0894069190",
"name":"BVBA DATACON",
"name2":"",
"address":"Kerkstraat 123",
"address2":"",
"zip":"1000",
"city":"Brussels",
"country_id":"56",
"country_iso":"BE",
"mobile":"",
"phone":"+3211743319",
"email":"info@datacon-bvba.be",
"birthdate":"1981-12-31",
"type":"3",
"expirationdays":"14",
"discount":"0.00",
"barcode":"1000123",
"loyalty_points":"10",
"delivery_name":"",
"delivery_address":"",
"delivery_zip":"",
"delivery_country":"",
"datemodified":"2022-10-28 10:59:59"
}
This endpoint updates a specific customer.
HTTPS Request
PUT https://api.onlinefact.be/customers/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the customer to update |
Customer - loyalty_points
Parameter | Type | Description |
---|---|---|
action | string | what todo with the amount (add,substract,new_amount) |
amount | integer | amount of modification of loyalty_points |
Delete a Customer
$ch = curl_init("https://api.onlinefact.be/customers/23/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/customers/23/" \
-X DELETE \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
{
"customer_id": "23",
"deleted" : "success"
}
This endpoint deletes a specific customer.
HTTPS Request
DELETE https://api.onlinefact.be/customers/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the customer to delete |
Vouchers
Parameter | Type | Description |
---|---|---|
voucher_id | integer | Unique identifier for the resource. [read-only] |
barcode | string | Barcode of the voucher. |
name | string | name of the voucher. |
datecreated | date | date when voucher is created. [read-only] |
amount | decimal | current value of the voucher. |
transactions | array |
vouchers - transactions
Parameter | Type | Description |
---|---|---|
transaction_id | integer | Unique identifier for the resource. [read-only] |
datecreated | date | date when transaction is created. [read-only] |
amount | decimal | amount of change + or - |
document_id | integer | ID of the document where the transaction is on. [read-only] |
document_number | string | document of this transaction. [read-only] |
comment | string | extra comment of transaction. |
Get All Vouchers
$ch = curl_init('https://api.onlinefact.be/vouchers/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/vouchers" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
[
{
"voucher_id":"60",
"barcode":"2000000015606",
"name":"Tegoedbon",
"datecreated":"2022-11-03",
"amount":0,
"transactions":[
{
"transaction_id":"77",
"datecreated":"2022-11-03",
"amount":"17.90",
"document_id":123,
"document_number":"Ticket 2022\/236",
"comment":""
},
{
"transaction_id":"78",
"datecreated":"2022-11-03",
"amount":"-17.90",
"document_id":124,
"document_number":"Ticket 2022\/237",
"comment":""
}
]
},
{
"voucher_id":"59",
"barcode":"2000000015590",
"name":"Cadeaubon",
"datecreated":"2022-11-03",
"amount":50,
"transactions":[
{
"transaction_id":"76",
"datecreated":"2022-11-03",
"amount":"50.00",
"document_id":126,
"document_number":"Ticket 2022\/232",
"comment":""
}
]
}
]
This endpoint retrieves all vouchers.
HTTPS Request
GET https://api.onlinefact.be/vouchers/
Query Parameters
Parameter | Default | Description |
---|---|---|
limit | 100 | limit results (max 1000). |
page | 1 | page number of result. |
barcode | search by barcode |
Get a Specific Voucher
$ch = curl_init('https://api.onlinefact.be/vouchers/59/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/vouchers/59/" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
{
"voucher_id":"59",
"barcode":"2000000015590",
"name":"Cadeaubon",
"datecreated":"2022-11-03",
"amount":50,
"transactions":[
{
"transaction_id":"76",
"datecreated":"2022-11-03",
"amount":"50.00",
"document_id":126,
"document_number":"Ticket 2022\/232",
"comment":""
}
]
}
This endpoint retrieves a specific voucher.
HTTPS Request
GET https://api.onlinefact.be/vouchers/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the vouchers to retrieve |
Add a Voucher
$data_string = '{
"name":"Gift Voucher",
"amount":25.00,
"comment":"webshop order #123"
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/vouchers/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/vouchers/" \
-X POST \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{
"name":"Gift Voucher",
"amount":25.00,
"comment":"webshop order #123"
}'
The above command returns JSON structured like this:
{
"voucher_id":"99",
"barcode":"2000000015606",
"name":"Gift Voucher",
"datecreated":"2022-11-03",
"amount":25.00,
"transactions":[
{
"transaction_id":"125",
"datecreated":"2022-11-03",
"amount":25.00,
"document_id":0,
"document_number":"Manual",
"comment":"webshop order #123"
},
]
}
This endpoint add a voucher.
HTTPS Request
POST https://api.onlinefact.be/vouchers/
URL Parameters
Parameter | Description |
---|---|
name | name of the voucher. |
amount | value of the voucher |
barcode | barcode of the voucher (not mandatory) |
comment | extra comment of the transcation |
Update a Voucher
$data_string = '{
"amount":-10.00,
"comment":"Webshop order #150"
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/vouchers/99/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/vouchers/23/" \
-X PUT \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{
"amount":-10.00,
"comment":"Webshop order #150"
}'
The above command returns JSON structured like this:
{
"voucher_id":"99",
"barcode":"2000000015606",
"name":"Gift Voucher",
"datecreated":"2022-11-03",
"amount":15.00,
"transactions":[
{
"transaction_id":"125",
"datecreated":"2022-11-03",
"amount":25.00,
"document_id":0,
"document_number":"Manual",
"comment":"webshop order #123"
},
{
"transaction_id":"155",
"datecreated":"2022-11-09",
"amount":-10.00,
"document_id":0,
"document_number":"Manual",
"comment":"Webshop order #150"
},
]
}
This endpoint updates a specific voucher.
HTTPS Request
PUT https://api.onlinefact.be/vouchers/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the voucher to update |
amount | amount of change + or - |
comment | extra comment of the transcation |
Delete a Voucher
$ch = curl_init("https://api.onlinefact.be/vouchers/99/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/vouchers/99/" \
-X DELETE \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
{
"voucher_id": "99",
"deleted" : "success"
}
This endpoint deletes a specific voucher.
HTTPS Request
DELETE https://api.onlinefact.be/vouchers/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the voucher to delete |
Documents
Parameter | Type | Description |
---|---|---|
document_id | integer | Unique identifier for the resource. [read-only] |
name | string | Name of documenttype. |
document_type | integer | 1 = offer, 2 = client order, 3 = invoice, 4 = creditnote, 5 = deliverynote, 8 = ticket. |
number | string | document number [read-only] |
document_date | data | date of document |
expiration_date | data | date of document |
reference | string | reference of document |
comments | string | comments on the document |
checkoutnumber | integer | number of checkout where the document is made |
paymentmsg | string | prefered message for payment [read-only] |
closed | integer | is document closed [read-only] |
currency | string | currency used [read-only] |
total_vatexcl | decimal | document total excl TAX [read-only] |
total_vatincl | decimal | document total incl TAX [read-only] |
total_vat | decimal | TAX amount [read-only] |
total_vatincl_beforerounding | decimal | total before rounding to 5c (if applied) [read-only] |
payd | decimal | amount already payd [read-only] |
saldo | decimal | open amount that is not payd yet [read-only] |
cash_discount | decimal | percentage of cash discount |
cash_discount_amount | decimal | amount of cash discount that can be applied [read-only] |
ogm | integer | unique document number used to do payments [read-only] |
user_created_name | string | name of Onlinefact user who created this document [read-only] |
user_created_id | integer | ID of Onlinefact user wo created this document [read-only] |
datemodified | datetime | timestamp of last modification [read-only] |
url_pdf | string | URL of PDF document [read-only] |
customer | array | |
delivery | array | |
lines | array | |
tax | array | |
payments | array | |
customfields | array |
Documents - customers
Parameter | Type | Description |
---|---|---|
customer_id | integer | Unique identifier for the resource. [read-only] |
reference | string | Unique code. |
name | string | Name or company. |
name2 | string | |
address | string | Address of customer |
address2 | string | |
zip | string | Postal code for invoice |
city | string | City for invoice |
phone | string | Landline phone number |
mobile | string | Mobile phone number |
taxnr | string | National TAX number. |
string | Default email address of customer | |
country | string | country name |
country_id | integer | ISO 3166-1 numeric code of the country |
Documents - delivery
Parameter | Type | Description |
---|---|---|
name | string | Delivery address name |
address | string | Delivery address |
zip | string | Delivery address zip |
city | string | Delivery address city |
country | string | Delivery address country name |
Documents - lines
Parameter | Type | Description |
---|---|---|
line | integer | line number [read-only] |
product_id | integer | Unique identifier of the product. [read-only] |
reference | string | reference of the product. |
reference2 | string | reference of the product. |
product_text | string | text if line is textbox |
description | string | text or productname on line |
costprice | decimal | cost price on this line |
price_vatexcl | decimal | unit price excl TAX |
price_vatincl | decimal | unit price incl TAX |
quantity | decimal | quantity |
delivered | decimal | quantity that is delivered but not invoiced yet (only document_type = 2) |
delivered_already | decimal | quantity that is delivered and invoiced (only document_type = 2) [read-only] |
unit | string | unit name |
unit_multipier | decimal | multiply amount for unit (total qty = quantity x unit_multipier) |
parent | decimal | if product is component of other product, this is the line number of main product |
tax | decimal | tax of this line |
discount | decimal | discount percentage |
subtotal_vat | decimal | TAX subtotal of line |
subtotal_vatexcl | decimal | subtotal of line excl TAX |
subtotal_vatincl | decimal | subtotal of line incl TAX |
Documents - tax
Parameter | Type | Description |
---|---|---|
tax_pct | decimal | Tax Percentage |
tax_excl | decimal | Total excl TAX of this Tax Percentage |
tax | decimal | Total TAX of this Tax Percentage |
tax_incl | decimal | Total incl TAX of this Tax Percentage |
Documents - payments
Parameter | Type | Description |
---|---|---|
type | integer | ID of payment method |
method | string | Name of payment method |
amount | decimal | Payment amount |
date | date | Date of this payment |
Documents - customfields
Parameter | Type | Description |
---|---|---|
{name of field} | string | value of field |
Get All Documents
$ch = curl_init('https://api.onlinefact.be/documents/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/documents/" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
[
{
"document_id":"468",
"name":"Bestelling",
"document_type":"2",
"number":"2022\/26",
"document_date":"2022-11-07",
"expiration_date":"2022-11-07",
"reference":"",
"comments":"\n",
"checkoutnumber":"1",
"paymentmsg":"+++000\/7667\/72771+++",
"closed":0,
"currency":"EUR",
"total_vatexcl":93.4000,
"total_vat":5.60,
"total_vatincl":99,
"total_vatincl_beforerounding":0,
"payd":null,
"saldo":99,
"cash_discount":"0.00",
"cash_discount_amount":0,
"ogm":"000766772771",
"user_created_name":"Kristof",
"user_created_id":"1",
"datemodified": "2022-11-07 11:18:44",
"url_pdf":"https:\/\/admin.onlinefact.be\/docview\/cXM5eWtmKzg5ZXlPWm9uUmpFRkphdz09",
"customer":{
"customer_id":"186",
"reference":"118464",
"name":"Vanessa Cristiano",
"name2":"",
"address":"Test",
"address2":"",
"zip":"3582",
"city":"Koersel",
"phone":"",
"mobile":"",
"taxnr":"",
"email":"vanessa@onlinefact.be",
"country":"Belgium",
"country_id":"56"
},
"delivery":{
"name":"",
"address":"",
"zip":"",
"city":"",
"country":""
},
"lines":[
{
"line":"1",
"product_id":"8034",
"reference":"P8034",
"reference2":"",
"product_text":"",
"description":"Boomschors",
"costprice":"0.000000",
"price_vatexcl":93.3962,
"price_vatincl":99,
"quantity":1,
"unit":"m³",
"unit_multiplier":"1.000000",
"parent":"0",
"tax":6,
"discount":0,
"subtotal_vat":5.60,
"subtotal_vatexcl":93.4000,
"subtotal_vatincl":99
},
{
"line":"2",
"product_id":"0",
"description":null,
"costprice":"0.000000",
"price_vatexcl":0,
"price_vatincl":0,
"quantity":1,
"unit":null,
"unit_multiplier":"1.000000",
"parent":"0",
"tax":6,
"discount":0,
"subtotal_vat":0,
"subtotal_vatexcl":0,
"subtotal_vatincl":0
}
],
"tax":[
{
"tax_pct":"6.0",
"tax_excl":93.4000,
"tax":5.60,
"tax_incl":99
}
],
"payments":[
],
"customfields":[
]
},
{
"document_id":"467",
"name":"Factuur",
"document_type":"3",
"number":"2022\/83",
"document_date":"2022-11-07",
"expiration_date":"2022-11-21",
"reference":null,
"comments":"",
"checkoutnumber":"0",
"paymentmsg":"+++000\/7651\/34380+++",
"closed":0,
"currency":"EUR",
"total_vatexcl":29.6600,
"total_vat":4.94,
"total_vatincl":34.60,
"total_vatincl_beforerounding":0,
"payd":34.60,
"saldo":0,
"cash_discount":"0.00",
"cash_discount_amount":0,
"ogm":"000765134380",
"user_created_name":"Kristof",
"user_created_id":"1",
"datemodified": "2022-11-07 11:18:44",
"url_pdf":"https:\/\/admin.onlinefact.be\/docview\/OCs3Ny93VWp0R0JHWEx3SWZkK1lJdz09",
"customer":{
"customer_id":"23",
"reference":"DATACON",
"name":"BVBA DATACON 6",
"name2":"",
"address":"Schootstraat 191",
"address2":"",
"zip":"3550",
"city":"Heusden-Zolder",
"phone":"+3211743319",
"mobile":"",
"taxnr":"BE0894069190",
"email":"info@datacon-bvba.be",
"country":"Belgium",
"country_id":"56"
},
"delivery":{
"name":"",
"address":"",
"zip":"",
"city":"",
"country":""
},
"lines":[
{
"line":"1",
"product_id":"8",
"reference":"MENTOS",
"reference2":"",
"product_text":"",
"description":"Mentos White",
"costprice":"1.500000",
"price_vatexcl":2.0283,
"price_vatincl":2.15,
"quantity":5,
"unit":"ST",
"unit_multiplier":"1.000000",
"parent":"0",
"tax":6,
"discount":0,
"discount":15,
"subtotal_vat":0.52,
"subtotal_vatexcl":8.6200,
"subtotal_vatincl":9.14
},
{
"line":"2",
"product_id":"8106",
"reference":"P8105.M",
"reference2":"",
"product_text":"",
"description":"Bloes Zomerprint Medium",
"costprice":"0.000000",
"price_vatexcl":24.7521,
"price_vatincl":29.95,
"quantity":1,
"unit":"",
"unit_multiplier":"1.000000",
"parent":"0",
"tax":21,
"discount":0,
"discount":15,
"subtotal_vat":4.42,
"subtotal_vatexcl":21.0400,
"subtotal_vatincl":25.46
},
{
"line":"3",
"product_id":"0",
"description":null,
"costprice":"0.000000",
"price_vatexcl":0,
"price_vatincl":0,
"quantity":1,
"unit":null,
"unit_multiplier":"1.000000",
"parent":"0",
"tax":21,
"discount":0,
"subtotal_vat":0,
"subtotal_vatexcl":0,
"subtotal_vatincl":0
}
],
"tax":[
{
"tax_pct":"6.0",
"tax_excl":8.62,
"tax":0.52,
"tax_incl":9.14
},
{
"tax_pct":"21.0",
"tax_excl":21.04,
"tax":4.42,
"tax_incl":25.46
}
],
"payments":[
{
"type":"2",
"method":"Cash",
"amount":"34.60",
"date":"2022-11-07"
}
],
"customfields":[
]
}
]
This endpoint retrieves all documents.
HTTPS Request
GET https://api.onlinefact.be/documents/
Query Parameters
Parameter | Default | Description |
---|---|---|
min_date | date | Return documents for a specific start date, the date need to be in the YYYY-MM-DD format [optional] |
max_date | date | Return documents for a specific end date, the date need to be in the YYYY-MM-DD format [optional] |
document_type | integer | 1 = offer, 2 = client order, 3 = invoice, 4 = creditnote, 5 = deliverynote, 8 = ticket |
from_document_id | integer | Return documents from this document_id |
from_datemodified | integer | Return documents from this timestamp unix timestamp format |
filter | string | Filter result with string data (customer reference/name) |
limit | 10 | limit results (max 100). |
page | 1 | page number of result. |
Get a Specific Document
$ch = curl_init('https://api.onlinefact.be/documents/468/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/documents/468/" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
{
"document_id":"468",
"name":"Bestelling",
"document_type":"2",
"number":"2022\/26",
"document_date":"2022-11-07",
"expiration_date":"2022-11-07",
"reference":"",
"comments":"\n",
"checkoutnumber":"1",
"paymentmsg":"+++000\/7667\/72771+++",
"closed":0,
"currency":"EUR",
"total_vatexcl":93.4000,
"total_vat":5.60,
"total_vatincl":99,
"total_vatincl_beforerounding":0,
"payd":null,
"saldo":99,
"cash_discount":"0.00",
"cash_discount_amount":0,
"ogm":"000766772771",
"user_created_name":"Kristof",
"user_created_id":"1",
"datemodified": "2022-11-07 11:18:44",
"url_pdf":"https:\/\/admin.onlinefact.be\/docview\/cXM5eWtmKzg5ZXlPWm9uUmpFRkphdz09",
"customer":{
"customer_id":"186",
"reference":"118464",
"name":"Vanessa Cristiano",
"name2":"",
"address":"Test",
"address2":"",
"zip":"3582",
"city":"Koersel",
"phone":"",
"mobile":"",
"taxnr":"",
"email":"vanessa@onlinefact.be",
"country":"Belgium",
"country_id":"56"
},
"delivery":{
"name":"",
"address":"",
"zip":"",
"city":"",
"country":""
},
"lines":[
{
"line":"1",
"product_id":"8034",
"reference":"P8034",
"reference2":"",
"product_text":"",
"description":"Boomschors",
"costprice":"0.000000",
"price_vatexcl":93.3962,
"price_vatincl":99,
"quantity":1,
"unit":"m³",
"unit_multiplier":"1.000000",
"parent":"0",
"tax":6,
"discount":0,
"subtotal_vat":5.60,
"subtotal_vatexcl":93.4000,
"subtotal_vatincl":99
},
{
"line":"2",
"product_id":"0",
"description":null,
"costprice":"0.000000",
"price_vatexcl":0,
"price_vatincl":0,
"quantity":1,
"unit":null,
"unit_multiplier":"1.000000",
"parent":"0",
"tax":6,
"discount":0,
"subtotal_vat":0,
"subtotal_vatexcl":0,
"subtotal_vatincl":0
}
],
"tax":[
{
"tax_pct":"6.0",
"tax_excl":93.40,
"tax":5.60,
"tax_incl":99
}
],
"payments":[
],
"customfields":[
]
}
This endpoint retrieves a specific document.
HTTPS Request
GET https://api.onlinefact.be/documents/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the document to retrieve |
Add a Document
$data_string = '{
"document_type":2,
"document_date":"2022-11-07",
"expiration_date":"2022-11-07",
"document_time":"12:35",
"reference":"",
"customer_id":23,
"payment_method":8,
"lines":[
{
"reference":"MENTOS",
"quantity":1,
"description":"Menthos White 25 pack",
"price_vatexcl":5.6132,
"tax":6,
"discount":0
},
{
"reference":"LAYSPAP30",
"quantity":2,
"description":"Lays paprika 30 g",
"price_vatexcl":1.6509,
"tax":6,
"discount":0
}
]
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/documents/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/documents/" \
-X POST \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{
"document_type":2,
"document_date":"2022-11-07",
"expiration_date":"2022-11-07",
"document_time":"12:35",
"reference":"",
"customer_id":23,
"payment_method":8,
"lines":[
{
"reference":"MENTOS",
"quantity":1,
"description":"Menthos White 25 pack",
"price_vatexcl":5.6132,
"tax":6,
"discount":0
},
{
"reference":"LAYSPAP30",
"quantity":2,
"description":"Lays paprika 30 g",
"price_vatexcl":1.6509,
"tax":6,
"discount":0
}
]
}'
The above command returns JSON structured like this:
{
"document_id":"475",
"name":"Bestelling",
"document_type":"2",
"number":"2022\/29",
"document_date":"2022-11-07",
"expiration_date":"2022-11-07",
"reference":"",
"comments":"",
"checkoutnumber":"0",
"paymentmsg":"+++000\/7782\/41508+++",
"closed":0,
"currency":"EUR",
"total_vatexcl":8.92,
"total_vat":0.53,
"total_vatincl":9.45,
"total_vatincl_beforerounding":0,
"payd":9.45,
"saldo":0,
"cash_discount":"0.00",
"cash_discount_amount":0,
"ogm":"000778241508",
"user_created_name":"",
"user_created_id":"",
"datemodified": "2022-11-07 11:18:44",
"url_pdf":"https:\/\/admin.onlinefact.be\/docview\/MDg2RnVWZHVzVSt0Y2NNSE50S3lMdz09",
"customer":{
"customer_id":"23",
"reference":"DATACON",
"name":"BVBA DATACON",
"name2":"",
"address":"Schootstraat 191",
"address2":"",
"zip":"3550",
"city":"Heusden-Zolder",
"phone":"+3211743319",
"mobile":"",
"taxnr":"BE0894069190",
"email":"info@datacon-bvba.be",
"country":"Belgium",
"country_id":"56"
},
"delivery":{
"name":"",
"address":"",
"zip":"",
"city":"",
"country":""
},
"lines":[
{
"line":"1",
"product_id":"8",
"reference":"MENTOS",
"reference2":"",
"product_text":"",
"description":"Menthos White 25 pack",
"costprice":"1.500000",
"price_vatexcl":5.6132,
"price_vatincl":5.95,
"quantity":1,
"delivered":0,
"alreadydelivered":0,
"unit":"ST",
"unit_multiplier":"1.000000",
"parent":"0",
"tax":6,
"discount":0,
"subtotal_vat":0.34,
"subtotal_vatexcl":5.61,
"subtotal_vatincl":5.95
},
{
"line":"2",
"product_id":"7675",
"reference":"LAYSPAP30",
"reference2":"",
"product_text":"",
"description":"Lays paprika 30 g",
"costprice":"0.500000",
"price_vatexcl":1.6509,
"price_vatincl":1.75,
"quantity":2,
"delivered":0,
"alreadydelivered":0,
"unit":"",
"unit_multiplier":"1.000000",
"parent":"0",
"tax":6,
"discount":0,
"subtotal_vat":0.20,
"subtotal_vatexcl":3.30,
"subtotal_vatincl":3.5
}
],
"tax":[
{
"tax_pct":"6.0",
"tax_excl":8.92,
"tax":0.53,
"tax_incl":9.45
}
],
"payments":[
{
"type":"8",
"method":"Webshop",
"amount":"9.45",
"date":"2022-11-07"
}
],
"customfields":null
}
This endpoint add a document.
HTTPS Request
POST https://api.onlinefact.be/documents/
URL Parameters
Parameter | Description |
---|---|
document_date | Document date |
document_time | Document time |
document_type | 1 = offer, 2 = client order, 3 = invoice, 4 = creditnote, 5 = deliverynote, 8 = ticket, 99 = Kassa parking |
reference | reference of document |
customer_id | ID of customer for this document |
payment_method | type of payment used (1 = not payd, 2 = cash, 3 = banktransfer, 4 = creditcard, 5 = cheque, 6 = bancontact, 8 = webshop, 11 = paypal, 99 = voucher) |
lines | array |
Documents - lines
Parameter | Description |
---|---|
reference | reference of the product to find it in the database (product_id can also be used) |
description | text or productname |
quantity | quantity |
price_vatexcl | unit price excl TAX |
tax | tax of this line |
discount | discount on this line |
delivered | number of items picked (only for document_type = 2) |
Update a Document
$data_string = '{
"expiration_date":"2022-11-10",
"reference":"ABCD123"
"lines":[
{
"line":"1",
"description":"MENTOS met een smaakje",
"quantity":3,
},
{
"line":"2",
"delivered":1,
}
]
}'; //JSON String
$ch = curl_init("https://api.onlinefact.be/documents/475/");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/documents/475/" \
-X PUT \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
-d '{
"expiration_date":"2022-11-10",
"reference":"ABCD123"
"lines":[
{
"line":"1",
"description":"MENTOS met een smaakje",
"quantity":3,
},
{
"line":"2",
"picked":1,
}
]
}'
The above command returns JSON structured like this:
{
"document_id":"475",
"name":"Bestelling",
"document_type":"2",
"number":"2022\/29",
"document_date":"2022-11-07", //Update possible
"expiration_date":"2022-11-10", //Update possible
"reference":"ABCD123", //Update possible
"comments":"",
"checkoutnumber":"0",
"paymentmsg":"+++000\/7782\/41508+++",
"closed":0,
"currency":"EUR",
"total_vatexcl":8.92,
"total_vat":0.53,
"total_vatincl":9.45,
"total_vatincl_beforerounding":0,
"payd":9.45,
"saldo":0,
"cash_discount":"0.00",
"cash_discount_amount":0,
"ogm":"000778241508",
"user_created_name":"",
"user_created_id":"",
"datemodified": "2022-11-07 11:18:44",
"url_pdf":"https:\/\/admin.onlinefact.be\/docview\/MDg2RnVWZHVzVSt0Y2NNSE50S3lMdz09",
"customer":{
"customer_id":"23", //Update possible
"reference":"DATACON",
"name":"BVBA DATACON",
"name2":"",
"address":"Schootstraat 191",
"address2":"",
"zip":"3550",
"city":"Heusden-Zolder",
"phone":"+3211743319",
"mobile":"",
"taxnr":"BE0894069190",
"email":"info@datacon-bvba.be",
"country":"Belgium",
"country_id":"56"
},
"delivery":{
"name":"",
"address":"",
"zip":"",
"city":"",
"country":""
},
"lines":[
{
"line":"1",
"product_id":"8",
"reference":"MENTOS",
"reference2":"",
"product_text":"",
"description":"MENTOS met een smaakje", //Update possible
"costprice":"1.500000",
"price_vatexcl":5.6132, //Update possible
"price_vatincl":5.95,
"quantity":3, //Update possible
"delivered":0, //Update possible
"alreadydelivered":0,
"unit":"ST",
"unit_multiplier":"1.000000",
"parent":"0",
"tax":6, //Update possible
"discount":0, //Update possible
"subtotal_vat":1.02,
"subtotal_vatexcl":16.83,
"subtotal_vatincl":17.85
},
{
"line":"2",
"product_id":"7675",
"reference":"LAYSPAP30",
"reference2":"",
"product_text":"",
"description":"Lays paprika 30 g", //Update possible
"costprice":"0.500000",
"price_vatexcl":1.6509, //Update possible
"price_vatincl":1.75,
"quantity":2, //Update possible
"delivered":1, //Update possible
"alreadydelivered":0,
"unit":"",
"unit_multiplier":"1.000000",
"parent":"0",
"tax":6, //Update possible
"discount":0, //Update possible
"subtotal_vat":0.20,
"subtotal_vatexcl":3.30,
"subtotal_vatincl":3.5
}
],
"tax":[
{
"tax_pct":"6.0",
"tax_excl":8.92,
"tax":0.53,
"tax_incl":9.45
}
],
"payments":[
{
"type":"8",
"method":"Webshop",
"amount":"9.45",
"date":"2022-11-07"
}
],
"customfields":null
}
This endpoint updates a specific document.
Use the 'lines' array and 'line' value to specify what line of the document to update. If you want to add a line just put 'line:0'.
HTTPS Request
PUT https://api.onlinefact.be/documents/<ID>
URL Parameters
Parameter | Description |
---|---|
ID | The ID of the docmument to update |
Reports
Sale totals per day
$ch = curl_init('https://api.onlinefact.be/reports/saletotals/?min_date=2022-07-27&max_date=2022-07-28');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/reports/saletotals/?min_date=2022-07-27&max_date=2022-07-28" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
[
{
"date":"2022-07-27",
"document_type":8,
"checkoutnumber":0,
"filter":null,
"total_tax_excl":2258.77,
"total_tax":135.54,
"total_tax_incl":2394.31,
"transactions":101,
"tax_totals":[
{
"percentage":6,
"total_tax_excl":2258.77,
"total_tax":135.54,
"total_tax_incl":2394.31
}
],
"payments":[
{
"payment_method":2,
"amount":884.62
},
{
"payment_method":4,
"amount":76.75
},
{
"payment_method":6,
"amount":1267.45
},
{
"payment_method":13,
"amount":82.68
},
{
"payment_method":20,
"amount":82.8
}
]
},
{
"date":"2022-07-28",
"document_type":8,
"checkoutnumber":0,
"filter":null,
"total_tax_excl":2209.21,
"total_tax":132.52,
"total_tax_incl":2341.73,
"transactions":85,
"tax_totals":[
{
"percentage":6,
"total_tax_excl":2209.21,
"total_tax":132.52,
"total_tax_incl":2341.73
}
],
"payments":[
{
"payment_method":2,
"amount":817.55
},
{
"payment_method":4,
"amount":49.3
},
{
"payment_method":6,
"amount":1269.9
},
{
"payment_method":13,
"amount":167.6
},
{
"payment_method":20,
"amount":37.5
}
]
}
]
This endpoint retrieves the sale totals per day.
HTTPS Request
GET https://api.onlinefact.be/reports/saletotals/
Query Parameters
Parameter | Type | Description |
---|---|---|
min_date | date | Return sales for a specific start date, the date need to be in the YYYY-MM-DD format [mandatory] |
max_date | date | Return sales for a specific end date, the date need to be in the YYYY-MM-DD format [mandatory] |
document_type | integer | 1 = offer, 2 = client order, 3 = invoice, 4 = creditnote, 5 = deliverynote, 8 = ticket |
checkoutnumber | integer | POS number |
filter | string | Filter result with string data (customer reference/name) |
Result Parameters
Parameter | Type | Description |
---|---|---|
document_type | integer | Type of document (1 = offer, 2 = client order, 3 = invoice, 4 = creditnote, 5 = deliverynote, 8 = ticket) |
checkoutnumber | integer | POS number (0 = all) |
total_tax_excl | decimal | Total of day excl vat |
total_tax | decimal | Total of day vat |
total_tax_incl | decimal | Total of day incl vat |
transactions | integer | Total number of transactions (documents) |
tax_totals | array | Totals per vat percentage |
payments | array | Totals per payment method (1 = not payd, 2 = cash, 3 = banktransfer, 4 = creditcard, 5 = cheque, 6 = bancontact, 8 = webshop, 11 = paypal, 99 = voucher) |
Sales per product
$ch = curl_init('https://api.onlinefact.be/reports/salesperproduct/?min_date=2022-07-27&max_date=2022-07-28');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/reports/salesperproduct/?min_date=2022-07-27&max_date=2022-07-28" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
[
{
"product_id":1477,
"reference":"1490",
"reference2":"",
"description":"ziesner curry ketchup 800 ml ",
"category":"default",
"subcategory":"",
"stock":15,
"purchase_price":0,
"cost_price":0,
"price_vat_excl":4.7075,
"price_vat_incl":4.99,
"tax":6,
"sum_qty":1,
"average_price_excl":4.71,
"average_price_incl":4.99,
"total_price_excl":4.71,
"total_price_incl":4.99,
"search_query":{
"document_type":8,
"checkoutnumber":0,
"date_min":"2022-11-02",
"date_max":"2022-11-03",
"filter":null
}
},
{
"product_id":4892,
"reference":"5471",
"reference2":"",
"description":"ZEISNER TOMATEN KETCHUP 800 ML ",
"category":"default",
"subcategory":"",
"stock":8,
"purchase_price":0,
"cost_price":0,
"price_vat_excl":4.7075,
"price_vat_incl":4.99,
"tax":6,
"sum_qty":2,
"average_price_excl":4.71,
"average_price_incl":4.99,
"total_price_excl":9.42,
"total_price_incl":9.98,
"search_query":{
"document_type":8,
"checkoutnumber":0,
"date_min":"2022-11-02",
"date_max":"2022-11-03",
"filter":null
}
}
]
This endpoint retrieves the total products sold in a period.
HTTPS Request
GET https://api.onlinefact.be/reports/salesperproduct/
Query Parameters
Parameter | Type | Description |
---|---|---|
min_date | date | Return sales for a specific start date, the date need to be in the YYYY-MM-DD format [mandatory] |
max_date | date | Return sales until a specific end date, the date need to be in the YYYY-MM-DD format [mandatory] |
document_type | integer | 1 = offer, 2 = client order, 3 = invoice, 4 = creditnote, 5 = deliverynote, 8 = ticket |
checkoutnumber | integer | POS number |
opendocuments | integer | 0 = all documents, 1 = only from open documents |
filter | string | Filter result with string data (product reference/name, supplier, category name, brand name) |
Result Parameters
Parameter | Type | Description |
---|
Sales per relation
$ch = curl_init('https://api.onlinefact.be/reports/salesperrelation/?min_date=2022-07-27&max_date=2022-07-28');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/reports/salesperrelation/?min_date=2022-07-27&max_date=2022-07-28" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
[
{
"customer_id":186,
"customer_reference":"118464",
"taxnr":"",
"name":"Kristof Moons",
"name2":"",
"address":"Schootstraat 191",
"address2":"",
"zip":"3550",
"city":"Heusden-Zolder",
"country_id":21,
"country":"Belgium",
"mobile":"",
"phone":"",
"email":"kristof@onlinefact.be",
"type":"Customer",
"birthdate":"",
"product_id":8039,
"product_reference":"P8039.S",
"product_reference2":"",
"barcode":"1584796623647",
"description":"Bloemenkleed",
"category":"",
"subcategory":"",
"brand":"",
"supplier":"",
"stock":5,
"sum_qty":1,
"average_price_excl":41.321,
"average_price_incl":43.8,
"total_price_excl":41.32,
"total_price_incl":43.8
},
{
"customer_id":197,
"customer_reference":"K197",
"taxnr":"BE012456789",
"name":"Vanessa Cristiano",
"name2":null,
"address":"Schootstraat 191",
"address2":null,
"zip":"3550",
"city":"Heusden-Zolder",
"country_id":21,
"country":"Belgium",
"mobile":"0472123456",
"phone":"011743319",
"email":"info@onlinefact.be",
"type":"Customer",
"birthdate":"",
"product_id":8025,
"product_reference":"KAA25LAV",
"product_reference2":"",
"barcode":"1972141885855",
"description":"Geurkaars 25cm Lavendel",
"category":null,
"subcategory":"",
"brand":"",
"supplier":"SPAAS",
"stock":5,
"sum_qty":20,
"average_price_excl":8.223,
"average_price_incl":9.95,
"total_price_excl":164.46,
"total_price_incl":199
}
]
This endpoint retrieves the total products sold in a period to a specific relation.
HTTPS Request
GET https://api.onlinefact.be/reports/saleperrelation/
Query Parameters
Parameter | Type | Description |
---|---|---|
min_date | date | Return sales for a specific start date, the date need to be in the YYYY-MM-DD format [mandatory] |
max_date | date | Return sales until specific end date, the date need to be in the YYYY-MM-DD format [mandatory] |
document_type | integer | 1 = offer, 2 = client order, 3 = invoice, 4 = creditnote, 5 = deliverynote, 8 = ticket |
opendocuments | integer | 0 = all documents, 1 = only from open documents |
filter | string | Filter result with string data (relation reference/name, product reference/name, supplier, category name) |
Result Parameters
Parameter | Type | Description |
---|
Documents list
$ch = curl_init('https://api.onlinefact.be/reports/documents/?min_date=2022-07-27&max_date=2022-07-28');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "api_key_here:api_secret_here");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
curl "https://api.onlinefact.be/reports/documents/?min_date=2022-07-27&max_date=2022-07-28" \
-X GET \
-u "api_key_here:api_secret_here" \
-H "Content-Type: application/json" \
The above command returns JSON structured like this:
[
{
"document_type":8,
"document_id":707,
"document_number":"2023\/105",
"closed":0,
"document_date":"2022-07-27",
"document_time":"14:33:05",
"document_expiration":"2023-01-30",
"datemodified": "2022-11-07 11:18:44",
"OGM":"001\/1583\/50354",
"document_reference":"",
"document_comments":"",
"customer_id":2,
"customer_reference":"REG",
"taxnr":"",
"name":"Cash Register 14:33",
"name2":"",
"address":"",
"address2":"",
"zip":"",
"city":"",
"country_id":21,
"country":"Belgium",
"mobile":"",
"phone":"",
"email":"",
"user_created":"2",
"user_created_name":"",
"checkout_number":3,
"document_cashdisc":0,
"total_tax_excl":250,
"total_tax_incl":250,
"profit":250,
"saldo":0,
"payment_status":"Cash",
"payments":[
{
"Type":2,
"Method":"Cash",
"Amount":250,
"Date":"2022-07-27"
}
],
"tax_totals":[
{
"percentage":0,
"total_tax_excl":250,
"total_tax":0,
"total_tax_incl":250
}
],
"search_query":{
"document_type":8,
"checkoutnumber":"3",
"date_min":"2022-07-27",
"date_max":"2022-07-28",
"filter":null
}
},
{
"document_type":8,
"document_id":708,
"document_number":"2023\/106",
"closed":0,
"document_date":"2022-07-28",
"document_time":"14:51:18",
"document_expiration":"2023-01-30",
"datemodified": "2022-11-07 11:18:44",
"OGM":"001\/1599\/88745",
"document_reference":null,
"customer_id":201,
"customer_reference":"K201",
"document_comments":"",
"taxnr":"BE0123456789",
"name":"Datacon BVBA",
"name2":"",
"address":"Schootstraat 191",
"address2":"",
"zip":"3550",
"city":"Heusden-Zolder",
"country_id":21,
"country":"Belgium",
"mobile":"",
"phone":"",
"email":"",
"user_created":"2",
"user_created_name":"Kristof",
"checkout_number":3,
"document_cashdisc":0,
"total_tax_excl":41.32,
"total_tax_incl":50,
"profit":41.32,
"saldo":50,
"payment_status":"Te Betalen",
"payments":[
],
"tax_totals":[
{
"percentage":21,
"total_tax_excl":41.32,
"total_tax":8.68,
"total_tax_incl":50
}
],
"search_query":{
"document_type":8,
"checkoutnumber":"3",
"date_min":"2022-07-27",
"date_max":"2022-07-28",
"filter":null
}
}
]
This endpoint retrieves the document list for a specific period.
HTTPS Request
GET https://api.onlinefact.be/reports/documents/
Query Parameters
Parameter | Type | Description |
---|---|---|
min_date | date | Return sales for a specific start date, the date need to be in the YYYY-MM-DD format [mandatory] |
max_date | date | Return sales for a specific end date, the date need to be in the YYYY-MM-DD format [mandatory] |
document_type | integer | 1 = offer, 2 = client order, 3 = invoice, 4 = creditnote, 5 = deliverynote, 8 = ticket |
onlyopen | integer | 1 = only open documents, 0 = open and closed documents |
customer_reference | string | only documents with this customer reference |
filter | string | Filter result with string data (customer reference/name) |
Result Parameters
Parameter | Type | Description |
---|---|---|
document_type | integer | Type of document (1 = offer, 2 = client order, 3 = invoice, 4 = creditnote, 5 = deliverynote, 8 = ticket) |
document_id | integer | Internal document ID of the document |
document_number | varchar | Number of the document |
closed | integer | is document closed |
document_date | date | |
document_time | time | |
document_expiration | date | |
datemodified | datetime | timestamp of last modification |
OGM | varchar | |
document_reference | varchar | |
document_comments | varchar | |
customer_id | integer | |
customer_reference | varchar | |
taxnr | varchar | |
name | varchar | |
name2 | varchar | |
address | varchar | |
address2 | varchar | |
zip | varchar | |
city | varchar | |
country_id | integer | |
country | varchar | |
mobile | varchar | |
phone | varchar | |
varchar | ||
user_created | integer | |
user_created_name | varchar | |
checkout_number | integer | |
document_cashdisc | decimal | |
total_tax_excl | decimal | Total of day excl vat |
total_tax_incl | decimal | Total of day incl vat |
profit | decimal | |
saldo | decimal | |
payment_status | varchar | |
payments | array | Totals per payment method (1 = not payd, 2 = cash, 3 = banktransfer, 4 = creditcard, 5 = cheque, 6 = bancontact, 8 = webshop, 11 = paypal, 99 = voucher) |
tax_totals | array | Totals per vat percentage |
Errors
The Onlinefact API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
404 | Not Found -- The specified data could not be found. |
406 | Not Acceptable -- You requested a format that isn't json. |
429 | Too Many Requests -- You're requesting too many data! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |