Composity LogoComposity logoComposity logo
Get started free

 


Sales API 

Manage sales including listing, creation, viewing, updating, deleting records, and checking stock availability, with full detail on line items, customers, and currencies.

API Reference: Swagger Documentation available here

 

Authentication
All endpoints require a Bearer token.

Headers:

Authorization: Bearer <your_test_api_key>
Content-Type: application/json

1. List Sales

GET /{db}/api/sales

Example Request

GET /{db}/api/sales

Example Response

[
  {
    "id": "S1001",
    "cc": "SAL-1001",
    "name": "Monthly Subscription",
    "documentNo": "DOC-2025-01",
    "documentDate": "2025-08-20",
    "amount": 1200.50,
    "status": "approved",
    "created": "2025-08-20T08:00:00Z",
    "updated": "2025-08-20T12:00:00Z"
  }
]

 


List / Search Sales (Filtered)

POST /{db}/api/grid/filters/paymentStatus/search/sales

Returns a filtered list of sales based on date range and other optional criteria.

Query Parameters

ParameterTypeRequiredDescription
startDatestring YesStart of the date range (e.g., "2025-05-20")
endDatestring YesEnd of the date range (e.g., "2025-08-20T23:59:59")
qstringNoSearch query (matches name, documentNo, cc)
pageSizeintegerNoNumber of results per page (default 50)
pageintegerNoPage number (1-based, default 1)

Example Request

POST /{db}/api/grid/filters/paymentStatus/search/sales?startDate=2025-05-20&endDate=2025-08-20T23:59:59

Example Response

[
  {
    "id": "S1001",
    "cc": "SAL-1001",
    "name": "Monthly Subscription",
    "documentNo": "DOC-2025-01",
    "documentDate": "2025-06-05",
    "amount": 1200.50,
    "status": "approved",
    "created": "2025-06-05T08:00:00Z",
    "updated": "2025-06-05T12:00:00Z"
  },
  {
    "id": "S1002",
    "cc": "SAL-1002",
    "name": "Office Supplies ",
    "documentNo": "DOC-2025-02",
    "documentDate": "2025-07-10",
    "amount": 500.00,
    "status": "draft",
    "created": "2025-07-10T08:30:00Z",
    "updated": "2025-07-10T09:00:00Z"
  }
]

 

2. Create Sale

POST /{db}/api/sales

Request Body (SaleCreateRequest)

{
  "name": "Office Supplies ",
  "documentDate": "2025-08-20",
  "amount": 500.00,
  "customerId": "CUST-101",
  "currencyId": "USD",
  "lines": [
    {
      "itemId": "ITEM-1001",
      "quantity": 10,
      "unitPrice": 50.00
    }
  ]
}

Example Response (201 Created)

{
  "entity": {
    "id": "S1002",
    "cc": "SAL-1002",
    "name": "Office Supplies Purchase",
    "documentNo": "DOC-2025-02",
    "documentDate": "2025-08-20",
    "amount": 500.00,
    "status": "draft",
    "created": "2025-08-20T08:30:00Z",
    "updated": "2025-08-20T08:30:00Z"
  }
}

3. View Sale by Code

GET /{db}/api/sales/{id}

Example Response (200 OK)

{
  "id": "S1002",
  "cc": "SAL-1002",
  "name": "Office Supplies Purchase",
  "documentNo": "DOC-2025-02",
  "documentDate": "2025-08-20",
  "amount": 500.00,
  "status": "draft",
  "created": "2025-08-20T08:30:00Z",
  "updated": "2025-08-20T08:30:00Z",
  "lines": [
    {
      "id": "SL-1001",
      "itemId": "ITEM-1001",
      "quantity": 10,
      "unitPrice": 50.00,
      "amount": 500.00
    }
  ],
  "customer": {
    "id": "CUST-101",
    "name": "John Doe",
    "email": "john.doe@example.com"
  },
  "currency": {
    "id": "USD",
    "code": "USD",
    "name": "US Dollar"
  }
}

4. Update Sale by Code

PUT /{db}/api/sales/{id}

Request Body (SaleUpdateRequest)

{
  "name": "Office Supplies Purchase - Updated",
  "documentDate": "2025-08-21",
  "amount": 550.00,
  "customerId": "CUST-101",
  "currencyId": "USD",
  "lines": [
    {
      "id": "SL-1001",
      "itemId": "ITEM-1001",
      "quantity": 11,
      "unitPrice": 50.00
    }
  ]
}

Example Response (200 OK)

{
  "entity": {
    "id": "S1002",
    "cc": "SAL-1002",
    "name": "Office Supplies Purchase - Updated",
    "documentNo": "DOC-2025-02",
    "documentDate": "2025-08-21",
    "amount": 550.00,
    "status": "draft",
    "created": "2025-08-20T08:30:00Z",
    "updated": "2025-08-21T09:00:00Z",
    "lines": [
      {
        "id": "SL-1001",
        "itemId": "ITEM-1001",
        "quantity": 11,
        "unitPrice": 50.00,
        "amount": 550.00
      }
    ],
    "customer": {
      "id": "CUST-101",
      "name": "John Doe",
      "email": "john.doe@example.com"
    },
    "currency": {
      "id": "USD",
      "code": "USD",
      "name": "US Dollar"
    }
  }
}

5. Delete Sale by Code

DELETE /{db}/api/sales/{id}

Example Response (200 OK)

{
  "success": "Sale deleted successfully"
}

Example Response (404 Not Found)

{
  "error": "Sale not found"
}

6. Related Sales Data

SaleLine 

SaleLineCreate

{
  "itemId": "ITEM-1001",
  "quantity": 10,
  "unitPrice": 50.00
}

SaleLineUpdate

{
  "id": "SL-1001",
  "itemId": "ITEM-1001",
  "quantity": 11,
  "unitPrice": 50.00
}

Customer
 

GET /api/get/all/accounts/isClient

{
  "id": "CUST-101",
  "name": "John Doe",
  "email": "john.doe@example.com"
}

Currency

POST /api/currency-rates/settings/currency/currency_rate

{
  "id": "USD",
  "code": "USD",
  "name": "US Dollar"
}

7. Stock and Inventory

  • Stock Availability: POST /api/items/settings/stockAvailability
{
  "itemId": "ITEM-1001",
  "locationId": "LOC-01"
}
  • Location Search: GET /api/locations/settings/locations-search?q=warehouse
  • Inventory Item Search: POST /api/inventory/find/items
{
  "search": "Office Chair"
}
  • Update Item Line Quantity: POST /api/items/item/serial/quantity
{
  "itemId": "ITEM-1001",
  "serialNo": "SN-12345",
  "quantity": 5
}

Response s

ErrorResponse

{
  "error": "Invalid request or resource not found"
}

SuccessResponse

{
  "success": "Operation completed successfully"
}

 

Footer Menu
logo

The affordable software that will make your life easier and your efforts more rewarding!

FacebookXLinkedIn

© 2025 Composity, All rights reserved.

Products

  • Composity CRM
  • Composity ERP
  • Composity POS
  • Composity BI
  • Composity eCommerce
  • Composity Helpdesk

Solutions

  • Small Business
  • Enterprise
  • Retail
  • Wholesale
  • Services

Alternatives

  • Alternative to Odoo
  • Alternative to Salesforce
  • Alternative to Shopify
  • Alternative to Zoho
  • Alternative to NetSuite
  • Alternative to Insightly

Resources

  • Blog
  • What is CRM?
  • What is ERP?
  • Implementing Composity
  • Business Partner Program
Contact us| Privacy Policy| Terms of Service| GDPR
  • Prices
  • About us
  • Blog