### Customer GET Response Example Source: https://api-docs.toconline.pt/apis/empresa/clientes-morada-e-email This JSON snippet shows an example response from a GET /customer/{id} request. It is used to retrieve customer details, including the 'main_contact' ID located in the 'relationships' section, which is crucial for subsequent operations like updating the customer's email. ```json { "data": { "type": "customers", "id": "61", "attributes": { "tax_registration_number": "229659179", "business_name": "Manuel Ricardo Ribeiro", "contact_name": null, "website": null, "phone_number": null, "mobile_number": null, "email": null, "observations": null, "internal_observations": null, "not_final_customer": false, "cashed_vat": false, "tax_country_region": "PT", "country_iso_alpha_2": "PT", "saft_import_id": null, "is_tax_exempt": false, "data": {} }, "relationships": { "addresses": { "data": [ { "type": "addresses", "id": "67" } ] }, "company": { "data": { "type": "current_company", "id": "800000046" } }, "defaults": { "data": { "type": "customers_defaults", "id": "31" } }, "email_addresses": { "data": [ { "type": "email_addresses", "id": "24" } ] }, "main_address": { "data": { "type": "addresses", "id": "67" } }, "main_email_address": { "data": { "type": "email_addresses", "id": "24" } }, "tax_exemption_reason": { "data": null } } } } ``` -------------------------------- ### Making Authenticated API Requests with cURL Source: https://api-docs.toconline.pt/autenticacao-detalhada This snippet shows how to make an authenticated GET request to the 'commercial_sales_documents' resource using cURL. It includes the required headers for authentication and content type, along with a query parameter for pagination. The example demonstrates passing the access token and API URL placeholders. ```bash curl -v -H 'Content-Type: application/vnd.api+json' \ -H 'Accept: application/json'\ -H 'Authorization: Bearer ' \ '/commercial_sales_documents?page[size]=5' ``` -------------------------------- ### Get Service Information (JavaScript) Source: https://api-docs.toconline.pt/apis/empresa/produtos-e-servicos Retrieve comprehensive information about a specific service using a GET request. This snippet demonstrates the structure of a successful response. ```javascript { // Response } ``` -------------------------------- ### Get All Services API Endpoint Source: https://api-docs.toconline.pt/apis/empresa/produtos-e-servicos This entry documents the HTTP GET request to retrieve all services available in TOConline. The endpoint is '/services'. No request payload is specified, implying a simple GET request to list all service resources. ```http GET /services ``` -------------------------------- ### GET /services Source: https://api-docs.toconline.pt/apis/empresa/produtos-e-servicos Retrieves a list of all services available in the TOConline system. ```APIDOC ## GET /services ### Description Retrieves a list of all services available in the TOConline system. ### Method GET ### Endpoint /services ### Parameters (No specific query parameters mentioned for this endpoint. Authentication via access token is implied.) ### Response (Response structure for retrieving services is expected to be an array of service objects, similar to the success response for creating services.) ``` -------------------------------- ### GET /products Source: https://api-docs.toconline.pt/apis/compras/documentos-de-compra Retrieves internal IDs for products based on their item code. ```APIDOC ## GET /products ### Description Retrieves the internal ID for a product using its item code. ### Method GET ### Endpoint `/products` ### Parameters #### Query Parameters - **filter[item_code]** (string) - Required - Filters the results by the item code of the product. Example: `PROD123` ### Request Example ```json GET /products?filter[item_code]=PROD123 ``` ### Response #### Success Response (200) - **id** (integer) - The internal ID of the product. #### Response Example ```json { "data": [ { "id": 789, "item_code": "PROD123", "name": "Sample Product" } ] } ``` ``` -------------------------------- ### JSON Response Example from LLM Text Processing API Source: https://api-docs.toconline.pt/apis/vendas/recibos-de-venda This JSON object shows an example response from the LLM text processing API. It mirrors the structure of the input payload but may include updated fields or additional metadata generated by the processing. This is useful for understanding the output format and verifying API results. ```json { "date": "2024-02-24", "document_no": "RC 2023/1", "document_series_id": 66, "payment_mechanism": "MO", "gross_total": 10.69, "net_total": 9.25, "third_party_type": null, "third_party_id": null, "check_number": null, "currency_conversion_rate": 1, "internal_observations": "", "observations": "", "standalone": true, "saft_import_id": null, "deleted": true, "manual_registration_type": null, "manual_registration_series": null, "manual_registration_number": null, "created_at": "2024-02-23 11:49:25.209661", "updated_at": "2024-02-27 14:03:24.085399", "id": 2, "cash_account_id": 2, "company_id": 800000046, "country_id": 1, "currency_id": 1, "customer_id": 57, "user_id": 800000863, "lines": [ { "receipt_id": 2, "receivable_type": "Document", "receivable_id": 12, "received_value": 10.69, "settlement_percentage": 0, "cashed_vat_amount": null, "gross_total": 11.38, "settlement_amount": 0.0, "net_total": 9.25, "retention_total": 0.69, "id": 2 } ] } ``` -------------------------------- ### Retrieve Sales Receipt ID - GET Request Source: https://api-docs.toconline.pt/apis/versoes-anteriores/vendas/recibos-de-venda This example shows how to retrieve the internal ID of a sales receipt using a GET request. You can filter by the receipt's document number. This ID is necessary for voiding the receipt using the PATCH method. ```http GET /commercial_sales_receipts?filter[document_no]= ``` -------------------------------- ### GET /api/oss_countries Source: https://api-docs.toconline.pt/apis/apis-auxiliares/paises Retrieves a list of all OSS countries available in the system. (Note: The provided example response is identical to /api/countries, this endpoint might have a different data source or purpose not fully detailed in the input). ```APIDOC ## GET /api/oss_countries ### Description Retrieves a list of all OSS countries available in the system. (Note: The provided example response is identical to /api/countries, this endpoint might have a different data source or purpose not fully detailed in the input). ### Method GET ### Endpoint /api/oss_countries ### Parameters #### Query Parameters None #### Request Body None ### Request Example ``` GET /api/oss_countries ``` ### Response #### Success Response (200) - **data** (array) - An array of country objects. - **type** (string) - The type of the resource, typically "countries". - **id** (string) - The unique identifier for the country. - **attributes** (object) - Contains the country's details. - **default_name** (string) - The default name of the country. - **iso_alpha_2** (string) - The ISO 3166-1 alpha-2 code for the country. - **iso_alpha_3** (string) - The ISO 3166-1 alpha-3 code for the country. - **tax_country_region** (string) - The tax region code for the country. #### Response Example ```json { "data": [ { "type": "countries", "id": "1", "attributes": { "default_name": "Portugal - Continente", "iso_alpha_2": "PT", "iso_alpha_3": "PRT", "tax_country_region": "PT" } }, { "type": "countries", "id": "2", "attributes": { "default_name": "Portugal - Madeira", "iso_alpha_2": "PT-MA", "iso_alpha_3": "PRT", "tax_country_region": "PT-MA" } } ] } ``` ``` -------------------------------- ### Update Customer Response Example (JSON) Source: https://api-docs.toconline.pt/apis/empresa/clientes-morada-e-email This JSON object illustrates a successful response after updating a customer. It includes the customer's data with all their attributes, relationships, and any additional fields populated by the system. ```json { "data": { "type": "customers", "id": "31", "attributes": { "tax_registration_number": "146081692", "business_name": "Isso mesmo", "contact_name": "Bruno Cascais", "website": "http://issomesmo.pt", "phone_number": "21344444", "mobile_number": "935678999", "email": "aaaaa@issomesmo.pt", "observations": "observções do cliente", "internal_observations": "observações internas", "not_final_customer": false, "cashed_vat": false, "tax_country_region": "PT", "country_iso_alpha_2": "PT", "saft_import_id": null, "is_tax_exempt": false, "tax_exemption_reason_id": null, "accounting_number": null, "data": {}, "credit_limit_value": null, "credit_limit_days": null, "has_credit_limit_override": false }, "relationships": { "addresses": { "data": [] }, "company": { "data": { "type": "current_company", "id": "800000046" } }, "contacts": { "data": [] }, "defaults": { "data": null }, "email_addresses": { "data": [] }, "main_address": { "data": null }, "main_email_address": { "data": null }, "tax_exemption_reason": { "data": null } } } } ``` -------------------------------- ### POST /api/products Source: https://api-docs.toconline.pt/apis/empresa/produtos-e-servicos Creates a new product within the TOConline system. Requires a JSON payload with product details. ```APIDOC ## POST /api/products ### Description Creates a new product within the TOConline system. Requires a JSON payload with product details. ### Method POST ### Endpoint /api/products ### Parameters #### Request Body - **data** (object) - Required - The main data object for the product. - **type** (string) - Required - Must be 'products'. - **attributes** (object) - Required - Contains the product attributes. - **type** (string) - Required - Must be 'Product'. - **item_code** (string) - Required - The unique code for the item. - **item_description** (string) - Required - A description of the product. - **sales_price** (number) - Optional - The selling price of the product. - **sales_price_includes_vat** (boolean) - Optional - Defaults to false. Set to true if the sales price includes VAT. - **tax_code** (string) - Optional - The tax code for the product. Supported types: 'NOR' (normal), 'INT' (intermediate), 'RED' (reduced), 'ISE' (exempt). ### Request Example ```json { "data": { "type": "products", "attributes": { "type": "Product", "item_code": "PTEST", "item_description": "Test product", "sales_price": 100, "sales_price_includes_vat": false, "tax_code": "NOR" } } } ``` ### Response #### Success Response (200) - **meta** (object) - Contains metadata about the request. - **data** (object) - Contains the created product details. - **type** (string) - The type of the data, 'products'. - **id** (string) - The unique identifier for the created product. - **attributes** (object) - The attributes of the created product. - **item_code** (string) - The item code. - **item_description** (string) - The item description. - **sales_price** (number) - The sales price. - **sales_price_includes_vat** (boolean) - Indicates if sales price includes VAT. - **tax_code** (string) - The tax code. - **applied_tax_code** (string) - The applied tax code. - **sales_price_vat_display** (number) - The sales price including VAT for display. - **is_active** (boolean) - Indicates if the product is active. - **relationships** (object) - Contains relationships to other entities. #### Response Example ```json { "meta": { "observed": { "scalar": 1 } }, "data": { "type": "products", "id": "3", "attributes": { "item_code": "PTEST", "item_description": "Test product", "sales_price": 100, "sales_price_includes_vat": false, "tax_code": "NOR", "applied_tax_code": "NOR", "sales_price_vat_display": 123.00, "is_active": true }, "relationships": { "applied_tax_exemption_reason": { "data": null }, "company": { "data": { "type": "current_company", "id": "800000046" } }, "unit_of_measure": { "data": { "type": "units_of_measure", "id": "2" } } } } } ``` ``` -------------------------------- ### Get All Finalized Purchase Documents (GET) Source: https://api-docs.toconline.pt/apis/versoes-anteriores/compras/documentos-de-compra Retrieves a list of all commercial purchase documents that have been finalized. This GET request is made to the /api/commercial_purchases_documents endpoint with a filter parameter to specify the status. ```http {{base_url}}/api/commercial_purchases_documents?filter[status]=1 ``` -------------------------------- ### Create Customer Email Response Example (JSON) Source: https://api-docs.toconline.pt/apis/empresa/clientes-morada-e-email This is a sample JSON response received after successfully creating a customer email using the TOConline API. It includes the created contact's data, such as 'id', 'type', and 'attributes' like 'name' and 'email'. ```json { "data": { "type": "contacts", "id": "27", "attributes": { "is_primary": true, "name": "teste_cmo", "position": null, "phone_number": null, "mobile_number": null, "email": "61_manuel@email.pt" }, "relationships": { "supplier": { "data": null } } } } ``` -------------------------------- ### Exemplo de Resposta da API para Finalizar Documento (JSON) Source: https://api-docs.toconline.pt/apis/versoes-anteriores/vendas/documentos-de-venda Este snippet mostra um exemplo de resposta da API quando um documento é finalizado com sucesso. Inclui metadados e detalhes do documento, como o status '1' que indica que o documento foi finalizado. ```json { "meta": { "observed": { "scalar": 1 } }, "data": { "type": "commercial_sales_documents", "id": "12", "attributes": { "document_no": "FT 2023/3", "status": 1, "date": "2023-01-01", "payment_mechanism": null, "gross_total": 11.38, "notes": "Notas ao documento", "document_type": "FT", "pending_total": 11.38, "retention": 7.5, "settlement": null, "settlement_total": 0.75, "due_date": "2023-01-01", "emailed": null, "tax_payable": 2.13, "net_total": 9.25, "document_hash_sum": "k8FEN8/xf+GErWsPiATVpAWd5jM64132yWVldc6qg7XNxpjt+JCJTwgqQ5fswUsXw0MbbtBzHpN/aZozPiiiRHiHAR+TM4hJ8u5XnAe5hiss2Tn//QiCxbvolLywCqRw4cIt1UcbhMEP97YYj0FdLgzrPTF1amU+Xk81EkBzq54=", "hash_control": "1", "reference": null, "customer_tax_registration_number": "229659179", "customer_business_name": "Ricardo Ribeiro", "customer_address_detail": "Praceta da Liberdade n5", "customer_postcode": "1000-101", "customer_city": "Lisboa", "created_at": "2024-02-21 16:41:50.588385", "updated_at": "2024-02-22 18:21:13.512872", "is_receipt": null, "vehicle_registration": null, "shipment_address_detail": null, "shipment_postcode": null, "shipment_city": null, "vat_incidence_ise": 0, "vat_incidence_red": 0, "vat_incidence_int": 0, "vat_incidence_nor": 9.25, "vat_total_red": 0, "vat_total_int": 0, "vat_total_nor": 2.13, "customer_tax_country_region": "PT", "currency_amount": null, "customer_country": "PT", "printed": null, "currency_conversion_rate": 1, "currency_iso_code": "EUR", "system_entry_date": "2024-02-22 18:21:13.512872", "retention_value": 0.69, "parent_document_reference": "", "acts_as_shipment_document": false, "manual_registration_series": "", "manual_registration_number": "", "shipment_loading_time": null, "expected_shipment_unloading_time": null, "apply_retention_when_paid": true, "retention_aware_gross_total": 10.69, "pending_retention_value": 0.69, "communication_status": "unsent", "shipment_country": null, "is_invoice_receipt": null, "due_days": null, "scheduled_start_date": null, "scheduled_end_date": null, "scheduled_description": null, "scheduled_interval": null, "base_currency_gross_total": null, "base_currency_net_total": null, "base_currency_pending_total": null, "base_currency_settlement_total": null, "base_currency_retention_total": null, "base_currency_retention_aware_gross_total": null, "base_currency_tax_payable": null, "base_currency_vat_incidence_nor": null, "base_currency_vat_total_nor": null, "base_currency_vat_incidence_int": null, "base_currency_vat_total_int": null, "base_currency_vat_incidence_red": null, "base_currency_vat_total_red": null, "base_currency_vat_incidence_ise": null, "base_currency_conversion_difference": null, "start_date": null, "end_date": null, "periodicity": null, "description": null, "reference_document_type": null, "is_active": null } } } ``` -------------------------------- ### Get All OSS Countries - GET Request Source: https://api-docs.toconline.pt/apis/apis-auxiliares/paises Retrieves a list of all OSS countries available in the system. Similar to the 'Get All Countries' endpoint, this does not require parameters and returns a JSON array of country objects. Each object contains detailed information about the country. ```http GET https://api/v1.toconline.com/api/oss_countries ``` -------------------------------- ### Associar Família de Item a Serviço (PATCH /api/services) Source: https://api-docs.toconline.pt/apis/empresa/produtos-e-servicos Este snippet demonstra como atualizar um serviço existente para associá-lo a uma família de itens específica. É necessário que a família de itens já esteja criada. A requisição utiliza o método PATCH na rota /api/services. ```json { "data": { "type": "services", "id": "7", "attributes": { "item_family_id": 4 } } } ``` -------------------------------- ### Get All Payments (GET) Source: https://api-docs.toconline.pt/apis/compras/pagamentos Retrieves a list of all payment documents within the system. This endpoint does not require any parameters in the path. ```openapi GET https://1863668386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk7sif7BY0rPzivMcj1HB%2Fuploads%2FZBJyxFky3EPPL5hA0Lxx%2FTOConline%20Open%20API.yaml?alt=media&token=a2616c07-07e1-4b6e-b74f-3de4caae92d7 GET /api/v1/commercial_purchases_payments/ ``` -------------------------------- ### Get Payment by ID (GET) Source: https://api-docs.toconline.pt/apis/compras/pagamentos Retrieves detailed information about a specific payment document. The ID of the payment document must be provided in the URL path. ```openapi GET https://1863668386-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk7sif7BY0rPzivMcj1HB%2Fuploads%2FZBJyxFky3EPPL5hA0Lxx%2FTOConline%20Open%20API.yaml?alt=media&token=a2616c07-07e1-4b6e-b74f-3de4caae92d7 GET /api/commercial_purchases_payments/{id} ``` -------------------------------- ### Exemplo de Requisição POST para obter Access Code com curl Source: https://api-docs.toconline.pt/autenticacao-simplificada Este snippet demonstra como fazer um pedido POST para o endpoint de token para obter um access code. Inclui a configuração de headers essenciais como Content-Type, Accept e Authorization, além dos parâmetros do corpo da requisição necessários. O header de autorização requer credenciais codificadas em Base64. ```bash curl -v -X POST -H 'Content-Type: application/x-www-form-urlencoded'\ -H 'Accept: application/json'\ -H 'Authorization: Basic ' \ -d 'grant_type=authorization_code&\ code=&scope=commercial' \ '/token' ``` -------------------------------- ### POST /api/services Source: https://api-docs.toconline.pt/apis/empresa/produtos-e-servicos Creates a new service within the TOConline system. Requires a JSON payload with service details. ```APIDOC ## POST /api/services ### Description Creates a new service within the TOConline system. Requires a JSON payload with service details. ### Method POST ### Endpoint /api/services ### Parameters #### Request Body - **data** (object) - Required - The main data object for the service. - **type** (string) - Required - Must be 'services'. - **attributes** (object) - Required - Contains the service attributes. - **type** (string) - Required - Must be 'Service'. - **item_code** (string) - Required - The unique code for the item. - **item_description** (string) - Required - A description of the service. - **sales_price** (number) - Optional - The selling price of the service. - **sales_price_includes_vat** (boolean) - Optional - Defaults to false. Set to true if the sales price includes VAT. - **tax_code** (string) - Optional - The tax code for the service. Supported types: 'NOR' (normal), 'INT' (intermediate), 'RED' (reduced), 'ISE' (exempt). ### Request Example ```json { "data": { "type": "services", "attributes": { "type": "Service", "item_code": "STEST", "item_description": "Test service", "sales_price": 100, "sales_price_includes_vat": false, "tax_code": "NOR" } } } ``` ### Response (Response structure for creating services is similar to creating products, with 'services' as the type and 'Service' as the attribute type.) ``` -------------------------------- ### GET /api/addresses/{id} Source: https://api-docs.toconline.pt/apis/empresa/fornecedores Retrieves information for a specific supplier by their ID. This endpoint is useful for getting detailed information about a single supplier. ```APIDOC ## GET /api/addresses/{id} ### Description Retrieves information for a specific supplier by their ID. ### Method GET ### Endpoint /api/addresses/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the supplier. #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "curl -v -X GET -H 'Content-Type: application/vnd.api+json' -H 'Accept: application/json' -H 'Authorization: Bearer ' '/api/addresses/{id}'" } ``` ### Response #### Success Response (200) - **data** (object) - A supplier object containing detailed information. #### Response Example ```json { "data": { "type": "suppliers", "id": "7", "attributes": { "tax_registration_number": "533186331", "business_name": "A Empresa", "website": "www.a_empresa.pt", "is_taxable": false, "is_tax_exempt": false, "tax_exemption_reason_id": null, "self_billing": null, "document_series_id": null, "internal_observations": null, "tax_country_region": "PT-AC", "is_independent_worker": false, "country_iso_alpha_2": "PT-AC", "saft_import_id": null, "accounting_number": null, "trusted_email_source": false }, "relationships": { "addresses": { "data": [ { "type": "addresses", "id": "45" } ] }, "bank_accounts": { "data": [ { "type": "bank_accounts", "id": "4" } ] }, "company": { "data": { "type": "current_company", "id": "800000046" } }, "contacts": { "data": [ { "type": "contacts", "id": "17" } ] }, "defaults": { "data": { "type": "suppliers_defaults", "id": "4" } }, "main_address": { "data": { "type": "addresses", "id": "45" } }, "main_contact": { "data": { "type": "contacts", "id": "17" } }, "tax_exemption_reason": { "data": null } } } } ``` ``` -------------------------------- ### Exemplo de Resposta da API após Criação de Recibo de Venda Source: https://api-docs.toconline.pt/apis/versoes-anteriores/vendas/recibos-de-venda Apresenta um exemplo da resposta JSON recebida da API após a criação bem-sucedida de um recibo de venda. A resposta contém os detalhes do recibo criado, incluindo `id`, `date`, `document_no`, `payment_mechanism`, totais, e informações de relacionamento com outras entidades como `commercial_document_series` e `company`. ```json { "data": { "type": "commercial_sales_receipts", "id": "6", "attributes": { "date": "2020-06-01", "document_no": "RC 2023/5", "document_series_id": 66, "payment_mechanism": "MO", "gross_total": 0, "net_total": 0, "third_party_type": "", "third_party_id": null, "check_number": null, "currency_conversion_rate": 1, "internal_observations": null, "observations": null, "standalone": null, "saft_import_id": null, "deleted": false, "manual_registration_type": null, "manual_registration_series": null, "manual_registration_number": null, "created_at": "2024-02-26 11:31:37.827953", "updated_at": "2024-02-26 11:31:37.827953" }, "relationships": { "bank_accounts": { "data": null }, "cash_accounts": { "data": null }, "commercial_document_series": { "data": { "type": "commercial_document_series", "id": "66" } }, "company": { "data": { "type": "current_company", "id": "800000046" } }, "country": { "data": null } } } } ``` -------------------------------- ### Get Sales Receipt by ID (GET) Source: https://api-docs.toconline.pt/apis/vendas/recibos-de-venda This endpoint retrieves detailed information about a specific sales receipt. The `id` of the receipt must be provided in the URL path for the request. ```http GET /v1/commercial_sales_receipts/{id} ``` -------------------------------- ### GET /api/url_for_print/{salesDocumentId} Source: https://api-docs.toconline.pt/apis/vendas/descarregar-pdf-de-documentos-de-venda Retrieves the URL path for printing a sales document. The document must be in a finalized state (status = 1) to be downloadable. You can find the salesDocumentId by referring to the 'Get all finalized purchase documents' endpoint. ```APIDOC ## GET /api/url_for_print/{salesDocumentId} ### Description Retrieves the URL path for printing a sales document. The document must be in a finalized state (status = 1) to be downloadable. You can find the salesDocumentId by referring to the 'Get all finalized purchase documents' endpoint. ### Method GET ### Endpoint `/api/url_for_print/{salesDocumentId}` ### Parameters #### Path Parameters - **salesDocumentId** (string) - Required - The ID of the sales document. #### Query Parameters - **filter[type]** (string) - Optional - Specifies the type of document, e.g., "Document". - **filter[copies]** (integer) - Optional - Specifies the number of copies, e.g., 1. ### Request Example ```json { "example": "GET https://app.toconline.pt/api/url_for_print/{id do documento de venda}?filter[type]=Document&filter[copies]=1" } ``` ### Response #### Success Response (200) - **scheme** (string) - The scheme for the URL (e.g., "https"). - **host** (string) - The host for the URL (e.g., "app.toconline.pt"). - **path** (string) - The path to the downloadable file. #### Response Example ```json { "example": { "scheme": "https", "host": "app.toconline.pt", "path": "/public-file/path_to_file" } } ``` ``` -------------------------------- ### Criar Cabeçalho de Recibo de Venda com cURL Source: https://api-docs.toconline.pt/apis/versoes-anteriores/vendas/recibos-de-venda Exemplo de como criar um cabeçalho de recibo de venda utilizando o comando cURL. Este comando envia uma requisição POST para o endpoint especificado com os devidos cabeçalhos de autenticação e tipo de conteúdo. O utilizador deve substituir ``, `` e `` pelos valores corretos. ```bash curl -v -X POST -H 'Content-Type: application/vnd.api+json' -H 'Accept: application/json' -H 'Authorization: Bearer ' -d '' '/commercial_sales_receipts' ``` -------------------------------- ### GET /api/item_families Source: https://api-docs.toconline.pt/apis/apis-auxiliares/familia-de-itens Retrieves a list of all item families. ```APIDOC ## GET /api/item_families ### Description Retrieves a list of all item families. ### Method GET ### Endpoint /api/item_families ### Response #### Success Response (200 OK) - **families** (array) - A list of item family objects. - Each object contains: - **id** (string) - The unique identifier of the item family. - **name** (string) - The name of the item family. - **description** (string) - The description of the item family. #### Response Example ```json { "families": [ { "id": "family-123", "name": "Example Family 1", "description": "Description for family 1" }, { "id": "family-456", "name": "Example Family 2", "description": "Description for family 2" } ] } ``` ``` -------------------------------- ### GET /products Source: https://api-docs.toconline.pt/apis/empresa/produtos-e-servicos Retrieves information about a specific product or all available products. Filtering can be applied using path parameters. ```APIDOC ## GET /products ### Description Retrieves information about a specific product or all available products. Filtering can be applied using path parameters, following JSONAPI conventions. ### Method GET ### Endpoint /products #### Path Parameters - **filter[item_code]** (String) - Optional - The item code to filter products by. ### Request Example ```json { "example": "No request body for GET requests" } ``` ### Response #### Success Response (200) - **data** (Array) - An array of product objects. - **type** (String) - The type of the resource. - **id** (String) - The unique identifier of the product. - **attributes** (Object) - Contains the product's attributes. - **item_code** (String) - The item code of the product. - **item_description** (String) - A brief description of the product. - **sales_price** (Number) - The sales price of the product. - **sales_price_includes_vat** (Boolean) - Indicates if the sales price includes VAT. - **tax_code** (String) - The tax code applied to the product. - **applied_tax_code** (String) - The tax code currently applied. - **notes** (String) - Any notes associated with the product. - **is_merchandise** (Any) - Indicates if the item is merchandise. - **location_in_warehouse** (Any) - The product's location in the warehouse. - **sales_price_2** (Number) - Second sales price. - **sales_price_3** (Number) - Third sales price. - **purchase_price** (Number) - The purchase price of the product. - **ean_barcode** (String) - The EAN barcode of the product. - **financial_cost** (Number) - The financial cost of the product. - **transport_cost** (Number) - The transport cost of the product. - **other_cost** (Number) - Other associated costs. - **customs_cost** (Number) - Customs cost. - **estimated_total_cost** (Number) - The estimated total cost. - **product_inventory_type** (String) - The type of product inventory. - **accounting_number** (Any) - The accounting number for the product. - **service_group** (Any) - The service group the product belongs to. - **is_active** (Boolean) - Indicates if the product is active. - **sales_price_vat_display** (Number) - Sales price including VAT for display. - **sales_price_2_vat_display** (Number) - Second sales price including VAT for display. - **sales_price_3_vat_display** (Number) - Third sales price including VAT for display. - **applied_tax_exemption_reason_id** (Any) - The ID of the applied tax exemption reason. - **relationships** (Object) - Contains relationships to other resources. - **applied_tax_exemption_reason** (Object) - Relationship to applied tax exemption reason. - **company** (Object) - Relationship to the company. - **item_families** (Object) - Relationship to item families. - **tax_exemption_reasons** (Object) - Relationship to tax exemption reasons. - **unit_of_measure** (Object) - Relationship to the unit of measure. #### Response Example ```json { "data": [ { "type": "products", "id": "2", "attributes": { "item_code": "100", "item_description": "Isto é uma breve descrição", "sales_price": 2.0, "sales_price_includes_vat": false, "tax_code": "INT", "applied_tax_code": "INT", "notes": "Isto são notas de produtos", "is_merchandise": null, "location_in_warehouse": null, "sales_price_2": 4.0, "sales_price_3": null, "purchase_price": 5.0, "ean_barcode": "553214", "financial_cost": 2.0, "transport_cost": 1.0, "other_cost": 0.0, "customs_cost": 10.0, "estimated_total_cost": 18.0, "product_inventory_type": "P", "accounting_number": null, "service_group": null, "is_active": true, "sales_price_vat_display": 2.26, "sales_price_2_vat_display": 4.52, "sales_price_3_vat_display": null, "applied_tax_exemption_reason_id": null }, "relationships": { "applied_tax_exemption_reason": { "data": null }, "company": { "data": { "type": "current_company", "id": "800000046" } }, "item_families": { "data": { "type": "item_families", "id": "3" } }, "tax_exemption_reasons": { "data": null }, "unit_of_measure": { "data": { "type": "units_of_measure", "id": "5" } } } } ] } ``` ``` -------------------------------- ### Create Commercial Purchase Document (API) Source: https://api-docs.toconline.pt/apis/compras/documentos-de-compra This snippet demonstrates how to create a commercial purchase document using the TOConline API. It requires a JSON payload with mandatory fields like document type and optional fields for dates, series, supplier details, payment terms, VAT, currency, and retention. Refer to the OpenAPI specification for detailed field descriptions and constraints. ```json { "document_type": "FC|DSP", "date": "2023-01-01", "document_series_id": 1, "document_series_prefix": "Prefixo da série", "supplier_id": 1, "supplier_tax_registration_number": "999999990", "supplier_business_name": "Nome do fornecedor", "supplier_address_detail": "Morada do fornecedor", "supplier_postcode": "0000-000", "supplier_city": "Cidade/Localidade do fornecedor", "supplier_country": "PT", "due_date": "2023-02-01", "settlement_expression": "7.5", "vat_included_prices": false, "tax_exemption_reason_id": 1, "currency_id": 1, "currency_iso_code": "USD", "currency_conversion_rate": 1.21, "retention_total": 9.99 } ``` -------------------------------- ### GET /api/expense_categories Source: https://api-docs.toconline.pt/apis/apis-auxiliares/categorias-de-despesa Retrieves a list of all expense categories. ```APIDOC ## GET /api/expense_categories ### Description Retrieves a list of all expense categories. ### Method GET ### Endpoint /api/expense_categories ### Parameters #### Query Parameters - **id** (string) - Optional - The ID of the expense category to filter by. ### Request Example ```json { "example": "GET /api/expense_categories" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the expense category. - **name** (string) - The name of the expense category. #### Response Example ```json { "example": [ { "id": "cat_123", "name": "Groceries" }, { "id": "cat_456", "name": "Utilities" } ] } ``` ``` -------------------------------- ### GET /api/commercial_document_series Source: https://api-docs.toconline.pt/apis/apis-auxiliares/documentos-de-serie Retrieves all commercial document series. ```APIDOC ## GET /api/commercial_document_series ### Description Retrieves all commercial document series. ### Method GET ### Endpoint /api/commercial_document_series ### Parameters #### Query Parameters * **filter[document_type]** (string) - Optional - Filters by document type. * **filter[prefix]** (string) - Optional - Filters by document prefix. * **filter[number]** (integer) - Optional - Filters by document number. ### Request Example ```json { "example": "GET /api/commercial_document_series" } ``` ### Response #### Success Response (200) - **data** (array) - An array of commercial document series objects. #### Response Example ```json { "example": "{\"data\": [{\"id\": \"123\", \"document_type\": \"FT\", \"prefix\": \"2023\", \"number\": \"3\"}]}" } ``` ``` -------------------------------- ### Create Product API Response Source: https://api-docs.toconline.pt/apis/empresa/produtos-e-servicos This snippet illustrates the JSON response received after successfully creating a product using the TOConline API. It includes metadata and the full details of the created product, such as its unique ID, item code, description, pricing, and tax details. ```json { "meta": { "observed": { "scalar": 1 } }, "data": { "type": "products", "id": "3", "attributes": { "item_code": "PTEST", "item_description": "Test product", "sales_price": 100, "sales_price_includes_vat": false, "tax_code": "NOR", "applied_tax_code": "NOR", "notes": null, "is_merchandise": null, "location_in_warehouse": null, "sales_price_2": null, "sales_price_3": null, "purchase_price": null, "ean_barcode": null, "financial_cost": 0.0, "transport_cost": 0.0, "other_cost": 0.0, "customs_cost": 0.0, "estimated_total_cost": 0.0, "product_inventory_type": null, "accounting_number": null, "service_group": null, "is_active": true, "sales_price_vat_display": 123.00, "sales_price_2_vat_display": null, "sales_price_3_vat_display": null, "applied_tax_exemption_reason_id": null }, "relationships": { "applied_tax_exemption_reason": { "data": null }, "company": { "data": { "type": "current_company", "id": "800000046" } }, "item_families": { "data": null }, "tax_exemption_reasons": { "data": null }, "unit_of_measure": { "data": { "type": "units_of_measure", "id": "2" } } } } } ``` -------------------------------- ### Retrieve Document ID for Settlement (GET) Source: https://api-docs.toconline.pt/apis/vendas/recibos-de-venda This GET request is used to obtain the internal ID of a sales document (invoice, note) that needs to be settled. The `document_no` parameter is used to filter and find the specific document. ```http GET /commercial_sales_documents?filter[document_no]= ```