This documentation aims to provide all the information you need to work with our API.
To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}". All authenticated endpoints are marked with a requires authentication badge in the documentation below. You can retrieve your token by visiting your dashboard and clicking Generate API token.
{
"email": "youremail@gmail.com",
"password": "your-password"
}
$client = new \GuzzleHttp\Client();
$response = $client->post(
'{base_url}/api/login',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
{
"access_token": "access-token",
"token_type": "Bearer",
"expires_at": "2023-05-05 10:46:37"
}
Body Parameters
{
"salesorder_number": "MFT00001",
"total": "4300.00",
"country_id": 1,
"notes": "Sample Note",
"shipment_date": "2022-05-07",
"status": "Collected",
"delivery_status": "Collected",
"client": {
"name": "Jim martins",
"email": null,
"city": "Nairobi",
"phone": "+254713012437",
"address": "Hazina towers 8th floor"
},
"line_items": [
{
"id": 18,
"product_name": "Test",
"quantity": 2
}
]
}
$client = new \GuzzleHttp\Client();
$response = $client->post(
'{base_url}/api/salesorders',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'[{' => 'voluptas',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
requires authentication
$client = new \GuzzleHttp\Client();
$response = $client->get(
'{base_url}/api/salesorders',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
{
"data": [
{
"id": 84843,
"order_no": "MFT00001",
"total_price": "4300.00",
"customer_notes": "Sample Note",
"shipping_charges": "0.00",
"delivery_date": "2022-05-07",
"status": "Confirmed",
"delivery_status": "Scheduled",
"payment_method": null,
"invoiced": 0,
"confirmed": true,
"order_history": [
{
"id": 321216,
"action": "Order received",
"sale_id": 84843,
"created_at": "Wed 04 May 2022 09:32:48",
"updated_at": "2022-05-04T09:32:48.000000Z"
},
{
"id": 321217,
"action": "Order updated",
"updated_fields": {
"updated": {
"delivery_status": "Inprogress",
"updated_at": "2022-05-05 08:34:53"
},
"original": {
"delivery_status": "Collected",
"history_comment": null
}
},
"sale_id": 84843,
"created_at": "Thu 05 May 2022 05:34:55",
"updated_at": "2022-05-05T05:34:55.000000Z"
},
{
"id": 321218,
"action": "Order updated",
"updated_fields": {
"updated": {
"delivery_date": "2022-05-07",
"status": "Confirmed",
"delivery_status": "Scheduled",
"confirmed": true,
"updated_at": "2022-05-05 08:36:51"
},
"original": {
"delivery_date": "2022-05-07",
"status": "Inprogress",
"delivery_status": "Inprogress",
"confirmed": false,
}
},
"sale_id": 84843,
"created_at": "Thu 05 May 2022 05:36:53",
"updated_at": "2022-05-05T05:36:53.000000Z"
}
],
"products": [
{
"id": 2181,
"product_name": "Blacklatte",
"sku_no": "SKU_00000002181",
"active": 1,
"created_at": "Thu 10 Mar 2022",
"updated_at": "2022-03-10T10:44:21.000000Z"
}
],
"client": {
"id": 35668,
"user_id": 1,
"name": "Jim martins",
"city": null,
"email": null,
"phone": "+2547121012437",
"address": "Mombasa",
"created_at": "25 Nov 2021",
"updated_at": "2021-11-25T11:04:18.000000Z"
}
},
],
"links": {
"first": "{base_url}/api/sale_orders?page=1",
"last": "{base_url}/api/sale_orders?page=90",
"prev": null,
"next": "{base_url}/api/sale_orders?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 90,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "{base_url}/api/sale_orders?page=1",
"label": "1",
"active": true
},
{
"url": "{base_url}/api/sale_orders?page=2",
"label": "2",
"active": false
}
],
"path": "{base_url}/api/sale_orders",
"per_page": 100,
"to": 100,
"total": 8922
}
}
$client = new \GuzzleHttp\Client();
$response = $client->get(
'{base_url}/api/salesorders/{order_no}',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
{
"data": {
"id": 84843,
"order_no": "MFT00001",
"total_price": "4300.00",
"customer_notes": "Sample Note",
"shipping_charges": "0.00",
"delivery_date": "2022-05-07",
"status": "Confirmed",
"delivery_status": "Scheduled",
"payment_method": null,
"invoiced": false,
"confirmed": true,
"products": [
{
"id": 2181,
"product_name": "Blacklatte",
"sku_no": "SKU_00000002181",
"bar_code": null,
"active": 1,
"created_at": "Thu 10 Mar 2022",
"updated_at": "2022-03-10T10:44:21.000000Z",
"price": "0.00",
"quantity": 2,
}
],
"client": {
"id": 35668,
"name": "Jim martins",
"city": null,
"email": null,
"phone": "+254713012437",
"address": "Mombasa",
"created_at": "25 Nov 2021",
"updated_at": "2021-11-25T11:04:18.000000Z"
}
}
}
$client = new \GuzzleHttp\Client();
$response = $client->get(
'{base_url}/api/products',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
{
"data": [
{
"id": 13,
"product_name": "Test 1",
"commited": 38,
"onhand": -2264,
"sku_no": "SKU_00000000013",
"available_for_sale": -2302
},
{
"id": 2181,
"product_name": "Test 2",
"commited": 0,
"onhand": 2500,
"sku_no": "SKU_00000002181",
"available_for_sale": 2500
}
],
"links": {
"first": "{base_url}/api/products?page=1",
"last": "{base_url}/api/products?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "{base_url}/api/products?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"path": "{base_url}/api/products",
"per_page": 500,
"to": 33,
"total": 33
}
}