{
  "openapi": "3.0.1",
  "info": {
    "title": "Invoices API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.mercadoe.com"
    }
  ],
  "paths": {
    "/v1/invoices/{invoiceId}": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get an invoice based on the invoiceId",
        "description": "Retrieve information about a specific invoice with the given invoiceId.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "the invoice id",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetByIdResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/v1/invoices/{invoiceId}/items": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get a list of invoice items based on the invoiceId",
        "description": "Get a list of all items assigned to a specific invoice.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "the invoice id",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "description": "the page number must be an integer greater than or equal to 1",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "the page size must be an integer greater than or equal to 1",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetItemsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/{invoiceId}/business-organizations": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get the Business Organizations based on the invoiceId",
        "description": "Get information about the business organizations of a specific invoice with the given invoiceId.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "the invoice id",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "description": "the page number must be an integer greater than or equal to 1",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "the page size must be an integer greater than or equal to 1",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetBusinessOrganizationsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/v1/invoices/{invoiceId}/attachments": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get the attachments based on the invoiceId",
        "description": "Get information about the attachments of a specific invoice with the given invoiceId.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "the invoice id",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "description": "the page number must be an integer greater than or equal to 1",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "the page size must be an integer greater than or equal to 1",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAttachmentsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      },
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Add an attachment to an invoice",
        "description": "Add a new attachment to a specific invoice by providing the invoice ID and the attachment file.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The invoice ID",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "X-ME-CORRELATION-ID",
            "in": "header",
            "description": "Internal client code to be identified in the webhook. It can be, for example, a product code in your ERP, an order number, etc.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "description": "The attachment file to be uploaded",
                    "format": "binary"
                  }
                }
              },
              "encoding": {
                "file": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAttachmentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/{invoiceId}/attachments/{attachmentId}": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get information from invoice attachment",
        "description": "Retrieves information about an invoice attachment with the given invoiceId and the attachmentId.\r\nYou can get information about the attachment such as size, date and other details.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "attachmentId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceAttachmentMetadataResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Invoices"
        ],
        "summary": "Delete an invoice attachment document",
        "description": "Delete an attachment document from a specific invoice by providing the invoice ID and the attachment ID.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "attachmentId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "X-ME-CORRELATION-ID",
            "in": "header",
            "description": "Internal client code to be identified in the webhook. It can be, for example, a product code in your ERP, an order number, etc.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteAttachmentDocumentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/{invoiceId}/attachments/{attachmentId}/download": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Redirection link to download the attachment",
        "description": "This endpoint redirects directly to the client's attachment download by entering the `invoiceId`, `attachmentId`, and `cancellationToken`.\r\nYou can add more than one attachment, but only one at a time.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "attachmentId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/{invoiceId}/attributes": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get the invoice attributes based on the invoice Id.",
        "description": "Get information about the attributes of a specific purchase invoice with the given invoiceId.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAttributesResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/{invoiceId}/items/attributes": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get the invoice items attributes based on the invoice Id.",
        "description": "Get information about the item attributes of a specific purchase invoice with the given invoiceId.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "description": "",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAttributesItemsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/{invoiceId}/status": {
      "put": {
        "tags": [
          "Invoices"
        ],
        "summary": "Update an Invoice status based on the invoiceId",
        "description": "Change the specified fields of an invoice with the provided values by informing the invoiceId.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The invoice Id in the ERP",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "X-ME-CORRELATION-ID",
            "in": "header",
            "description": "Internal client code to be identified in the webhook. It can be, for example, a product code in your ERP, an order number, etc.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateStatusCommand"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices": {
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Create an invoice",
        "description": "Create a new invoice by providing the serial number, invoice number, items, and other details.",
        "parameters": [
          {
            "name": "X-ME-CORRELATION-ID",
            "in": "header",
            "description": "Internal client code to be identified in the webhook. It can be, for example, a product code in your ERP, an order number, etc.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBuyerCommand"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateBuyerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/supplier-invoices": {
      "post": {
        "tags": [
          "Supplier Invoices"
        ],
        "summary": "Create an invoice",
        "description": "Create a new invoice by providing the serial number, invoice number, items, and other details.",
        "parameters": [
          {
            "name": "X-ME-CORRELATION-ID",
            "in": "header",
            "description": "Internal client code to be identified in the webhook. It can be, for example, a product code in your ERP, an order number, etc.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSupplierCommand"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateSupplierResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/supplier-invoices/{invoiceId}/attachments": {
      "post": {
        "tags": [
          "Supplier Invoices"
        ],
        "summary": "Add an attachment to an invoice",
        "description": "Add a new attachment to a specific invoice by providing the invoice ID and the attachment file.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The invoice ID",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "X-ME-CORRELATION-ID",
            "in": "header",
            "description": "Internal client code to be identified in the webhook. It can be, for example, a product code in your ERP, an order number, etc.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "description": "The attachment file to be uploaded",
                    "format": "binary"
                  }
                }
              },
              "encoding": {
                "file": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAttachmentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Supplier Invoices"
        ],
        "summary": "Get the attachments based on the invoiceId",
        "description": "Get information about the attachments of a specific invoice with the given invoiceId.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "the invoice id",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pageNumber",
            "in": "query",
            "description": "the page number must be an integer greater than or equal to 1",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "the page size must be an integer greater than or equal to 1",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAttachmentsResponse2"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/v1/invoices/supplier-invoices/{invoiceId}/attachments/{attachmentId}/download": {
      "get": {
        "tags": [
          "Supplier Invoices"
        ],
        "summary": "Redirection link to download the attachment",
        "description": "This endpoint redirects directly to the supplier's attachment download by entering the `invoiceId`, `attachmentId`, and `cancellationToken`.\r\nYou can add more than one attachment, but only one at a time.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "attachmentId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/supplier-invoices/{invoiceId}/attachments/{attachmentId}": {
      "get": {
        "tags": [
          "Supplier Invoices"
        ],
        "summary": "Get information from invoice attachment",
        "description": "Retrieves information about an invoice attachment with the given invoiceId and the attachmentId.\r\nYou can get information about the attachment such as size, date and other details.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "attachmentId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInvoiceAttachmentMetadataResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Supplier Invoices"
        ],
        "summary": "Delete an invoice attachment document",
        "description": "Delete an attachment document from a specific invoice by providing the invoice ID and the attachment ID.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "attachmentId",
            "in": "path",
            "description": "",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "X-ME-CORRELATION-ID",
            "in": "header",
            "description": "Internal client code to be identified in the webhook. It can be, for example, a product code in your ERP, an order number, etc.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteAttachmentDocumentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AttributeDto": {
        "type": "object",
        "properties": {
          "name": {
            "maxLength": 256,
            "type": "string",
            "description": "Name"
          },
          "value": {
            "type": "string",
            "description": "Value"
          }
        },
        "additionalProperties": false
      },
      "BusinessOrganization": {
        "required": [
          "code"
        ],
        "type": "object",
        "properties": {
          "code": {
            "minLength": 1,
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "virtualEntityField": {
            "type": "string",
            "nullable": true
          },
          "virtualEntityDescription": {
            "type": "string",
            "nullable": true
          },
          "entityType": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BusinessOrganizationsDto": {
        "required": [
          "code"
        ],
        "type": "object",
        "properties": {
          "code": {
            "maxLength": 20,
            "minLength": 1,
            "type": "string",
            "description": "Company code"
          },
          "description": {
            "maxLength": 100,
            "type": "string",
            "description": "Company description",
            "nullable": true
          },
          "virtualEntityField": {
            "type": "string",
            "description": "Delivery center/location code",
            "nullable": true
          },
          "virtualEntityDescription": {
            "maxLength": 50,
            "type": "string",
            "description": "Delivery center/location description",
            "nullable": true
          },
          "entityType": {
            "maxLength": 50,
            "type": "string",
            "description": "Entity type",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateAttachmentResponse": {
        "type": "object",
        "properties": {
          "correlationId": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CreateBuyerCommand": {
        "required": [
          "category",
          "integrationTag",
          "invoiceNumber",
          "status"
        ],
        "type": "object",
        "properties": {
          "invoiceNumber": {
            "maxLength": 100,
            "minLength": 1,
            "type": "string",
            "description": "Invoice number"
          },
          "invoiceSerial": {
            "maxLength": 10,
            "type": "string",
            "description": "Invoice serial number",
            "nullable": true
          },
          "currencyCode": {
            "type": "string",
            "description": "Currency in alphabetic code (for more information, please refer to: https://www.iso.org/iso-4217-currency-codes.html)."
          },
          "issueDate": {
            "type": "string",
            "description": "Invoice issue date",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/StatusInvoice"
          },
          "totalDue": {
            "type": "number",
            "description": "Total amount due",
            "format": "double",
            "nullable": true
          },
          "grossServiceAmount": {
            "type": "number",
            "description": "Gross value of the service",
            "format": "double"
          },
          "withholding": {
            "type": "number",
            "description": "Withholding tax amount",
            "format": "double",
            "nullable": true
          },
          "category": {
            "maxLength": 100,
            "minLength": 1,
            "type": "string",
            "description": "Invoice category"
          },
          "hasElectronicInvoice": {
            "type": "boolean",
            "description": "Has Electronic Invoice",
            "nullable": true
          },
          "buyerDocument": {
            "$ref": "#/components/schemas/Document"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceItemDto"
            },
            "description": "List with the invoice items"
          },
          "businessOrganizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessOrganizationsDto"
            },
            "description": "Business Organizations is a list consisting of the Company Code, Delivery Center/Location Code and their descriptions."
          },
          "attributes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AttributeDto"
            },
            "description": "List with the attributes of the ordered items, consisting of the name, value, and description fields."
          },
          "supplierId": {
            "type": "integer",
            "description": "A unique identifier or alias for the Supplier.",
            "format": "int32"
          },
          "clientSupplierCode": {
            "type": "string",
            "description": "A unique identifier or alias for the Client Supplier.",
            "nullable": true
          },
          "clientSupplierBorgCode": {
            "type": "string",
            "description": "A identifier or alias for the Client Supplier Borg.",
            "nullable": true
          },
          "integrationTag": {
            "maxLength": 30,
            "minLength": 1,
            "type": "string",
            "description": "Identification (Login) of the ME user used in the integration."
          }
        },
        "additionalProperties": false,
        "description": "Invoice Request Command"
      },
      "CreateBuyerResponse": {
        "type": "object",
        "properties": {
          "correlationId": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CreateSupplierCommand": {
        "required": [
          "invoiceNumber",
          "items",
          "status"
        ],
        "type": "object",
        "properties": {
          "invoiceNumber": {
            "maxLength": 100,
            "minLength": 1,
            "type": "string",
            "description": "Invoice number"
          },
          "invoiceSerial": {
            "maxLength": 10,
            "type": "string",
            "description": "Invoice serial number",
            "nullable": true
          },
          "currencyCode": {
            "type": "string",
            "description": "Currency in alphabetic code (for more information, please refer to: https://www.iso.org/iso-4217-currency-codes.html)."
          },
          "issueDate": {
            "type": "string",
            "description": "Invoice issue date",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/StatusInvoice"
          },
          "totalDue": {
            "type": "number",
            "description": "Total amount due",
            "format": "double",
            "nullable": true
          },
          "grossServiceAmount": {
            "type": "number",
            "description": "Gross value of the service",
            "format": "double"
          },
          "withholding": {
            "type": "number",
            "description": "Withholding tax amount",
            "format": "double",
            "nullable": true
          },
          "category": {
            "maxLength": 100,
            "type": "string",
            "description": "Invoice category",
            "nullable": true
          },
          "hasElectronicInvoice": {
            "type": "boolean",
            "description": "Has Electronic Invoice",
            "nullable": true
          },
          "buyerDocument": {
            "$ref": "#/components/schemas/Document"
          },
          "items": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceItemDto"
            },
            "description": "List with the invoice items"
          },
          "businessOrganizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessOrganizationsDto"
            },
            "description": "Business Organizations is a list consisting of the Company Code, Delivery Center/Location Code and their descriptions."
          },
          "attributes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AttributeDto"
            },
            "description": "List with the attributes of the ordered items, consisting of the name, value, and description fields."
          }
        },
        "additionalProperties": false
      },
      "CreateSupplierResponse": {
        "type": "object",
        "properties": {
          "correlationId": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "DeleteAttachmentDocumentResponse": {
        "type": "object",
        "properties": {
          "correlationId": {
            "type": "string",
            "description": ""
          }
        },
        "additionalProperties": false,
        "description": "It is a response to deleting an attachment document."
      },
      "Document": {
        "type": "object",
        "properties": {
          "number": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetAttachmentsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetAttachmentsResponseData"
            }
          },
          "hits": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "next": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetAttachmentsResponse2": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetAttachmentsResponseData2"
            }
          },
          "hits": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "next": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetAttachmentsResponseData": {
        "type": "object",
        "properties": {
          "attachmentId": {
            "type": "integer",
            "description": "ME attachment id",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "GetAttachmentsResponseData2": {
        "type": "object",
        "properties": {
          "attachmentId": {
            "type": "integer",
            "description": "ME attachment id",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "GetAttributesItemsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetAttributesItemsResponseData"
            }
          },
          "hits": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "next": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetAttributesItemsResponseData": {
        "type": "object",
        "properties": {
          "invoiceItemId": {
            "type": "integer",
            "description": "Invoice item Id",
            "format": "int32",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "Name"
          },
          "value": {
            "type": "string",
            "description": "Value",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Description",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetAttributesResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetAttributesResponseData"
            }
          },
          "hits": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "next": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetAttributesResponseData": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name"
          },
          "value": {
            "type": "string",
            "description": "Value",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Description",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetBusinessOrganizationsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetBusinessOrganizationsResponseData"
            }
          },
          "hits": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "next": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetBusinessOrganizationsResponseData": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Company code",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Company description",
            "nullable": true
          },
          "virtualEntityField": {
            "type": "string",
            "description": "Delivery center/location code",
            "nullable": true
          },
          "virtualEntityDescription": {
            "type": "string",
            "description": "Delivery center/location description",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetByIdResponse": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "integer",
            "description": "A unique identifier or alias for the invoice identifier.",
            "format": "int32"
          },
          "tenantId": {
            "type": "integer",
            "description": "A unique identifier or alias for the requesting tenant.",
            "format": "int32"
          },
          "supplierId": {
            "type": "integer",
            "description": "A unique identifier or alias for the Supplier.",
            "format": "int32"
          },
          "serialNumber": {
            "type": "string",
            "description": "Invoice Serial Number",
            "nullable": true
          },
          "issueDate": {
            "type": "string",
            "description": "Invoice issue date",
            "format": "date-time",
            "nullable": true
          },
          "totalDue": {
            "type": "number",
            "description": "Total amount due informed on the invoice (calculated by the total price of the items)",
            "format": "double",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "description": "Currency in alphabetic code (for more information, please refer to: https://www.iso.org/iso-4217-currency-codes.html).",
            "nullable": true
          },
          "creationDate": {
            "type": "string",
            "description": "Invoice creation date",
            "format": "date-time",
            "nullable": true
          },
          "updateDate": {
            "type": "string",
            "description": "Invoice update date",
            "format": "date-time",
            "nullable": true
          },
          "isIntegrated": {
            "type": "boolean",
            "description": "Indicates if the invoice is integrated"
          },
          "integrationDate": {
            "type": "string",
            "description": "It provides the integration date",
            "format": "date-time",
            "nullable": true
          },
          "netPrice": {
            "type": "number",
            "description": "Invoice net price",
            "format": "double",
            "nullable": true
          },
          "orderId": {
            "type": "integer",
            "description": "ID of the ME purchase order",
            "format": "int32",
            "deprecated": true
          },
          "clientOrderId": {
            "type": "string",
            "description": "The order ID in the Client's ERP",
            "nullable": true,
            "deprecated": true
          },
          "invoiceNumber": {
            "type": "string",
            "description": "Invoice number",
            "nullable": true
          },
          "invoiceSerial": {
            "type": "string",
            "description": "Invoice serial number",
            "nullable": true
          },
          "dateTime": {
            "type": "string",
            "description": "Invoice issue date and time",
            "format": "date-time",
            "nullable": true
          },
          "freightValue": {
            "type": "number",
            "description": "Freight value informed on the invoice",
            "format": "double",
            "nullable": true
          },
          "invoiceCharging": {
            "type": "number",
            "description": "Amount of invoice charges",
            "format": "double",
            "nullable": true
          },
          "invoiceDiscounts": {
            "type": "number",
            "description": "Amount of invoice discounts",
            "format": "double",
            "nullable": true
          },
          "userId": {
            "type": "integer",
            "description": "ID of the user who created the invoice",
            "format": "int32",
            "nullable": true
          },
          "userLogin": {
            "type": "string",
            "description": "Login of the user who created the invoice",
            "nullable": true
          },
          "deliveryPlace": {
            "type": "string",
            "description": "Delivery Place",
            "nullable": true,
            "deprecated": true
          },
          "paymentCondition": {
            "type": "string",
            "description": "Payment condition (provided in the order)",
            "nullable": true,
            "deprecated": true
          },
          "itemQuantity": {
            "type": "integer",
            "description": "Quantity of invoice items",
            "format": "int32",
            "nullable": true,
            "deprecated": true
          },
          "clientSupplierId": {
            "type": "string",
            "description": "Supplier identifier in the ERP",
            "nullable": true
          },
          "requester": {
            "type": "string",
            "description": "Requester of the invoice",
            "nullable": true,
            "deprecated": true
          },
          "requesterPhoneNumber": {
            "type": "string",
            "description": "Requester phone number",
            "nullable": true,
            "deprecated": true
          },
          "grossServiceAmount": {
            "type": "number",
            "description": "Gross value of provided services",
            "format": "double",
            "nullable": true,
            "deprecated": true
          },
          "invoiceCode": {
            "type": "string",
            "description": "Invoice code",
            "nullable": true,
            "deprecated": true
          },
          "exchangeRate": {
            "type": "number",
            "description": "Value of the foreign currency exchange rate.",
            "format": "double",
            "nullable": true
          },
          "hasElectronicInvoice": {
            "type": "boolean",
            "description": "Has Eletronic Invoice"
          },
          "withholding": {
            "type": "number",
            "description": "Withholding tax amount",
            "format": "double",
            "nullable": true
          },
          "roundedTotalDue": {
            "type": "number",
            "description": "Rounded Total Due",
            "format": "double",
            "nullable": true
          },
          "accessKey": {
            "type": "string",
            "description": "Access Key"
          },
          "buyerDocument": {
            "$ref": "#/components/schemas/Document"
          },
          "supplierDocument": {
            "$ref": "#/components/schemas/Document"
          },
          "deliveryLocationDocument": {
            "$ref": "#/components/schemas/Document"
          },
          "dueDate": {
            "type": "string",
            "description": "Invoice Due Date",
            "format": "date-time",
            "nullable": true
          },
          "category": {
            "type": "string",
            "description": "Invoice category description",
            "nullable": true
          },
          "orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceOrderItem"
            },
            "description": "List of orders related to the invoice, consisting of the fields `OrderId`, `ClientOrderId`, `ClientSupplierId`, among others."
          },
          "recipient": {
            "$ref": "#/components/schemas/Location"
          },
          "businessOrganizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessOrganization"
            },
            "description": "Business Organizations is a list consisting of the Company Code, Delivery Center/Location Code and their descriptions."
          }
        },
        "additionalProperties": false
      },
      "GetInvoiceAttachmentMetadataResponse": {
        "type": "object",
        "properties": {
          "contentLength": {
            "type": "integer",
            "format": "int64"
          },
          "fileName": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "hash": {
            "type": "string"
          },
          "base64File": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "GetItemsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetItemsResponseData"
            }
          },
          "hits": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "next": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetItemsResponseData": {
        "type": "object",
        "properties": {
          "invoiceItemId": {
            "type": "integer",
            "description": "Invoice item Id",
            "format": "int32"
          },
          "orderId": {
            "type": "integer",
            "description": "Order ID in ME separated by \";\"",
            "format": "int32"
          },
          "clientReferenceProductId": {
            "type": "string",
            "description": "The Product Code",
            "nullable": true
          },
          "clientProductId": {
            "type": "string",
            "description": "The Invoice Item  Code",
            "nullable": true
          },
          "orderItem": {
            "type": "integer",
            "description": "The Order Item number",
            "format": "int32"
          },
          "quantity": {
            "type": "number",
            "description": "Item quantity",
            "format": "double",
            "nullable": true
          },
          "isClosed": {
            "type": "boolean",
            "description": "It indicates if it is a final delivery (True/False):\r\n- If the item is pending delivery = \"False\".\r\n- If the item has been fully received = \"True\"."
          },
          "unit": {
            "type": "string",
            "description": "The Unit",
            "nullable": true
          },
          "measurementUnit": {
            "type": "string",
            "description": "Product unit of measurement",
            "nullable": true
          },
          "price": {
            "type": "number",
            "description": "The price of the item without taxes.",
            "format": "double",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Product Description",
            "nullable": true
          },
          "itemMRP": {
            "type": "integer",
            "description": "The Item MRP",
            "format": "int32",
            "nullable": true
          },
          "immobilized": {
            "type": "integer",
            "description": "It defines if the item is a fixed asset.",
            "format": "int32",
            "nullable": true
          },
          "isCriticalItem": {
            "type": "boolean",
            "description": "It defines if the item is critical.",
            "nullable": true
          },
          "materialOrigin": {
            "type": "string",
            "description": "MaterialOrigin",
            "nullable": true
          },
          "clientGroupId": {
            "type": "string",
            "description": "ProductGroup",
            "nullable": true
          },
          "applicationType": {
            "type": "string",
            "description": "ApplicationType",
            "nullable": true
          },
          "isTerm": {
            "type": "boolean",
            "description": "IsTerm",
            "nullable": true
          },
          "isService": {
            "type": "boolean",
            "description": "Flag to identify if the item is a service (false by default).",
            "nullable": true
          },
          "ivaCode": {
            "type": "string",
            "description": "IVACode",
            "nullable": true
          },
          "totalNetPrice": {
            "type": "number",
            "description": "TotalNetPrice",
            "format": "double",
            "nullable": true
          },
          "clientOrderId": {
            "type": "string",
            "description": "Client Order Id",
            "nullable": true
          },
          "taxedPrice": {
            "type": "number",
            "description": "Taxed Price -> Price with taxes",
            "format": "double",
            "nullable": true
          },
          "totalTaxedPrice": {
            "type": "number",
            "description": "Total Taxed Price -> Taxed Price * Quantity",
            "format": "double",
            "nullable": true
          },
          "productDescription": {
            "type": "string",
            "description": "Product Description",
            "nullable": true
          },
          "productGroup": {
            "type": "string",
            "description": "Product Group",
            "nullable": true
          },
          "totalNetPriceERP": {
            "type": "number",
            "description": "Total Net Price ERP -> (NetPriceERP * Quantity) with rounded value",
            "format": "double",
            "nullable": true
          },
          "taxInformation": {
            "$ref": "#/components/schemas/TaxInformation"
          }
        },
        "additionalProperties": false
      },
      "InvoiceCreateTax": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "aliquot": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "taxApplication": {
            "type": "string",
            "nullable": true
          },
          "reducedTaxRate": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "InvoiceItemDto": {
        "required": [
          "invoiceItemId",
          "orderItemId",
          "quantity"
        ],
        "type": "object",
        "properties": {
          "invoiceItemId": {
            "type": "integer",
            "description": "Invoice item Id",
            "format": "int32"
          },
          "productId": {
            "type": "integer",
            "description": "ME product Id",
            "format": "int32"
          },
          "orderId": {
            "type": "integer",
            "description": "ME Purchase Order ID",
            "format": "int32"
          },
          "clientOrderId": {
            "type": "string",
            "description": "The Order ID in the Client's ERP",
            "nullable": true
          },
          "orderItemId": {
            "type": "integer",
            "description": "Item number in the order",
            "format": "int32"
          },
          "quantity": {
            "type": "number",
            "description": "Item quantity",
            "format": "double"
          },
          "price": {
            "type": "number",
            "description": "The price of the item without taxes.",
            "format": "double",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Description"
          },
          "ivaCode": {
            "type": "string",
            "description": "VAT code",
            "nullable": true
          },
          "totalNetPrice": {
            "type": "number",
            "description": "Total net price",
            "format": "double",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/StatusInvoice"
          },
          "attributes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AttributeDto"
            },
            "description": "List with the attributes of the ordered items, consisting of the name, value, and description fields."
          },
          "taxInformation": {
            "$ref": "#/components/schemas/TaxInformation"
          }
        },
        "additionalProperties": false
      },
      "InvoiceOrderItem": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "integer",
            "format": "int32"
          },
          "clientOrderId": {
            "type": "string",
            "nullable": true
          },
          "paymentCondition": {
            "type": "string",
            "nullable": true
          },
          "clientSupplierId": {
            "type": "string",
            "nullable": true
          },
          "requester": {
            "type": "string",
            "nullable": true
          },
          "requesterPhoneNumber": {
            "type": "string",
            "nullable": true
          },
          "clientDeliveryPlaceId": {
            "type": "string",
            "nullable": true
          },
          "itemQuantity": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "grossServiceAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "deliveryLocationDocument": {
            "$ref": "#/components/schemas/Document"
          }
        },
        "additionalProperties": false
      },
      "Location": {
        "type": "object",
        "properties": {
          "locationCode": {
            "type": "string"
          },
          "locationDocument": {
            "$ref": "#/components/schemas/Document"
          }
        },
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": {}
      },
      "StatusInvoice": {
        "enum": [
          "InApproval",
          "Returned",
          "Canceled",
          "Accepted",
          "Lauched",
          "Integrated"
        ],
        "type": "string"
      },
      "TaxInformation": {
        "type": "object",
        "properties": {
          "taxableAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceCreateTax"
            }
          }
        },
        "additionalProperties": false
      },
      "UpdateStatusCommand": {
        "required": [
          "clientInvoiceId",
          "clientSupplierId",
          "status"
        ],
        "type": "object",
        "properties": {
          "clientOrderId": {
            "maxLength": 20,
            "type": "string",
            "description": "Order ID in the client's ERP"
          },
          "clientInvoiceId": {
            "maxLength": 100,
            "minLength": 1,
            "type": "string",
            "description": "Invoice number"
          },
          "status": {
            "$ref": "#/components/schemas/StatusInvoice"
          },
          "clientSupplierId": {
            "maxLength": 20,
            "minLength": 1,
            "type": "string",
            "description": "Supplier code in the client's ERP"
          },
          "note": {
            "maxLength": 8000,
            "type": "string",
            "description": "Invoice notes"
          },
          "invoiceSerialNumber": {
            "maxLength": 10,
            "type": "string",
            "description": "Invoice series",
            "nullable": true
          },
          "expectedPaymentDate": {
            "type": "string",
            "description": "Estimated payment date",
            "format": "date-time",
            "nullable": true
          },
          "paymentStatus": {
            "maxLength": 40,
            "type": "string",
            "description": "Payment status"
          },
          "paymentDate": {
            "type": "string",
            "description": "Date the payment was made",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateStatusResponse": {
        "type": "object",
        "properties": {
          "correlationId": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "apiKey",
        "description": "Please enter the word 'Bearer' followed by a space and then your JWT.",
        "name": "Authorization",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "Bearer": []
    }
  ]
}