### Retrieve Own Asset Movement Guides with Parameters (API Request) Source: https://www.moloni.pt/dev/documents/oamg/getall This example illustrates how to make a request to the `getAll` endpoint, including optional parameters such as `company_id`, `qty`, and `offset` for filtering and pagination of asset movement guides. The `qty` parameter has a default of 50 and a maximum of 50. ```http https://api.moloni.pt/v1/ownAssetsMovementGuides/getAll/?access_token=__[_current_access_token_]__&company_id=123&qty=50&offset=0 ``` -------------------------------- ### GET /ownAssetsMovementGuides/getAll Source: https://www.moloni.pt/dev/documents/oamg/getall Retrieves all own asset movement guides for the company. Supports filtering based on provided parameters. ```APIDOC ## GET /ownAssetsMovementGuides/getAll ### Description Retrieves all own asset movement guides for the company. If search options are defined, documents that comply with them are returned. ### Method GET ### Endpoint https://api.moloni.pt/v1/ownAssetsMovementGuides/getAll/?access_token=__[_current_access_token_]__ ### Parameters #### Query Parameters - **company_id** (int) - Required - The ID of the company. - **qty** (int) - Optional - The number of records to return. Defaults to 50, maximum is 50. - **offset** (int) - Optional - The starting point for the records. Defaults to 0. - **customer_id** (int) - Optional - Filter by customer ID. - **document_set_id** (int) - Optional - Filter by document set ID. - **number** (int) - Optional - Filter by document number. - **date** (date) - Optional - Filter by document date. - **year** (int) - Optional - Filter by document year. - **your_reference** (string) - Optional - Filter by your reference. *Note*: Optional fields can be an empty string or zero, depending on their respective type. ### Response #### Success Response (200) - **document_id** (int) - The unique identifier for the document. - **document_type_id** (int) - The ID of the document type. - **document_set_id** (int) - The ID of the document set. - **number** (int) - The document number. - **date** (datetime) - The date of the document. - **expiration_date** (datetime|null) - The expiration date of the document, if applicable. - **your_reference** (string) - Your reference for the document. - **our_reference** (string) - Our reference for the document. - **entity_number** (string) - The entity number associated with the document. - **entity_name** (string) - The name of the entity. - **entity_vat** (string) - The VAT number of the entity. - **entity_address** (string) - The address of the entity. - **gross_value** (float) - The gross value of the document. - **comercial_discount_value** (float) - The commercial discount value. - **financial_discount_value** (float) - The financial discount value. - **taxes_value** (float) - The total tax value. - **deduction_value** (float) - The total deduction value. - **net_value** (float) - The net value of the document. - **status** (int) - The status of the document. - **transport_code** (string) - The transport code. - **transport_code_set_by** (int) - Indicates who set the transport code. - **exchange_currency_id** (int) - The ID of the currency used for exchange rate. - **exchange_total_value** (float) - The total value in the exchange currency. - **exchange_rate** (float) - The exchange rate used. - **exchange_currency** (object) - Details about the exchange currency. - **currency_id** (int) - The currency ID. - **iso4217** (string) - The ISO 4217 code of the currency. - **symbol** (string) - The symbol of the currency. - **document_type** (object) - Details about the document type. - **document_type_id** (int) - The document type ID. - **saft_code** (string) - The SAFT code for the document type. - **document_set** (object) - Details about the document set. - **document_set_id** (int) - The document set ID. - **name** (string) - The name of the document set. ### Request Example ```json { "company_id": 123, "qty": 10 } ``` ### Response Example ```json [ { "document_id": 1, "document_type_id": 1, "document_set_id": 1, "number": 100, "date": "2023-10-27T10:00:00", "expiration_date": null, "your_reference": "REF123", "our_reference": "OURREF456", "entity_number": "ENT789", "entity_name": "Example Corp", "entity_vat": "123456789", "entity_address": "123 Main St", "gross_value": 100.00, "comercial_discount_value": 0.00, "financial_discount_value": 0.00, "taxes_value": 23.00, "deduction_value": 0.00, "net_value": 123.00, "status": 1, "transport_code": "TC001", "transport_code_set_by": 1, "exchange_currency_id": 978, "exchange_total_value": 123.00, "exchange_rate": 1.00, "exchange_currency": { "currency_id": 978, "iso4217": "EUR", "symbol": "€" }, "document_type": { "document_type_id": 1, "saft_code": "FA" }, "document_set": { "document_set_id": 1, "name": "Default Set" } } ] ``` ### Error Handling Refer to the Moloni API documentation for a list of possible errors and their interpretations. ``` -------------------------------- ### Retrieve Global Guides - API Request Source: https://www.moloni.pt/dev/documents/global-guides/getall This snippet shows the structure of an API request to retrieve global guides from Moloni. It includes the base URL and an example of an access token parameter. The request is designed to fetch data based on provided or default parameters. ```HTTP https://api.moloni.pt/v1/globalGuides/getAll/?access_token=__[_current_access_token_]__ ``` -------------------------------- ### Fetch All Own Asset Movement Guides (API Request) Source: https://www.moloni.pt/dev/documents/oamg/getall This snippet shows the base URL and required access token for retrieving own asset movement guides. It demonstrates how to initiate a GET request to the Moloni API. ```http https://api.moloni.pt/v1/ownAssetsMovementGuides/getAll/?access_token=__[_current_access_token_]__ ``` -------------------------------- ### Get Products by Name - API Request Example Source: https://www.moloni.pt/dev/products/products/getbyname This example demonstrates how to make an API request to retrieve products by their name. It includes the base URL and required parameters such as company ID and product name. The 'qty' and 'offset' parameters can be used for pagination. ```http https://api.moloni.pt/v1/products/getByName/?access_token=[_current_access_token_]&company_id=123&name=ExampleProduct&qty=10&offset=0 ``` -------------------------------- ### PHP: Get Product Details from Moloni API Source: https://www.moloni.pt/dev/exemplos This example shows how to fetch the details of a specific product using the Moloni API's `getOne` method from the `Products` class in PHP. It utilizes cURL to make a POST request with company and product IDs, then parses the JSON response to check for errors or display success information. Ensure you replace `[your_current_access_token]` with your actual access token. ```php 5, 'product_id' => 534521); curl_setopt($con, CURLOPT_URL, $url); curl_setopt($con, CURLOPT_POST, true); curl_setopt($con, CURLOPT_POSTFIELDS, http_build_query($my_values)); curl_setopt($con, CURLOPT_HEADER, false); curl_setopt($con, CURLOPT_RETURNTRANSFER, true); $res_curl = curl_exec($con); curl_close($con); // análise do resultado $res_txt = json_decode($res_curl, true); if (!isset($res_txt['error'])) { echo 'Sucesso: ' . print_r($res_txt, true) . ''; } else { echo 'Houston, we\'ve got a Problem!'; echo 'Erro: ' . print_r($res_txt, true) . ''; } ?> ``` -------------------------------- ### Moloni API: Get Product by Reference (Example Request) Source: https://www.moloni.pt/dev/products/products/getbyreference This snippet demonstrates how to make a request to the Moloni API to retrieve product information using its reference. It includes the necessary parameters such as company ID and reference, and shows the base URL structure for the API. ```http https://api.moloni.pt/v1/products/getByReference/?access_token=[_current_access_token_]&company_id=YOUR_COMPANY_ID&reference=YOUR_PRODUCT_REFERENCE ``` -------------------------------- ### Products - Get One Source: https://www.moloni.pt/dev/exemplos This endpoint retrieves the details of a specific product using its ID. It requires a company ID and the product ID as parameters. ```APIDOC ## GET /products/getOne ### Description Retrieves the details of a specific product. ### Method POST ### Endpoint `/v1/products/getOne/` ### Parameters #### Query Parameters - **access_token** (string) - Required - Your API access token. #### Request Body - **company_id** (integer) - Required - The ID of the company. - **product_id** (integer) - Required - The ID of the product to retrieve. ### Request Example ```json { "company_id": 5, "product_id": 534521 } ``` ### Response #### Success Response (200) - **product** (object) - Contains the details of the product. - **product_id** (integer) - The ID of the product. - **name** (string) - The name of the product. - **reference** (string) - The reference code of the product. - **price** (float) - The price of the product. - ... (other product details) #### Response Example ```json { "product_id": 534521, "name": "Example Product", "reference": "EX-001", "price": 10.50, "...": "..." } ``` #### Error Response - **error** (object) - Contains error details if the request fails. - **code** (integer) - The error code. - **message** (string) - A description of the error. ``` -------------------------------- ### Get Products by Name - API Response Example Source: https://www.moloni.pt/dev/products/products/getbyname This is an example of the JSON response received when using the 'getByName' API endpoint. It shows the structure of a product object, including details like ID, name, reference, price, stock, and associated data like measurements, taxes, properties, and warehouses. ```json [ { "product_id": 1, "type": 1, "name": "Example Product", "reference": "EX-001", "ean": "1234567890123", "price": 10.50, "stock": 100.0, "unit_id": 1, "pos_favorite": 0, "at_product_category": "Electronics", "image": "http://example.com/image.jpg", "measurement_unit": { "unit_id": 1, "name": "Unit", "short_name": "U" }, "taxes": [ { "product_id": 1, "tax_id": 1, "value": 23.0, "order": 1, "cumulative": 0, "tax": { "tax_id": 1, "type": 1, "saft_type": 1, "vat_type": "VAT", "stamp_tax": "", "name": "IVA 23%", "value": 23.0, "fiscal_zone": "PT", "active_by_default": 1, "exemption_reason": "" } } ], "properties": [ { "property_id": 1, "value": "Red", "property": { "property_id": 1, "title": "Color" } } ], "warehouses": [ { "product_id": 1, "warehouse_id": 1, "stock": 50.0 } ] } ] ``` -------------------------------- ### Moloni API: Get Supplier Purchase Order (Example Request) Source: https://www.moloni.pt/dev/documents/supplier-purchase-order/getone Example of an HTTP GET request to the Moloni API to retrieve a single supplier purchase order. This requires an access token and can include various optional parameters for filtering. ```http GET https://api.moloni.pt/v1/supplierPurchaseOrder/getOne/?access_token=_[current_access_token]_&company_id=123&document_id=456 ``` -------------------------------- ### Product Creation API Source: https://www.moloni.pt/dev/documents/supplier-return-notes/insert This section details the parameters required for creating a product within the Moloni system. It includes product details, tax information, and optional properties. ```APIDOC ## POST /api/products ### Description This endpoint is used to create a new product in the Moloni system. It accepts detailed product information, including pricing, stock, and tax configurations. ### Method POST ### Endpoint /api/products ### Parameters #### Request Body - **product_id** (int) - Required - **name** (string) - Required - **summary** (string) - Optional - **qty** (float) - Required (Default: 50) - **price** (float) - Required - **discount** (float) - Optional - **deduction_id** (int) - Optional - **order** (int) - Optional - **origin_id** (int) - Optional - **exemption_reason** (string) - Optional - **warehouse_id** (int) - Optional - **properties** (array) - Optional - **title** (string) - Optional - **value** (string) - Optional - **taxes** (array) - Required - **tax_id** (int) - Required - **value** (float) - Required - **order** (int) - Required - **cumulative** (int) - Required - **exchange_currency_id** (int) - Optional - **exchange_rate** (float) - Optional - **notes** (string) - Optional - **status** (int) - Optional ### Request Example ```json { "product_id": 123, "name": "Example Product", "summary": "A detailed summary of the product.", "qty": 100.5, "price": 25.99, "discount": 5.0, "properties": [ { "title": "Color", "value": "Blue" } ], "taxes": [ { "tax_id": 1, "value": 23.0, "order": 1, "cumulative": 0 } ], "notes": "Some additional notes.", "status": 1 } ``` ### Response #### Success Response (200) - **valid** (int) - Indicates if the request was valid (1 for success). - **document_id** (int) - The ID of the created document. #### Response Example ```json { "valid": 1, "document_id": 456 } ``` ### Error Handling If there are errors in the provided fields, a JSON object with errors indexed by field order will be returned. Consult the provided link for error code interpretations. ``` -------------------------------- ### Get Delivery Notes Count - API Request Example Source: https://www.moloni.pt/dev/documents/delivery-notes/count This snippet demonstrates how to make a GET request to the Moloni API to count delivery notes. It includes the base URL and an example access token placeholder. The endpoint supports various optional parameters for filtering the count. ```http GET https://api.moloni.pt/v1/deliveryNotes/count/?access_token=__[_current_access_token_]__ -- Optional Parameters: -- company_id (int, required) -- customer_id (int) -- salesman_id (int) -- document_set_id (int) -- number (int) -- date (int) -- year (int) -- your_reference (int) -- qty (int, default 50, max 50) -- offset (int, default 0) ``` -------------------------------- ### Moloni API - Product and Tax Details Source: https://www.moloni.pt/dev/documents/internal-documents/insert This section details the fields required for product creation or update, including price, discount, and tax information. It also outlines the structure for tax details within a product. ```APIDOC ## Moloni API - Product and Tax Details ### Description This endpoint allows for the creation or update of products within the Moloni system. It requires essential fields such as price and tax details, with options for discounts, deductions, and other product attributes. The `taxes` array within the product structure allows for detailed tax configuration. ### Method POST /api/products (or similar, depending on the specific Moloni API endpoint for product management) ### Endpoint /api/products ### Parameters #### Request Body - **price** (float) - Required - The base price of the product. - **discount** (float) - Optional - The discount to be applied to the product. - **deduction_id** (int) - Optional - The ID of a deduction to apply. - **order** (int) - Optional - The order in which the product should be displayed. - **origin_id** (int) - Optional - The ID of the product's origin. - **exemption_reason** (string) - Optional - Reason for tax exemption. - **warehouse_id** (int) - Optional - The ID of the warehouse where the product is stored. - **properties** (array) - Optional - An array of product properties. - **title** (string) - The title of the property. - **value** (string) - The value of the property. - **taxes** (array) - Required - An array of tax objects applicable to the product. - **tax_id** (int) - Required - The ID of the tax. - **value** (float) - The value of the tax. - **order** (int) - The order of the tax. - **cumulative** (int) - Indicates if the tax is cumulative. ### Request Example ```json { "price": 100.50, "discount": 5.0, "taxes": [ { "tax_id": 1, "value": 23.0, "order": 1, "cumulative": 0 } ], "properties": [ { "title": "Color", "value": "Blue" } ] } ``` ### Response #### Success Response (200) - **valid** (int) - Indicates if the operation was successful (1 for success). - **document_id** (int) - The ID of the created or updated document (e.g., product ID). #### Response Example ```json { "valid": 1, "document_id": 1234 } ``` ### Error Handling - Errors are returned in a JSON object indexed by the order of the fields. - Error messages are returned as codes. Refer to the provided Moloni documentation link for interpretation. ``` -------------------------------- ### Documents - Global Guides - getOne Source: https://www.moloni.pt/dev/documents/global-guides/getone Retrieves the data for a requested global guide, respecting search parameters. If multiple documents match the search parameters, only the first one found will be returned. ```APIDOC ## GET /v1/globalGuides/getOne ### Description Retrieves the data for a requested global guide, respecting search parameters. If multiple documents match the search parameters, only the first one found will be returned. Within each element of `products`, the `taxes` set may be empty (in which case the `exemption_reason` field of the corresponding `products` element will necessarily be filled). ### Method GET ### Endpoint https://api.moloni.pt/v1/globalGuides/getOne/ ### Parameters #### Query Parameters - **access_token** (string) - Required - The access token for authentication. - **company_id** (integer) - Required - The ID of the company. - **document_id** (integer) - Optional - The ID of the document. - **customer_id** (integer) - Optional - The ID of the customer. - **document_set_id** (integer) - Optional - The ID of the document set. - **number** (integer) - Optional - The document number. - **date** (integer) - Optional - The document date (Unix timestamp). - **year** (integer) - Optional - The document year. ### Request Example ```json { "example": "https://api.moloni.pt/v1/globalGuides/getOne/?access_token=_[current_access_token]_&company_id=123&document_id=456" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the global guide information. - **id** (integer) - The ID of the global guide. - **company_id** (integer) - The ID of the company. - **type** (string) - The type of the global guide. - **number** (integer) - The number of the global guide. - **full_number** (string) - The full number of the global guide. - **date** (string) - The date of the global guide. - **year** (integer) - The year of the global guide. - **customer** (object) - Customer details. - **products** (array) - Array of product details. - **id** (integer) - Product ID. - **name** (string) - Product name. - **sku** (string) - Product SKU. - **quantity** (number) - Product quantity. - **unit_price** (number) - Unit price of the product. - **total_price** (number) - Total price of the product. - **taxes** (array) - Array of tax details. - **tax_id** (integer) - Tax ID. - **name** (string) - Tax name. - **rate** (number) - Tax rate. - **amount** (number) - Tax amount. - **exemption_reason** (string) - Reason for tax exemption (if applicable). #### Response Example ```json { "example": { "data": { "id": 1, "company_id": 123, "type": "INVOICE", "number": 1, "full_number": "1/2023", "date": "2023-01-01", "year": 2023, "customer": { "id": 456, "name": "Customer Name" }, "products": [ { "id": 789, "name": "Product Name", "sku": "PROD-001", "quantity": 1, "unit_price": 100.00, "total_price": 100.00, "taxes": [ { "tax_id": 1, "name": "VAT", "rate": 23.00, "amount": 23.00 } ], "exemption_reason": null } ] } } } ``` ``` -------------------------------- ### Response Structure for Own Asset Movement Guides (JSON) Source: https://www.moloni.pt/dev/documents/oamg/getall This JSON structure represents the data returned by the `getAll` endpoint for own asset movement guides. It includes details for each document such as its ID, type, number, date, references, financial values, and associated entities. ```json [ { "document_id": int, "document_type_id": int, "document_set_id": int, "number": int, "date": datetime, "expiration_date": datetime | null, "your_reference": string, "our_reference": string, "entity_number": string, "entity_name": string, "entity_vat": string, "entity_address": string, "gross_value": float, "comercial_discount_value": float, "financial_discount_value": float, "taxes_value": float, "deduction_value": float, "net_value": float, "status": int, "transport_code": string, "transport_code_set_by": int, "exchange_currency_id": int, "exchange_total_value": float, "exchange_rate": float, "_exchange_currency": { "currency_id": int, "iso4217": string, "symbol": string }, "document_type": { "document_type_id": int, "saft_code": string }, "document_set": { "document_set_id": int, "name": string } }, // ... more documents ] ``` -------------------------------- ### GET /v1/globalGuides/count Source: https://www.moloni.pt/dev/documents/global-guides/count Retrieves the count of global guides for the company. Supports filtering based on various search parameters. ```APIDOC ## GET /v1/globalGuides/count ### Description Returns the quantity of global guides for the company. If search options are defined, it returns the quantity of global guides that meet them. ### Method GET ### Endpoint https://api.moloni.pt/v1/globalGuides/count/ ### Parameters #### Query Parameters - **access_token** (string) - Required - The access token for authentication. - **company_id** (integer) - Required - The ID of the company. - **customer_id** (integer) - Optional - Filters by customer ID. - **document_set_id** (integer) - Optional - Filters by document set ID. - **number** (integer) - Optional - Filters by guide number. - **date** (integer) - Optional - Filters by date (Unix timestamp). - **year** (integer) - Optional - Filters by year. - **your_reference** (integer) - Optional - Filters by your reference. - **qty** (integer) - Optional - The quantity of results to return (default: 50, max: 50). - **offset** (integer) - Optional - The offset for pagination (default: 0). ### Request Example ``` GET https://api.moloni.pt/v1/globalGuides/count/?access_token=__[_current_access_token_]__&company_id=12345 ``` ### Response #### Success Response (200) - **count** (integer) - The number of global guides matching the criteria. #### Response Example ```json { "count": 123 } ``` #### Error Handling Errors are returned in a JSON object indexed by field order. Consult the provided link for error code interpretation. ``` -------------------------------- ### GET /v1/customerAlternateAddresses/getAll Source: https://www.moloni.pt/dev/entities/customer-alternate-addresses/getall Retrieves an array of all alternate addresses for a given customer. This endpoint is available starting from version 1.4+. ```APIDOC ## GET /v1/customerAlternateAddresses/getAll ### Description Retrieves an array of all alternate addresses for a given customer. This endpoint is available starting from version 1.4+. ### Method GET ### Endpoint https://api.moloni.pt/v1/customerAlternateAddresses/getAll/ ### Parameters #### Query Parameters - **access_token** (string) - Required - The access token for authentication. - **company_id** (integer) - Required - The ID of the company. - **customer_id** (integer) - Required - The ID of the customer. - **qty** (integer) - Optional - The number of results to return (default: 50, max: 50). - **offset** (integer) - Optional - The offset for pagination (default: 0). ### Request Example ```json { "request": "https://api.moloni.pt/v1/customerAlternateAddresses/getAll/?access_token=[_current_access_token_]&company_id=123&customer_id=456" } ``` ### Response #### Success Response (200) - **address_id** (integer) - The ID of the alternate address. - **customer_id** (integer) - The ID of the customer this address belongs to. - **designation** (string) - The designation of the alternate address. - **code** (string) - The code for the alternate address. - **address** (string) - The street address. - **city** (string) - The city. - **zip_code** (string) - The zip code. - **country_id** (integer) - The ID of the country. - **email** (string) - The email address. - **phone** (string) - The phone number. - **fax** (string) - The fax number. - **contact_name** (string) - The name of the contact person. #### Response Example ```json [ { "address_id": 1, "customer_id": 456, "designation": "Office Address", "code": "OFFICE", "address": "123 Main St", "city": "Anytown", "zip_code": "12345", "country_id": 1, "email": "office@example.com", "phone": "555-1234", "fax": "555-5678", "contact_name": "John Doe" } ] ``` ### Error Handling - If there is an error in filling the fields, a JSON object with errors indexed by the order of the fields will be returned. - Error messages are returned as codes. Refer to the Moloni API documentation for a guide to understanding these error codes. ``` -------------------------------- ### POST /globalGuides/insert Source: https://www.moloni.pt/dev/documents/global-guides/insert Inserts a new global guide. This endpoint supports various configurations including discounts, taxes, associated documents, country-specific validation, vehicle information, currency exchange, and composite products. ```APIDOC ## POST /globalGuides/insert ### Description Inserts a new global guide. The endpoint handles complex product structures, including composite products with child items, and allows for detailed tax and discount configurations. It also supports multi-currency transactions and document association. ### Method POST ### Endpoint https://api.moloni.pt/v1/globalGuides/insert/?access_token=[current_access_token] ### Parameters #### Path Parameters None #### Query Parameters - **company_id** (integer) - Required - The ID of the company. - **date** (date) - Required - The date of the guide. - **document_type_id** (integer) - Required - The type of document (6 for delivery note, 15 for bill of lading). - **document_set_id** (integer) - Required - The ID of the document set. #### Request Body - **your_reference** (string) - Optional - Your reference for the guide. - **associated_documents** (array) - Optional - Associated documents. - **associated_id** (integer) - Required - The ID of the associated document. - **value** (float) - Required - The total value of the guide. - **related_documents_notes** (string) - Optional - Notes for related documents. - **products** (array) - Required - An array of products included in the guide. - **product_id** (integer) - Required - The ID of the product. - **name** (string) - Required - The name of the product. - **summary** (string) - Optional - A summary of the product. - **qty** (float) - Required - The quantity of the product. - **price** (float) - Required - The price of the product. - **discount** (float) - Optional - The discount percentage for the product (0-100). - **order** (integer) - Optional - The order of the product. - **exemption_reason** (string) - Optional - The reason for tax exemption. Required if taxes are empty or invalid. - **taxes** (array) - Optional - An array of taxes applied to the product. - **tax_id** (integer) - Required - The ID of the tax. - **value** (float) - Required - The value of the tax. Required if tax is defined by article. - **order** (integer) - Optional - The order of the tax. - **cumulative** (integer) - Optional - Cumulative tax flag. - **child_products** (array) - Optional - For composite products, an array of child products. - **product_id** (integer) - Required - The ID of the child product. - **name** (string) - Required - The name of the child product. - **summary** (string) - Optional - A summary of the child product. - **qty** (float) - Required - The quantity of the child product. - **price** (float) - Required - The price of the child product. - **discount** (float) - Optional - The discount percentage for the child product. - **deduction_id** (integer) - Optional - Deduction ID for the child product. - **order** (integer) - Optional - The order of the child product. - **origin_id** (integer) - Optional - Origin ID for the child product. - **exemption_reason** (string) - Optional - Reason for tax exemption for the child product. - **warehouse_id** (integer) - Optional - Warehouse ID for the child product. - **properties** (array) - Optional - Properties of the child product. - **title** (string) - Required - The title of the property. - **value** (string) - Required - The value of the property. - **taxes** (array) - Optional - Taxes applied to the child product. - **tax_id** (integer) - Required - The ID of the tax. - **value** (float) - Required - The value of the tax. - **order** (integer) - Optional - The order of the tax. - **cumulative** (integer) - Optional - Cumulative tax flag. - **exchange_currency_id** (integer) - Optional - The ID of the currency for exchange rate. - **exchange_rate** (float) - Optional - The exchange rate for the currency. - **delivery_method_id** (integer) - Optional - The ID of the delivery method. ### Request Example ```json { "company_id": 1, "date": "2023-10-27", "document_type_id": 6, "document_set_id": 1, "products": [ { "product_id": 101, "name": "Sample Product", "qty": 2, "price": 50.00, "taxes": [ { "tax_id": 1, "value": 23.00 } ] } ] } ``` ### Response #### Success Response (200) - **guide_id** (integer) - The ID of the created global guide. - **document_id** (integer) - The ID of the document associated with the guide. #### Response Example ```json { "guide_id": 12345, "document_id": 67890 } ``` ``` -------------------------------- ### Moloni API: Get All Receipts (Example Request) Source: https://www.moloni.pt/dev/documents/receipts/getall This snippet demonstrates how to construct a GET request to the Moloni API to retrieve all receipts for a company. It includes the base URL and placeholders for the access token and optional parameters like company_id. ```http https://api.moloni.pt/v1/receipts/getAll/?access_token=[current_access_token]&company_id=[company_id] ``` -------------------------------- ### Moloni API: Get All Warehouses (Request Example) Source: https://www.moloni.pt/dev/settings/warehouses/getall This snippet demonstrates how to make a GET request to the Moloni API to retrieve all warehouses. It requires an access token and the company_id as parameters. The response is a JSON array of warehouse objects. ```http GET https://api.moloni.pt/v1/warehouses/getAll/?access_token=[_current_access_token_]&company_id=YOUR_COMPANY_ID ``` -------------------------------- ### Products - Get All Source: https://www.moloni.pt/dev/products/products/getall Retrieves all products, optionally filtered by category and visibility. Supports pagination. ```APIDOC ## GET /v1/products/getAll ### Description Retrieves all products, optionally filtered by category and visibility. Supports pagination. ### Method GET ### Endpoint `https://api.moloni.pt/v1/products/getAll/` ### Parameters #### Query Parameters - **access_token** (string) - Required - Your Moloni API access token. - **company_id** (integer) - Required - The ID of the company. - **category_id** (integer) - Required - The ID of the product category to filter by. - **qty** (integer) - Optional - The number of products to return per page. Defaults to 50, maximum is 50. - **offset** (integer) - Optional - The offset for pagination. Defaults to 0. - **with_invisible** (integer) - Optional - Set to 1 to include products with `visibility_id` set to zero. ### Request Example ```json { "query": { "access_token": "YOUR_ACCESS_TOKEN", "company_id": 123, "category_id": 456, "qty": 50, "offset": 0, "with_invisible": 0 } } ``` ### Response #### Success Response (200) Returns a list of product objects. - **product_id** (integer) - The unique identifier for the product. - **type** (integer) - The type of the product. - **name** (string) - The name of the product. - **reference** (string) - The reference code for the product. - **ean** (string) - The EAN (barcode) of the product. - **price** (float) - The price of the product. - **stock** (float) - The current stock level of the product. - **unit_id** (integer) - The ID of the unit of measurement. - **pos_favorite** (integer) - Indicates if the product is a POS favorite. - **at_product_category** (string) - The category name of the product. - **image** (string) - URL to the product image. - **measurement_unit** (object) - Details about the measurement unit. - **unit_id** (integer) - Unit ID. - **name** (string) - Unit name. - **short_name** (string) - Short name of the unit. - **taxes** (array) - List of taxes applied to the product. - **product_id** (integer) - Product ID associated with the tax. - **tax_id** (integer) - Tax ID. - **value** (float) - Tax value. - **order** (integer) - Order of the tax. - **cumulative** (integer) - Indicates if the tax is cumulative. - **tax** (object) - Details about the tax. - **tax_id** (integer) - Tax ID. - **type** (integer) - Tax type. - **saft_type** (integer) - SAFT type for the tax. - **vat_type** (string) - VAT type. - **stamp_tax** (string) - Stamp tax information. - **name** (string) - Tax name. - **value** (float) - Tax rate. - **fiscal_zone** (string) - Fiscal zone for the tax. - **active_by_default** (integer) - Indicates if the tax is active by default. - **exemption_reason** (string) - Reason for tax exemption. - **properties** (array) - List of properties associated with the product. - **property_id** (integer) - Property ID. - **value** (string) - The value of the property. - **property** (object) - Details about the property. - **property_id** (integer) - Property ID. - **title** (string) - Title of the property. - **price_classes** (array) - List of price classes for the product. - **product_price_class_id** (integer) - Product-specific price class ID. - **price_class_id** (integer) - Price class ID. - **value** (float) - The price for this class. - **price_class** (object) - Details about the price class. - **price_class_id** (integer) - Price class ID. - **title** (string) - Title of the price class. - **warehouses** (array) - List of warehouse stock information. - **product_id** (integer) - Product ID. - **warehouse_id** (integer) - Warehouse ID. - **stock** (float) - Stock level in this warehouse. #### Response Example ```json [ { "product_id": 1, "type": 1, "name": "Sample Product", "reference": "REF001", "ean": "1234567890123", "price": 19.99, "stock": 100.0, "unit_id": 1, "pos_favorite": 0, "at_product_category": "Electronics", "image": "http://example.com/image.jpg", "measurement_unit": { "unit_id": 1, "name": "Piece", "short_name": "pc" }, "taxes": [ { "product_id": 1, "tax_id": 1, "value": 23.0, "order": 1, "cumulative": 0, "tax": { "tax_id": 1, "type": 1, "saft_type": 1, "vat_type": "IVA", "stamp_tax": "0.00", "name": "Standard VAT", "value": 23.0, "fiscal_zone": "PT", "active_by_default": 1, "exemption_reason": "" } } ], "properties": [ { "property_id": 1, "value": "Black", "property": { "property_id": 1, "title": "Color" } } ], "price_classes": [ { "product_price_class_id": 1, "price_class_id": 1, "value": 18.99, "price_class": { "price_class_id": 1, "title": "Wholesale" } } ], "warehouses": [ { "product_id": 1, "warehouse_id": 1, "stock": 100.0 } ] } ] ``` ### Error Handling Returns a JSON object with errors indexed by field order if validation fails. Consult the error codes documentation for interpretation. ``` -------------------------------- ### Moloni API - Get Supplier by VAT (JSON Example) Source: https://www.moloni.pt/dev/entities/suppliers/getbyvat This example demonstrates how to retrieve supplier information using the 'getByVat' endpoint. It requires a company ID and VAT number, with optional quantity and offset parameters. The response is a JSON array of supplier objects. ```json [ { supplier_id: int number: string name: string, vat: string }, _(_..._) ] ```