Introduction
This documentation aims to provide all the information you need to work with our API.
Authenticating requests
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.
Branches
Branches Api
List Branches.
requires authentication
Example request:
curl --request GET \
--get "http://erp.wazen.test/api/v1/base/settings/branches?page=1&per_page=15&company_no=123" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"company_no\": 2,
\"per_page\": 19,
\"page\": 13
}"
const url = new URL(
"http://erp.wazen.test/api/v1/base/settings/branches"
);
const params = {
"page": "1",
"per_page": "15",
"company_no": "123",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"company_no": 2,
"per_page": 19,
"page": 13
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://erp.wazen.test/api/v1/base/settings/branches';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'page' => '1',
'per_page' => '15',
'company_no' => '123',
],
'json' => [
'company_no' => 2,
'per_page' => 19,
'page' => 13,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'http://erp.wazen.test/api/v1/base/settings/branches'
payload = {
"company_no": 2,
"per_page": 19,
"page": 13
}
params = {
'page': '1',
'per_page': '15',
'company_no': '123',
}
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()
Example response (200):
{
"status": "success",
"data": [
{
"id": 1,
"no": 101,
"name": "Main Branch",
"name_ar": "الفرع الرئيسي",
"name_en": "Main Branch",
"company": {
"id": 1,
"company_no": 123,
"name_ar": "شركة",
"name_en": "Company"
}
}
],
"message": "Branches list",
"pagination": {
"count": 1,
"total": 1,
"perPage": 15,
"currentPage": 1,
"totalPages": 1,
"links": {}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create Branch
requires authentication
Example request:
curl --request POST \
"http://erp.wazen.test/api/v1/base/settings/branches" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"nameAr\": \"الفرع الرئيسي\",
\"nameEn\": \"Main Branch\",
\"longitude\": 46.6753,
\"latitude\": 24.7136,
\"address\": \"1234 Main St\",
\"phone\": \"+966123456789\",
\"clone\": true,
\"clone_from_branch_id\": 1
}"
const url = new URL(
"http://erp.wazen.test/api/v1/base/settings/branches"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"nameAr": "الفرع الرئيسي",
"nameEn": "Main Branch",
"longitude": 46.6753,
"latitude": 24.7136,
"address": "1234 Main St",
"phone": "+966123456789",
"clone": true,
"clone_from_branch_id": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://erp.wazen.test/api/v1/base/settings/branches';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'nameAr' => 'الفرع الرئيسي',
'nameEn' => 'Main Branch',
'longitude' => 46.6753,
'latitude' => 24.7136,
'address' => '1234 Main St',
'phone' => '+966123456789',
'clone' => true,
'clone_from_branch_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'http://erp.wazen.test/api/v1/base/settings/branches'
payload = {
"nameAr": "الفرع الرئيسي",
"nameEn": "Main Branch",
"longitude": 46.6753,
"latitude": 24.7136,
"address": "1234 Main St",
"phone": "+966123456789",
"clone": true,
"clone_from_branch_id": 1
}
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"status": "success",
"data": {
"id": 1,
"no": 101,
"name": "Main Branch",
"name_ar": "الفرع الرئيسي",
"name_en": "Main Branch",
"company": {
"id": 1,
"company_no": 123,
"name_ar": "شركة",
"name_en": "Company"
}
},
"message": "Branch created successfully"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Branch Details
requires authentication
Example request:
curl --request GET \
--get "http://erp.wazen.test/api/v1/base/settings/branches/1" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"http://erp.wazen.test/api/v1/base/settings/branches/1"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://erp.wazen.test/api/v1/base/settings/branches/1';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'http://erp.wazen.test/api/v1/base/settings/branches/1'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"status": "success",
"message": "Branch Details",
{
"id": 1,
"no": 101,
"name": "Main Branch",
"name_ar": "الفرع الرئيسي",
"name_en": "Main Branch",
"company": {
"id": 1,
"company_no": 123,
"name_ar": "شركة",
"name_en": "Company"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Customers
List Customers.
Example request:
curl --request GET \
--get "http://erp.wazen.test/api/v1/base/customers" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"http://erp.wazen.test/api/v1/base/customers"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://erp.wazen.test/api/v1/base/customers';
$response = $client->get(
$url,
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'http://erp.wazen.test/api/v1/base/customers'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"status": "success",
"data": [
{
"id": 1,
"customer_no": "25100001",
"name_ar": "العميل",
"name_en": "Customer",
"mobile": "123456789",
"address": "123 Main St",
"active": true,
"customer_class": "VIP",
"account_no": "ACC123",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z",
"company": {
"id": 1,
"company_no": 123,
"name_ar": "شركة",
"name_en": "Company"
},
"branch": {
"id": 1,
"branch_no": "123",
"name_ar": "فرع",
"name_en": "Branch"
},
"user": {
"id": 1,
"email": "[email protected]",
"username": "user1"
}
}
],
"message": "customers list",
"pagination": {
"count": 1,
"total": 1,
"perPage": 15,
"currentPage": 1,
"totalPages": 1,
"links": {}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Journals
List Journals.
Example request:
curl --request GET \
--get "http://erp.wazen.test/api/v1/base/journals" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"http://erp.wazen.test/api/v1/base/journals"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://erp.wazen.test/api/v1/base/journals';
$response = $client->get(
$url,
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'http://erp.wazen.test/api/v1/base/journals'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"status": "success",
"data": [
{
"id": 1,
"journal_no": 25100001,
"journal_type": {
"id": 1,
"reference_no": 6,
"name_ar": "نوع",
"name_en": "Type"
},
"date": {
"gregorian": "2024-08-11",
"islamic": "1445-01-28"
},
"source": "dashboard",
"amounts": {
"debit": 1000,
"credit": 1000
},
"company": {
"id": 1,
"company_no": 123,
"name_ar": "شركة",
"name_en": "Company"
},
"branch": {
"id": 1,
"branch_no": 123,
"name_ar": "فرع",
"name_en": "Branch"
},
"user": {
"id": 1,
"email": "[email protected]",
"username": "user1"
}
}
],
"message": "journals list",
"pagination": {
"count": 1,
"total": 1,
"perPage": 15,
"currentPage": 1,
"totalPages": 1,
"links": {}
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create Journal
Example request:
curl --request POST \
"http://erp.wazen.test/api/v1/base/journals" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"header\": {
\"type\": 6,
\"date\": \"2024-01-01\"
},
\"lines\": [
{
\"debit\": \"63\",
\"credit\": \"99307\",
\"desc\": \"sit\",
\"cost_center\": 66791.98932,
\"line_no\": 2920117.895,
\"account_type\": 131119305.0987,
\"account_no\": \"deleniti\"
}
]
}"
const url = new URL(
"http://erp.wazen.test/api/v1/base/journals"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"header": {
"type": 6,
"date": "2024-01-01"
},
"lines": [
{
"debit": "63",
"credit": "99307",
"desc": "sit",
"cost_center": 66791.98932,
"line_no": 2920117.895,
"account_type": 131119305.0987,
"account_no": "deleniti"
}
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://erp.wazen.test/api/v1/base/journals';
$response = $client->post(
$url,
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'header' => [
'type' => 6,
'date' => '2024-01-01',
],
'lines' => [
[
'debit' => '63',
'credit' => '99307',
'desc' => 'sit',
'cost_center' => 66791.98932,
'line_no' => 2920117.895,
'account_type' => 131119305.0987,
'account_no' => 'deleniti',
],
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'http://erp.wazen.test/api/v1/base/journals'
payload = {
"header": {
"type": 6,
"date": "2024-01-01"
},
"lines": [
{
"debit": "63",
"credit": "99307",
"desc": "sit",
"cost_center": 66791.98932,
"line_no": 2920117.895,
"account_type": 131119305.0987,
"account_no": "deleniti"
}
]
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"status": "success",
"data": {
"id": 1,
"journal_no": 25100001,
"journal_type": {
"id": 1,
"reference_no": 6,
"name_ar": "نوع",
"name_en": "Type"
},
"date": {
"gregorian": "2024-08-11",
"islamic": "1445-01-28"
},
"source": "dashboard",
"amounts": {
"debit": 1000,
"credit": 1000
},
"company": {
"id": 1,
"company_no": "123",
"name_ar": "شركة",
"name_en": "Company"
},
"branch": {
"id": 1,
"branch_no": "123",
"name_ar": "فرع",
"name_en": "Branch"
},
"user": {
"id": 1,
"email": "[email protected]",
"username": "user1"
}
},
"message": "journals created successfully"
}
Example response (400):
{
"status": "error",
"errors": {
"header.type": [
"The journal type is required.",
"The journal type must be a number.",
"Invalid journal type."
],
"header.date": [
"The date must be a valid date."
],
"lines.*.debit": [
"Debit value is required.",
"Debit value must be a valid number with up to 8 decimal places."
],
"lines.*.credit": [
"Credit value is required.",
"Credit value must be a valid number with up to 8 decimal places."
],
"lines.*.desc": [
"Description must be a string."
],
"lines.*.cost_center": [
"Cost center must be a number."
],
"lines.*.line_no": [
"Line number is required.",
"Line number must be a number."
],
"lines.*.account_no": [
"Account number is required.",
"The account number does not exist for the given account type."
],
"lines.*.account_type": [
"Account type is required.",
"Account type must be a number."
],
"lines": [
"The sum of debits must equal the sum of credits.",
"A line cannot have both debit and credit values.",
"A line must have either a debit or a credit value."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Import journals.
Example request:
curl --request POST \
"http://erp.wazen.test/api/v1/base/journals/import" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"header\": {
\"type\": 6,
\"date\": \"2024-08-11\"
},
\"lines\": [
\"non\"
]
}"
const url = new URL(
"http://erp.wazen.test/api/v1/base/journals/import"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"header": {
"type": 6,
"date": "2024-08-11"
},
"lines": [
"non"
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://erp.wazen.test/api/v1/base/journals/import';
$response = $client->post(
$url,
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'header' => [
'type' => 6,
'date' => '2024-08-11',
],
'lines' => [
'non',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'http://erp.wazen.test/api/v1/base/journals/import'
payload = {
"header": {
"type": 6,
"date": "2024-08-11"
},
"lines": [
"non"
]
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"status": "success",
"data": {
"id": 1,
"journal_no": 25100001,
"journal_type": {
"id": 1,
"reference_no": 6,
"name_ar": "نوع",
"name_en": "Type"
},
"date": {
"gregorian": "2024-08-11",
"islamic": "1445-01-28"
},
"source": "dashboard",
"amounts": {
"debit": 1000,
"credit": 1000
},
"company": {
"id": 1,
"company_no": "123",
"name_ar": "شركة",
"name_en": "Company"
},
"branch": {
"id": 1,
"branch_no": "123",
"name_ar": "فرع",
"name_en": "Branch"
},
"user": {
"id": 1,
"email": "[email protected]",
"username": "user1"
}
},
"message": "journals created successfully"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.