Skip to content

Documentation for invoices

Description

This endpoint allows you to retrieve a list of all the invoices stored in the system. It is useful for managing and querying invoices in your application.

Fields

FieldDescriptionData Type
idUnique identifier for the objectString
invoiceNumberInvoice numberString
issueDateIssue date of the invoiceString
societyIdIdentifier of the societyString
sellerIdIdentifier of the sellerString
buyerIdIdentifier of the buyerString
typeIdType of the invoiceString
classTypeIdClass type of the invoiceString
documentTypeIdDocument type of the invoiceString
totalAmountTotal amount of the invoiceNumber
statusStatus of the invoiceString
descriptionDescription of the invoiceString
taxableBaseTaxable base amountNumber
taxAmountTax amountNumber
buyerAddressAddress of the buyerString
sellerAddressAddress of the sellerString
withholdingIdWithholding identifierNumber
withholdingAmountAmount of withholdingNumber
paymentMethodIdPayment method identifierString
expirationDateExpiration date of the invoiceString
originalInvoiceIdOriginal invoice identifierString
documentFileIdDocument file identifierString
domainIdDomain identifierString
externalIdExternal identifierString
campaignIdCampaign identifierNumber
extraDataAdditional dataObject
createdAtCreation date of the recordString
updatedAtLast update date of the recordString
deletedAtDeletion date of the record, if applicableString
enterpriceRepresents business entitiesEnterprice
sellerInformation about the selling partySeller
buyerInformation about the purchasing partyBuyer
typeSpecifies the category or classificationType
classTypeDefines the class or subset within a typeClassType
documentTypeIndicates the kind of document involvedDocumentType
itemsArray itemsArray[Items]
withholdingIt refers to a portion of income that is held back by an entityWithholding
documentFiledocument link to invoiceDocumentLink
labelsArray labelsArray[Label]

Enterprice

FieldDescriptionData Type
nifUnique identifier for the entityString
businessNameName of the businessString
societyRoleRole of the societyBoolean
statusValidation statusString
validationDateDate of validationString

Seller

FieldDescriptionData Type
nifUnique identifier for the entityString
businessNameName of the businessString
societyRoleRole of the societyBoolean
statusValidation statusString
validationDateDate of validationString

Buyer

FieldDescriptionData Type
nifUnique identifier for the entityString
businessNameName of the businessString
societyRoleRole of the societyBoolean
statusValidation statusString
validationDateDate of validationString

Type

FieldDescriptionData Type
idUnique identifier for the typeString
nameName of the typeString
createdAtCreation date of the typeString
updatedAtLast update date of the typeString
deletedAtDeletion date of the type (if applicable)String

ClassType

FieldDescriptionData Type
idUnique identifier for the class typeString
nameName of the class typeString
createdAtCreation date of the class typeString
updatedAtLast update date of the class typeString
deletedAtDeletion date of the class type (if applicable)String

DocumentType

FieldDescriptionData Type
idUnique identifier for the document typeString
nameName of the document typeString
createdAtCreation date of the document typeString
updatedAtLast update date of the document typeString
deletedAtDeletion date of the document type (if applicable)String

Items

FieldDescriptionData Type
idUnique identifier for the recordString
invoiceIdUnique identifier for the associated invoiceString
articleIdUnique identifier for the articleString
quantityQuantity of the articleInteger
unitPriceUnit price of the articleFloat
unitPriceOriginalOriginal unit price of the articleFloat
totalItemCostTotal cost of the articleFloat
totalItemAmountTotal amount of the articleFloat
descriptionDescription of the article (nullable)String
taxRateApplied tax rateFloat
taxRateAmountAmount of tax appliedFloat
withholdingRateApplied withholding rateFloat
withholdingAmountAmount withheldFloat
articleNameName of the articleString
articleCodeCode of the article (nullable)String
createdAtCreation date and time of the recordString
updatedAtLast update date and time of the recordString
deletedAtDeletion date and time of the record (if applicable)String
articleAdditional information about the article (nullable)String

Withholding

FieldDescriptionData Type
idUnique identifier for the recordInteger
nameName of the recordString
reasonReason for the recordString
valueValue associated with the recordInteger
scopeScope of the recordString
createdAtCreation date and time of the recordString
updatedAtLast update date and time of the recordString
deletedAtDeletion date and time of the record (if applicable)String

DocumentFile

