Skip to content

API Endpoints Reference

Complete reference for all Waqti API endpoints. All endpoints require authentication and return JSON responses.

Base URL

https://{your-tenant}.waqti.net/api/v1

Purchase Orders

List Purchase Orders

http
GET /purchase-orders

Query Parameters:

ParameterTypeDescription
pageintegerPage number (default: 1)
per_pageintegerItems per page (default: 15, max: 100)
statusstringFilter by status: draft, pending, approved, rejected
approval_statusstringFilter by approval status
department_idintegerFilter by department
vendor_idintegerFilter by vendor
from_datedateFilter POs created on or after this date
to_datedateFilter POs created on or before this date
sort_bystringField to sort by (default: created_at)
sort_orderstringasc or desc (default: desc)

Example Request:

bash
curl -X GET "https://acme.waqti.net/api/v1/purchase-orders?status=approved&per_page=25" \
  -H "Authorization: Bearer 3|a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0" \
  -H "Accept: application/json"

Example Response:

json
{
  "success": true,
  "data": [
    {
      "id": 123,
      "po_number": "PO-000123",
      "vendor": {
        "id": 45,
        "name": "Tech Supplies Ltd"
      },
      "department": {
        "id": 12,
        "name": "IT Department"
      },
      "total_inc_vat": 15000.00,
      "currency": "SAR",
      "status": "approved",
      "approval_status": "approved",
      "request_date": "2025-01-15",
      "required_date": "2025-01-30",
      "created_at": "2025-01-15T10:30:00Z"
    }
  ],
  "meta": {
    "current_page": 1,
    "per_page": 25,
    "total": 150,
    "last_page": 6
  }
}

Get Single Purchase Order

http
GET /purchase-orders/{id}

Example Response:

json
{
  "success": true,
  "data": {
    "id": 123,
    "po_number": "PO-000123",
    "vendor": {
      "id": 45,
      "name": "Tech Supplies Ltd",
      "contact_email": "sales@techsupplies.com"
    },
    "department": {
      "id": 12,
      "name": "IT Department"
    },
    "requester": {
      "id": 78,
      "name": "Ahmed Mohammed"
    },
    "lines": [
      {
        "id": 456,
        "line_number": 1,
        "description": "Laptop Dell XPS 15",
        "quantity": 5,
        "unit_price": 2500.00,
        "vat_rate": 15,
        "vat_amount": 1875.00,
        "total_ex_vat": 12500.00,
        "total_inc_vat": 14375.00
      }
    ],
    "documents": [
      {
        "id": 789,
        "filename": "quotation.pdf",
        "url": "/api/v1/documents/789/download"
      }
    ],
    "total_ex_vat": 12500.00,
    "total_vat": 1875.00,
    "total_inc_vat": 14375.00,
    "status": "approved",
    "created_at": "2025-01-15T10:30:00Z"
  }
}

Create Purchase Order

http
POST /purchase-orders

Request Body:

json
{
  "department_id": 12,
  "vendor_id": 45,
  "required_date": "2025-02-15",
  "description": "Office equipment purchase",
  "expense_type": "OPEX",
  "currency": "SAR",
  "lines": [
    {
      "description": "Laptop Dell XPS 15",
      "quantity": 5,
      "unit_price": 2500.00,
      "vat_percentage": 15
    },
    {
      "description": "Monitor 27\"",
      "quantity": 10,
      "unit_price": 800.00,
      "vat_percentage": 15
    }
  ]
}

Response:

json
{
  "success": true,
  "message": "Purchase Order created successfully",
  "data": {
    "id": 124,
    "po_number": "PO-000124",
    ...
  }
}

Approve Purchase Order

http
POST /purchase-orders/{id}/approve

Request Body:

json
{
  "comments": "Approved for IT budget Q1"
}

Reject Purchase Order

http
POST /purchase-orders/{id}/reject

Request Body:

json
{
  "reason": "Budget exceeded for this quarter"
}

Vendors

List Vendors

http
GET /vendors

Query Parameters:

ParameterTypeDescription
searchstringSearch by name or email
statusstringactive, inactive, blacklisted
categorystringFilter by vendor category

Get Single Vendor

http
GET /vendors/{id}

Create Vendor

http
POST /vendors

Request Body:

json
{
  "name": "Tech Supplies Ltd",
  "contact_person": "John Smith",
  "contact_email": "john@techsupplies.com",
  "contact_phone": "+966 50 123 4567",
  "address": "Riyadh, Saudi Arabia",
  "tax_number": "3001234567",
  "payment_terms": "net_30",
  "category": "IT Equipment"
}

Update Vendor

http
PUT /vendors/{id}

Invoices

List Invoices

http
GET /invoices

Get Single Invoice

http
GET /invoices/{id}

Create Invoice

http
POST /invoices

Request Body:

json
{
  "purchase_order_id": 123,
  "invoice_number": "INV-2025-001",
  "invoice_date": "2025-01-20",
  "due_date": "2025-02-19",
  "lines": [
    {
      "po_line_id": 456,
      "quantity": 5,
      "unit_price": 2500.00
    }
  ]
}

Budgets

List Budgets

http
GET /budgets

Get Budget Details

http
GET /budgets/{id}

Response includes:

  • Allocated amounts (CAPEX/OPEX)
  • Spent amounts
  • Reserved amounts (pending POs)
  • Available amounts
  • Utilization percentages

Reports

Spending Report

http
GET /reports/spending

Query Parameters:

ParameterTypeDescription
from_datedateStart date
to_datedateEnd date
group_bystringdepartment, vendor, category, month

Vendor Performance Report

http
GET /reports/vendor-performance

PO Status Report

http
GET /reports/po-status

Invoice Matching Report

http
GET /reports/invoice-matching

Webhooks

List Webhooks

http
GET /webhooks

Create Webhook

http
POST /webhooks

Request Body:

json
{
  "url": "https://your-system.com/waqti-webhook",
  "events": ["po.approved", "po.rejected", "invoice.created"],
  "secret": "your-webhook-secret"
}

Test Webhook

http
POST /webhooks/{id}/test

Webhook Events

EventDescription
po.createdPurchase Order created
po.submittedPO submitted for approval
po.approvedPO approved
po.rejectedPO rejected
po.updatedPO details updated
invoice.createdInvoice created
invoice.matchedInvoice matched with PO
vendor.createdNew vendor added
budget.alertBudget threshold reached

Error Handling

All errors follow a consistent format:

json
{
  "success": false,
  "message": "The given data was invalid.",
  "errors": {
    "vendor_id": ["The vendor id field is required."],
    "lines": ["At least one line item is required."]
  }
}

HTTP Status Codes

CodeDescription
200Success
201Created
400Bad Request - Invalid parameters
401Unauthorized - Invalid/missing token
403Forbidden - Insufficient permissions
404Not Found
422Validation Error
429Too Many Requests
500Internal Server Error

Built by M & L Technologies