Wazen API Documentation

MENU navbar-image

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": {}
    }
}
 

Request      

GET api/v1/base/settings/branches

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

The page number. Example: 1

per_page   integer  optional  

The number of items per page. Example: 15

company_no   integer  optional  

The company number. Example: 123

Body Parameters

company_no   integer  optional  

Example: 2

per_page   integer  optional  

Example: 19

page   integer  optional  

Example: 13

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"
}
 

Request      

POST api/v1/base/settings/branches

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

nameAr   string   

The Arabic name of the branch. Example: الفرع الرئيسي

nameEn   string  optional  

The English name of the branch. Defaults to the Arabic name if not provided. Example: Main Branch

longitude   number  optional  

The longitude of the branch. Example: 46.6753

latitude   number  optional  

The latitude of the branch. Example: 24.7136

address   string  optional  

The address of the branch. Example: 1234 Main St

phone   string  optional  

The phone number of the branch. Example: +966123456789

clone   boolean   

Whether to clone the branch from another branch. Example: true

clone_from_branch_id   integer  optional  

required_if:clone,true The ID of the branch to clone from. Example: 1

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"
}
}
 

Request      

GET api/v1/base/settings/branches/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the branch. Example: 1

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": {}
    }
}
 

Request      

GET api/v1/base/customers

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

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": {}
    }
}
 

Request      

GET api/v1/base/journals

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

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."
        ]
    }
}
 

Request      

POST api/v1/base/journals

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

header   object  optional  
type   integer   

The journal type. Example: 6

date   date  optional  

The date of the journal. Example: 2024-01-01

lines   object[]  optional  
debit   string   

Must match the regex /^\d+(.\d{1,8})?$/. Example: 63

credit   string   

Must match the regex /^\d+(.\d{1,8})?$/. Example: 99307

desc   string  optional  

Example: sit

cost_center   number  optional  

Example: 66791.98932

line_no   number   

Example: 2920117.895

account_type   number   

Example: 131119305.0987

account_no   string   

Example: deleniti

*   object  optional  
debit   numeric   

Debit amount. Example: 100.00

credit   numeric   

Credit amount. Example: 100.00

desc   string  optional  

Description of the journal entry. Example: "Purchase of office supplies"

cost_center   integer  optional  

The cost center ID. Example: 1

line_no   integer   

Line number. Example: 1

account_type   integer   

Account type ID. Example: 2

account_no   integer   

Account number. Example: 123456

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"
}
 

Request      

POST api/v1/base/journals/import

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

header   object  optional  
type   integer   

The type of the journal. Example: 6

date   date  optional  

The date of the journal entry in YYYY-MM-DD format. Example: 2024-08-11

lines   string[]   

The journal lines containing debit, credit, description, and account details.

debit   string   

Must match the regex /^\d+(.\d{1,8})?$/. Example: 82.299074

credit   string   

Must match the regex /^\d+(.\d{1,8})?$/. Example: 0.431232

desc   string  optional  

Example: tempora

cost_center   number  optional  

Example: 816383.38259238

account_type   string   

Example: quo

account_name   string   

Example: placeat

*   object  optional  
debit   numeric   

The debit amount for the line. Example: 1000.00

credit   numeric   

The credit amount for the line. Example: 1000.00

desc   string  optional  

The description of the line. Example: Payment for services

cost_center   integer  optional  

The cost center associated with the line. Example: 2

account_type   string   

The type of the account. Example: asset

account_name   string   

The name of the account. Example: `Cash

// @apiResourceCollection Modules\Base\Transformers\Journals\JournalsIndexResource // @apiResourceModel App\Models\Erp\GLJrnal // // @param ImportJournalsRequest $request // @return \Illuminate\Http\JsonResponse // // * @group Journals`