FieldDescriptionData Type
idUnique identifier for the recordString
societyIdIdentifier for the societyString
documentNameName of the documentString
documentFileLinkURL link to the document fileString
documentFileTypeIdIdentifier for the document file typeString
statusProcessing status of the documentString
commentsAdditional comments (nullable)String
sourceSource of the documentString
createdAtCreation date and time of the recordString
updatedAtLast update date and time of the recordString
deletedAtDeletion date and time of the record (if applicable)String
documentFileTypeDetails of the document file typeObject
├── idUnique identifier for the document typeString
├── nameName of the document typeString
├── createdAtCreation date and time of the document typeString
├── updatedAtLast update date and time of the document typeString
└── deletedAtDeletion date and time of the document type (if applicable)String

Labels

FieldDescriptionData Type
idUnique identifier for the recordString
invoiceIdUnique identifier for the associated invoiceString
itemIdUnique identifier for the item (nullable)String
productAndServiceIdUnique identifier for the product or service (nullable)String
amountAmount related to the recordString
domainIdIdentifier for the domainString
analyticCodeIdUnique identifier for the analytic codeString
cropIdUnique identifier for the cropInteger
createdAtCreation date and time of the recordString
updatedAtLast update date and time of the recordString
deletedAtDeletion date and time of the record (if applicable)String
cropDetails of the cropObject
├── idUnique identifier for the cropInteger
├── nameName of the cropString
├── domainIdIdentifier for the domainString
├── createdAtCreation date and time of the cropString
├── updatedAtLast update date and time of the cropString
└── deletedAtDeletion date and time of the crop (if applicable)String
analyticCodeDetails of the analytic codeObject
├── idUnique identifier for the analytic codeString
├── codeCode for the analytic categoryString
├── nameName of the analytic categoryString
├── enterpriseTypeIdIdentifier for the type of enterpriseInteger
├── domainIdIdentifier for the domainString
├── createdAtCreation date and time of the analytic codeString
├── updatedAtLast update date and time of the analytic codeString
└── deletedAtDeletion date and time of the analytic code (if applicable)String

List Invoices

http
GET /invoices

Response

