Suppliers
By Maxim
By Maxim
Suppliers
Suppliers: the companies and people you buy materials and products from. Via the API you can create, edit and delete them, and get a list and a supplier's details. Method paths are given relative to the base API URL; the rules common to all methods (authorization, request format, partial editing, pagination) are described in API Overview and Common Rules. Methods | Method | What it does | |---|---| | v1/suppliers/add | Creates a supplier | | v1/suppliers/edit | Updates a supplier | | v1/suppliers/delete | Deletes a supplier | | v1/suppliers/get_list | Returns the company's suppliers | | v1/suppliers/get_entry | Returns a supplier's details |
Creating a Supplier
Creates a supplier. v1/suppliers/add.php Parameters | Field | Type | Required | Description | |---|---|---|---| | name | string | Yes | Name | | email | string | No | Email | | phone | string | No | Phone | | address | string | No | Address | | agreement | string | No | Agreement | | manager_name | string | No | Manager | | manager_post | string | No | Manager's position | | notes | string | No | Notes | A supplier can also be created together with a purchase, see v1/purchases/add. Example request { "name": "Woodtrade Ltd", "email": "sales@woodtrade.com", "phone": "+1 646 555-0188", "address": "8 Harbor St, Boston", "agreement": "No. 7 of 15 Feb 2026", "manager_name": "Oleg Baker", "manager_post": "Director" } Example response { "success": true, "supplier_id": 45 } Errors | Error | Reason | |---|---| | No name in input | name is missing or null | | Name must not be empty | Empty name | | Name must be a string | name passed as an array or object |
Editing a Supplier
Updates a supplier. Only the fields you pass are changed, the rest stay as they were. v1/suppliers/edit.php Parameters | Field | Type | Required | Description | |---|---|---|---| | supplier_id | int | Yes | Supplier ID | | name | string | No | Name | | email | string | No | Email | | phone | string | No | Phone | | address | string | No | Address | | agreement | string | No | Agreement | | manager_name | string | No | Manager | | manager_post | string | No | Manager's position | | notes | string | No | Notes | To clear a field, pass an empty string. Passing null leaves the field unchanged, as if it were not sent. Example request { "supplier_id": 45, "email": "wholesale@woodtrade.com", "notes": "Delivery on Tuesdays" } Example response { "success": true } Errors | Error | Reason | |---|---| | No supplier_id in input | supplier_id is missing | | Supplier not found or access denied | Supplier not found or deleted | | Name must not be empty | An empty name was passed | | Name must be a string | name passed as an array or object |
Deleting a Supplier
Deletes a supplier. v1/suppliers/delete.php Parameters | Field | Type | Required | Description | |---|---|---|---| | supplier_id | int | Yes | Supplier ID | Example request { "supplier_id": 45 } Example response { "success": true } Errors | Error | Reason | |---|---| | No supplier_id in input | supplier_id is missing | | Supplier not found or access denied | Supplier not found or already deleted |
Retrieving a List of Suppliers
Returns the company's suppliers, sorted by name. Deleted suppliers are not included. v1/suppliers/get_list.php Parameters | Field | Type | Required | Description | |---|---|---|---| | limit | int | No | Page size, from 1 to 1000 | | offset | int | No | How many records to skip | Without limit the whole list is returned. See Common Rules for pagination. Response An array suppliers with the supplier's fields. The total field holds the total number of suppliers. | Field | Type | Description | |---|---|---| | id | int | Supplier ID | | name | string | Name | | email | string | Email | | phone | string | Phone | | address | string | Address | | agreement | string | Agreement | | manager_name | string | Manager | | manager_post | string | Manager's position | | notes | string | Notes | Example request { "limit": 100, "offset": 0 } Example response { "success": true, "suppliers": [ { "id": 46, "name": "Hardware Supplies", "email": "hardware@example.com", "phone": "+1 312 555-0170", "address": "14 Peace St, Chicago", "agreement": "", "manager_name": "", "manager_post": "", "notes": "" }, { "id": 45, "name": "Woodtrade Ltd", "email": "wholesale@woodtrade.com", "phone": "+1 646 555-0188", "address": "8 Harbor St, Boston", "agreement": "No. 7 of 15 Feb 2026", "manager_name": "Oleg Baker", "manager_post": "Director", "notes": "Delivery on Tuesdays" } ], "total": 2 } Errors | Error | Reason | |---|---| | Invalid limit value. Must be between 1 and 1000 | Invalid limit | | Invalid offset value. Must be 0 or greater | Invalid offset | | Offset requires limit | offset passed without limit |
Retrieving a Supplier
Returns a supplier's details. v1/suppliers/get_entry.php Parameters | Field | Type | Required | Description | |---|---|---|---| | supplier_id | int | Yes | Supplier ID | A deleted supplier is not returned. Response An object supplier with the supplier's fields. The fields from the response can be sent to v1/suppliers/edit unchanged, adding supplier_id. | Field | Type | Description | |---|---|---| | id | int | Supplier ID | | name | string | Name | | email | string | Email | | phone | string | Phone | | address | string | Address | | agreement | string | Agreement | | manager_name | string | Manager | | manager_post | string | Manager's position | | notes | string | Notes | Example request { "supplier_id": 45 } Example response { "success": true, "supplier": { "id": 45, "name": "Woodtrade Ltd", "email": "wholesale@woodtrade.com", "phone": "+1 646 555-0188", "address": "8 Harbor St, Boston", "agreement": "No. 7 of 15 Feb 2026", "manager_name": "Oleg Baker", "manager_post": "Director", "notes": "Delivery on Tuesdays" } } Errors | Error | Reason | |---|---| | No supplier_id in input | supplier_id is missing | | Supplier not found or access denied | Supplier not found or deleted |