Accounting SDK Documentation
Overview
Aloy Unified API provides a client for interacting with our Unified Accounting model.
Authentication
To use the Accounting API, you need to authenticate your requests using an API key.
JavaScript
const apiClient = new UAPI("YOUR_API_KEY");
await apiClient.connect("connectionId");
Company Info
Get Company Info
Example:
JavaScript
const apiClient = new UAPI("YOUR_API_KEY");
await apiClient.connect("connectionId");
const data = await apiClient.CompanyInfo.getCompanyInfo();
Account
Create Account
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const body = {
accountName: "SampleAccount",
accountType: "OTHER_ASSET",
currency: "USD",
};
const data = await apiClient.Accounting.createAccount(body);
List Accounts
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.listAccounts();
Get Account
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getAccount("sampleAccountId");
Delete Account
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.deleteAccount("sampleAccountId");
Vendors
Create Vendor
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const body = {
vendorName: "SampleVendor",
vendorStatus: "ACTIVE",
addresses: [
{
addressType: "BILLING",
street1: "Avenue of the Americas",
zipCode: "90210",
country: "US",
},
],
phoneNumbers: [
{
phoneNumberType: "MOBILE",
phoneNumber: "09173210215",
},
],
};
const data = await apiClient.Accounting.createVendor(body);
List Vendors
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.listVendors();
Get Vendor
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getVendor("sampleVendorId");
Delete Vendor
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.deleteVendor("sampleVendorId");
Customers
Create Customer
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const body = {
customerName: "SampleCustomer",
addresses: [
{
addressType: "BILLING",
street1: "Beverly Hills",
zipCode: "90210",
country: "US",
},
],
phoneNumbers: [
{
phoneNumberType: "MOBILE",
phoneNumber: "09173210215",
},
],
};
const data = await apiClient.Accounting.createCustomer(body);
List Customers
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.listCustomers();
Get Customer
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getCustomer("sampleCustomerId");
Delete Customer
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.deleteCustomer("sampleCustomerId");
Tax Rates
Create Tax Rate
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const body = {
taxRateName: "SampleTaxRate",
agencyRef: "sampleAgencyRef",
rate: 10,
rateType: "PERCENTAGE",
};
const data = await apiClient.Accounting.createTaxRate(body);
List Tax Rates
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.listTaxRates();
Get Tax Rate
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getTaxRate("sampleTaxRateId");
Delete Tax Rate
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.deleteTaxRate("sampleTaxRateId");
Tracking Categories
Create Tracking Category
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const body = {
categoryType: "CUSTOMER",
name: "SampleCategory",
};
const data = await apiClient.Accounting.createTrackingCategory(body);
List Tracking Categories
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.listTrackingCategories();
Get Tracking Category
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getTrackingCategory("sampleCategoryId");
Delete Tracking Category
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data =
await apiClient.Accounting.deleteTrackingCategory("sampleCategoryId");
Items
Create Item
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const body = {
itemName: "SampleItem",
itemCategory: "SERVICE",
unitPrice: 50,
};
const data = await apiClient.Accounting.createItem(body);
List Items
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.listItems();
Get Item
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getItem("sampleItemId");
Delete Item
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.deleteItem("sampleItemId");
Purchase Orders
Create Purchase Order
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const body = {
vendorId: "sampleVendorId",
purchaseOrderNumber: "PO-001",
lineItems: [
{
description: "Item Description",
quantity: 5,
unitPrice: 20,
},
],
};
const data = await apiClient.Accounting.createPurchaseOrder(body);
List Purchase Orders
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.listPurchaseOrders();
Get Purchase Order
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getPurchaseOrder(
"samplePurchaseOrderId"
);
Delete Purchase Order
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.deletePurchaseOrder(
"samplePurchaseOrderId"
);
Bills
Create Bill
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const body = {
vendorId: "sampleVendorId",
billNumber: "PLDT-001",
lineItems: [
{
description: "Line Item 1",
totalAmount: 100,
accountId: "sampleAccountId",
},
],
};
const data = await apiClient.Accounting.createBill(body);
List Bills
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.listBills();
Get Bill Count
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getBillCount();
Retrieve Bill
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getBill("sampleBillId");
Delete Bill
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.deleteBill("sampleBillId");
Invoices
List Items for Create Invoice
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const filter = {
itemName: "Commission",
};
const data = await apiClient.Accounting.listItems(filter);
Create Invoice
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const body = {
customerId: "sampleCustomerId",
invoiceNumber: "ALY-001",
lineItems: [
{
description: "Item Description",
totalAmount: 100,
accountingItemId: "sampleItemId",
},
],
};
const data = await apiClient.Accounting.createInvoice(body);
List Invoices
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.listInvoices();
Retrieve Invoice
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getInvoice("sampleInvoiceId");
Get Invoice Count
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getInvoiceCount();
Delete Invoice
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.deleteInvoice("sampleInvoiceId");
Payments
Create Payment
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const body = {
customerId: "sampleCustomerId",
totalAmount: 10,
};
const data = await apiClient.Accounting.createPayment(body);
List Payments
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.listPayments();
Get Payment Count
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getPaymentCount();
Retrieve Payment
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.getPayment("samplePaymentId");
Delete Payment
Example:
JavaScript
const apiClient = new UAPI(apiKey);
const data = await apiClient.Accounting.deletePayment("samplePaymentId");