json
{
  "data": [
    {
      "id": "2d89643d-f88f-45ca-962f-6fbb68158716",
      "invoiceNumber": "JFSXRG8W-0032154309",
      "issueDate": "2024-12-17T00:00:00.000Z",
      "societyId": "508074363",
      "sellerId": "B12345677",
      "buyerId": "508074363",
      "typeId": "REC",
      "classTypeId": "OO",
      "documentTypeId": "FC",
      "totalAmount": 9832.5,
      "status": "completed",
      "description": null,
      "taxableBase": 9832.5,
      "taxAmount": 0,
      "buyerAddress": "\n",
      "sellerAddress": null,
      "withholdingId": 1,
      "withholdingAmount": 0,
      "paymentMethodId": null,
      "expirationDate": null,
      "originalInvoiceId": null,
      "documentFileId": "43ded804-84d5-4cc5-9d12-856ad612b4bb",
      "domainId": "AGG",
      "externalId": null,
      "campaignId": 6,
      "extraData": {},
      "createdAt": "2024-12-17T16:08:38.671Z",
      "updatedAt": "2024-12-18T21:51:08.556Z",
      "deletedAt": null,
      "enterprice": {
        "nif": "508074363",
        "businessName": "AGGRARIA LAGAR LDA",
        "societyRole": true,
        "status": "validated",
        "validationDate": "2024-10-25"
      },
      "seller": {
        "nif": "B12345677",
        "businessName": "2023 ABM OBRAS",
        "societyRole": true,
        "status": "validated",
        "validationDate": "2024-10-03"
      },
      "buyer": {
        "nif": "508074363",
        "businessName": "AGGRARIA LAGAR LDA",
        "societyRole": true,
        "status": "validated",
        "validationDate": "2024-10-25"
      },
      "type": {
        "id": "REC",
        "name": "RECIBIDA",
        "createdAt": "2024-07-08T14:57:42.177Z",
        "updatedAt": "2024-07-08T14:57:42.177Z",
        "deletedAt": null
      },
      "classType": {
        "id": "OO",
        "name": "Original",
        "createdAt": "2024-07-08T14:59:24.493Z",
        "updatedAt": "2024-07-08T14:59:24.493Z",
        "deletedAt": null
      },
      "documentType": {
        "id": "FC",
        "name": "Factura Completa",
        "createdAt": "2024-07-08T15:01:23.173Z",
        "updatedAt": "2024-07-08T15:01:23.173Z",
        "deletedAt": null
      },
      "items": [
        {
          "id": "6c518201-f928-4a42-a785-415470e16b51",
          "invoiceId": "2d89643d-f88f-45ca-962f-6fbb68158716",
          "articleId": "75070a18-6a4b-4bbf-a85e-963ad74ea4ac",
          "quantity": 1,
          "unitPrice": 9832.5,
          "unitPriceOriginal": 9832.5,
          "totalItemCost": 9832.5,
          "totalItemAmount": 9832.5,
          "description": null,
          "taxRate": 0,
          "taxRateAmount": 0,
          "withholdingRate": 0,
          "withholdingAmount": 0,
          "articleName": "IVA 23%",
          "articleCode": null,
          "createdAt": "2024-12-17T16:08:38.679Z",
          "updatedAt": "2024-12-17T16:08:38.679Z",
          "deletedAt": null,
          "article": null
        }
      ],
      "withholding": {
        "id": 1,
        "name": "0%",
        "reason": "Sin retenciones",
        "value": 0,
        "scope": "all",
        "createdAt": "2024-08-21T13:41:33.881Z",
        "updatedAt": "2024-08-21T13:41:33.881Z",
        "deletedAt": null
      },
      "paymentMethod": null,
      "documentFile": {
        "id": "43ded804-84d5-4cc5-9d12-856ad612b4bb",
        "societyId": "508074363",
        "documentName": "2023-08-16.14.35.41-GMTDOC069.pdf",
        "documentFileLink": "https://aarpia-document-files-dev.s3.eu-west-1.amazonaws.com/CBI/508074363/43ded804-84d5-4cc5-9d12-856ad612b4bb.pdf",
        "documentFileTypeId": "N3.16",
        "status": "processed",
        "comments": null,
        "source": "agg",
        "createdAt": "2024-12-03T11:29:06.385Z",
        "updatedAt": "2024-12-17T16:08:38.865Z",
        "deletedAt": null,
        "documentFileType": {
          "id": "N3.16",
          "name": "FACTURA RECIBIDA ORDINARIA",
          "createdAt": "2024-10-09T14:53:14.876Z",
          "updatedAt": "2024-10-09T14:53:14.876Z",
          "deletedAt": null
        }
      },
      "accountingEntries": [],
      "labels": [
        {
          "id": "f0e18f8a-9336-4428-8c5c-9cb6eb2fb6be",
          "invoiceId": "2d89643d-f88f-45ca-962f-6fbb68158716",
          "itemId": null,
          "productAndServiceId": null,
          "amount": "0.1",
          "domainId": "AGG",
          "analyticCodeId": "a2a1b4e1-a965-4175-ae90-cd3e070e9810",
          "cropId": 6,
          "createdAt": "2024-12-18T21:51:08.186Z",
          "updatedAt": "2024-12-18T21:51:08.186Z",
          "crop": {
            "id": 6,
            "name": "MAIZ",
            "domainId": "AGG",
            "createdAt": "2024-12-13T18:52:28.171Z",
            "updatedAt": "2024-12-13T18:52:28.171Z",
            "deletedAt": null
          },
          "analyticCode": {
            "id": "a2a1b4e1-a965-4175-ae90-cd3e070e9810",
            "code": "04.03",
            "name": "MAQUINAS",
            "enterpriseTypeId": 1,
            "domainId": "AGG",
            "createdAt": "2024-12-13T19:07:35.898Z",
            "updatedAt": "2024-12-13T19:07:35.898Z",
            "deletedAt": null
          }
        },
        {
          "id": "e8064cea-1291-4423-b628-169c8bfe02c0",
          "invoiceId": "2d89643d-f88f-45ca-962f-6fbb68158716",
          "itemId": null,
          "productAndServiceId": null,
          "amount": "0.2",
          "domainId": "AGG",
          "analyticCodeId": "eed8269f-9f40-4f5b-a64b-026963f3859d",
          "cropId": 5,
          "createdAt": "2024-12-18T21:51:08.186Z",
          "updatedAt": "2024-12-18T21:51:08.186Z",
          "crop": {
            "id": 5,
            "name": "ALMENDRO",
            "domainId": "AGG",
            "createdAt": "2024-12-13T18:52:28.122Z",
            "updatedAt": "2024-12-13T18:52:28.122Z",
            "deletedAt": null
          },
          "analyticCode": {
            "id": "eed8269f-9f40-4f5b-a64b-026963f3859d",
            "code": "02.04",
            "name": "INSECTICIDA",
            "enterpriseTypeId": 1,
            "domainId": "AGG",
            "createdAt": "2024-12-13T19:07:35.898Z",
            "updatedAt": "2024-12-13T19:07:35.898Z",
            "deletedAt": null
          }
        }
      ]
    }
  ],
  "meta": {
    "itemsPerPage": 20,
    "totalItems": 96,
    "currentPage": 1,
    "totalPages": 5,
    "sortBy": [
      [
        "createdAt",
        "DESC"
      ]
    ]
  },
  "links": {
    "current": "http://develop.aarpia.digital/invoicing/v1.0/invoice?page=1&limit=20&sortBy=createdAt:DESC",
    "next": "http://develop.aarpia.digital/invoicing/v1.0/invoice?page=2&limit=20&sortBy=createdAt:DESC",
    "last": "http://develop.aarpia.digital/invoicing/v1.0/invoice?page=5&limit=20&sortBy=createdAt:DESC"
  }
}

Retrieve Invoices

http
GET /invoices/<id>

Response

json
{
      "id": "2d89643d-f88f-45ca-962f-6fbb68158716",
      "invoiceNumber": "JFSXRG8W-0032154309",
      "issueDate": "2024-12-17T00:00:00.000Z",
      "societyId": "508074363",
      "sellerId": "B12345677",
      "buyerId": "508074363",
      "typeId": "REC",
      "classTypeId": "OO",
      "documentTypeId": "FC",
      "totalAmount": 9832.5,
      "status": "completed",
      "description": null,
      "taxableBase": 9832.5,
      "taxAmount": 0,
      "buyerAddress": "\n",
      "sellerAddress": null,
      "withholdingId": 1,
      "withholdingAmount": 0,
      "paymentMethodId": null,
      "expirationDate": null,
      "originalInvoiceId": null,
      "documentFileId": "43ded804-84d5-4cc5-9d12-856ad612b4bb",
      "domainId": "AGG",
      "externalId": null,
      "campaignId": 6,
      "extraData": {},
      "createdAt": "2024-12-17T16:08:38.671Z",
      "updatedAt": "2024-12-18T21:51:08.556Z",
      "deletedAt": null,
      "enterprice": {
        "nif": "508074363",
        "businessName": "AGGRARIA LAGAR LDA",
        "societyRole": true,
        "status": "validated",
        "validationDate": "2024-10-25"
      },
      "seller": {
        "nif": "B12345677",
        "businessName": "2023 ABM OBRAS",
        "societyRole": true,
        "status": "validated",
        "validationDate": "2024-10-03"
      },
      "buyer": {
        "nif": "508074363",
        "businessName": "AGGRARIA LAGAR LDA",
        "societyRole": true,
        "status": "validated",
        "validationDate": "2024-10-25"
      },
      "type": {
        "id": "REC",
        "name": "RECIBIDA",
        "createdAt": "2024-07-08T14:57:42.177Z",
        "updatedAt": "2024-07-08T14:57:42.177Z",
        "deletedAt": null
      },
      "classType": {
        "id": "OO",
        "name": "Original",
        "createdAt": "2024-07-08T14:59:24.493Z",
        "updatedAt": "2024-07-08T14:59:24.493Z",
        "deletedAt": null
      },
      "documentType": {
        "id": "FC",
        "name": "Factura Completa",
        "createdAt": "2024-07-08T15:01:23.173Z",
        "updatedAt": "2024-07-08T15:01:23.173Z",
        "deletedAt": null
      },
      "items": [
        {
          "id": "6c518201-f928-4a42-a785-415470e16b51",
          "invoiceId": "2d89643d-f88f-45ca-962f-6fbb68158716",
          "articleId": "75070a18-6a4b-4bbf-a85e-963ad74ea4ac",
          "quantity": 1,
          "unitPrice": 9832.5,
          "unitPriceOriginal": 9832.5,
          "totalItemCost": 9832.5,
          "totalItemAmount": 9832.5,
          "description": null,
          "taxRate": 0,
          "taxRateAmount": 0,
          "withholdingRate": 0,
          "withholdingAmount": 0,
          "articleName": "IVA 23%",
          "articleCode": null,
          "createdAt": "2024-12-17T16:08:38.679Z",
          "updatedAt": "2024-12-17T16:08:38.679Z",
          "deletedAt": null,
          "article": null
        }
      ],
      "withholding": {
        "id": 1,
        "name": "0%",
        "reason": "Sin retenciones",
        "value": 0,
        "scope": "all",
        "createdAt": "2024-08-21T13:41:33.881Z",
        "updatedAt": "2024-08-21T13:41:33.881Z",
        "deletedAt": null
      },
      "paymentMethod": null,
      "documentFile": {
        "id": "43ded804-84d5-4cc5-9d12-856ad612b4bb",
        "societyId": "508074363",
        "documentName": "2023-08-16.14.35.41-GMTDOC069.pdf",
        "documentFileLink": "https://aarpia-document-files-dev.s3.eu-west-1.amazonaws.com/CBI/508074363/43ded804-84d5-4cc5-9d12-856ad612b4bb.pdf",
        "documentFileTypeId": "N3.16",
        "status": "processed",
        "comments": null,
        "source": "agg",
        "createdAt": "2024-12-03T11:29:06.385Z",
        "updatedAt": "2024-12-17T16:08:38.865Z",
        "deletedAt": null,
        "documentFileType": {
          "id": "N3.16",
          "name": "FACTURA RECIBIDA ORDINARIA",
          "createdAt": "2024-10-09T14:53:14.876Z",
          "updatedAt": "2024-10-09T14:53:14.876Z",
          "deletedAt": null
        }
      },
      "accountingEntries": [],
      "labels": [
        {
          "id": "f0e18f8a-9336-4428-8c5c-9cb6eb2fb6be",
          "invoiceId": "2d89643d-f88f-45ca-962f-6fbb68158716",
          "itemId": null,
          "productAndServiceId": null,
          "amount": "0.1",
          "domainId": "AGG",
          "analyticCodeId": "a2a1b4e1-a965-4175-ae90-cd3e070e9810",
          "cropId": 6,
          "createdAt": "2024-12-18T21:51:08.186Z",
          "updatedAt": "2024-12-18T21:51:08.186Z",
          "crop": {
            "id": 6,
            "name": "MAIZ",
            "domainId": "AGG",
            "createdAt": "2024-12-13T18:52:28.171Z",
            "updatedAt": "2024-12-13T18:52:28.171Z",
            "deletedAt": null
          },
          "analyticCode": {
            "id": "a2a1b4e1-a965-4175-ae90-cd3e070e9810",
            "code": "04.03",
            "name": "MAQUINAS",
            "enterpriseTypeId": 1,
            "domainId": "AGG",
            "createdAt": "2024-12-13T19:07:35.898Z",
            "updatedAt": "2024-12-13T19:07:35.898Z",
            "deletedAt": null
          }
        },
        {
          "id": "e8064cea-1291-4423-b628-169c8bfe02c0",
          "invoiceId": "2d89643d-f88f-45ca-962f-6fbb68158716",
          "itemId": null,
          "productAndServiceId": null,
          "amount": "0.2",
          "domainId": "AGG",
          "analyticCodeId": "eed8269f-9f40-4f5b-a64b-026963f3859d",
          "cropId": 5,
          "createdAt": "2024-12-18T21:51:08.186Z",
          "updatedAt": "2024-12-18T21:51:08.186Z",
          "crop": {
            "id": 5,
            "name": "ALMENDRO",
            "domainId": "AGG",
            "createdAt": "2024-12-13T18:52:28.122Z",
            "updatedAt": "2024-12-13T18:52:28.122Z",
            "deletedAt": null
          },
          "analyticCode": {
            "id": "eed8269f-9f40-4f5b-a64b-026963f3859d",
            "code": "02.04",
            "name": "INSECTICIDA",
            "enterpriseTypeId": 1,
            "domainId": "AGG",
            "createdAt": "2024-12-13T19:07:35.898Z",
            "updatedAt": "2024-12-13T19:07:35.898Z",
            "deletedAt": null
          }
        }
      ]
    }

Create Invoices

http
POST /invoices

Request body

json
{
  "sellerId": "B90355322",
  "buyerId": "A28985992",
  "societyId": "B90355322",
  "classTypeId": "OO",
  "documentTypeId": "FA",
  "description": "description",
  "buyerAddress": "buyerAddress",
  "sellerAddress": "sellerAddress",
  "comment": "test comment",
  "externalId": "externalId",
  
  "extraData": {
    "name": "extraData"
  },
  "campaignId": 1,
  "items": [
    {
      "articleId": "7b460314-2e40-4af8-a408-a0ea06e35ede",
      "quantity": 2,
      "unitPrice": 10,
      "description": "des"
    },
    {
      "articleId": "ab367fc2-51c1-4f4c-94bd-ef94872595fb",
      "quantity": 1,
      "unitPrice": 10,
      "description": "des"
    },
    {
      "articleId": "6ed84f22-fd41-4e12-9f19-e5fe8544b199",
      "quantity": 3,
      "unitPrice": 13
    }
  ]
}