> ## Documentation Index
> Fetch the complete documentation index at: https://docs.altera.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Get invoice data

> Retrieve data for a particular invoice available in the system

This endpoint may be used as a base for new invoice data that we wish to create based on a set of related invoices

If you wish to generate such object base you will need to provide both:
* `related` parameter, listing the related invoices
* `invoiceType` of the new invoice we wish to create

The return object will be a temporary invoice object you may further extend before saving it.



## OpenAPI

````yaml /openapi/openapi.json get /sales/invoice
openapi: 3.1.0
info:
  title: OpenAPI
  version: '1.0'
  summary: OpenApi
  contact:
    name: Altera Support
    url: https://altera.co
    email: wsparcie@altera.co
  description: ''
  license:
    url: https://altera.co/regulamin
    name: Terms of services for Altera.app
servers:
  - url: https://api.altera.co
    description: Production endpoint (proxied)
security:
  - Authorization: []
tags:
  - name: Configuration
  - name: Data export
  - name: Expenses
  - name: Sales
paths:
  /sales/invoice:
    parameters: []
    get:
      tags:
        - Sales
      summary: Get invoice data
      description: >-
        Retrieve data for a particular invoice available in the system


        This endpoint may be used as a base for new invoice data that we wish to
        create based on a set of related invoices


        If you wish to generate such object base you will need to provide both:

        * `related` parameter, listing the related invoices

        * `invoiceType` of the new invoice we wish to create


        The return object will be a temporary invoice object you may further
        extend before saving it.
      operationId: get-sales-invoice
      parameters:
        - schema:
            type: integer
            example: 36891
          in: query
          name: ref
          style: form
          description: InvoiceId identificator of the exact invoice we wish to retrieve
        - schema:
            type: array
            example: 124,551
          in: query
          name: related
          description: >-
            Comma delimited list of related invoices we wish to create a
            reference from
          style: pipeDelimited
        - schema:
            type: string
            enum:
              - SALES
              - CORRECTION
              - INTERIM_FINAL
            example: CORRECTION
          in: query
          name: invoiceType
          description: >-
            Invoice type for the new invoice we wish to create based on related
            invoices
      requestBody:
        content: {}
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    x-stoplight:
                      id: x9vn9vue45evr
                    default: OK
                  data:
                    type: object
                    x-stoplight:
                      id: xixugdj8mrgf2
                    properties:
                      invoice:
                        $ref: '#/components/schemas/Invoice'
                        x-stoplight:
                          id: pgphon7hux58h
                      relatedInvoices:
                        x-stoplight:
                          id: gpz22kpcomvca
                        type: array
                        items:
                          $ref: '#/components/schemas/Invoice'
                          x-stoplight:
                            id: ghiep02zumers
                      defaults:
                        type: object
                        x-stoplight:
                          id: scnla0pet85gk
              examples:
                ProForma invoice:
                  value:
                    invoice:
                      modelType: INVOICE
                      readOnly: false
                      basicInformation:
                        invoiceId: 118584
                        invoiceType: PRO_FORMA
                        invoiceFormat: PRO %N/%M/%Y
                        invoiceNumber: PRO 2/12/2022
                        year: 2022
                        month: 12
                        invoiceNumberInPeriod: 2
                        statusId: SENT
                        isReceipt: false
                        isRelated: false
                        netPrice: 5760
                        grossPrice: 7084.8
                        currency: PLN
                        exchangeRate: 1
                        vatPLN: 1324.8
                        issueDate: '2022-12-27T00:00:00.000Z'
                        saleDate: '2022-12-27T00:00:00.000Z'
                        uploadDate: '2022-12-27T08:52:22.000Z'
                        relatedInvoicesIds: []
                        priceTypeId: NET
                      contractor:
                        contractorName: American Water Works Company, Inc.
                        contractorId: 106
                        taxIdentificationNumber: '3748414103'
                        country: PL
                        contractorType: COMPANY
                        contractorRegion: POLAND
                        defaultCurrency: PLN
                        city: Norton Canes
                        street: Dezsez View
                        houseNumber: '396'
                        flatNumber: '154'
                        postCode: 97-135
                        email: went@able.com,fv@altera.co
                        phoneNumber: '420577850'
                        areaNumber: ''
                      buyer:
                        contractorName: American Water Works Company, Inc.
                        contractorId: 106
                        taxIdentificationNumber: '3748414103'
                        country: PL
                        contractorType: COMPANY
                        contractorRegion: POLAND
                        defaultCurrency: PLN
                        city: Norton Canes
                        street: Dezsez View
                        houseNumber: '396'
                        flatNumber: '154'
                        postCode: 97-135
                        email: went@able.com,fv@altera.co
                        phoneNumber: '420577850'
                        areaNumber: ''
                      seller:
                        taxIdentificationNumber: '1397887352'
                        contractorName: Express Scripts Inc.
                      payments:
                        paymentMethod: TRANSFER
                        dueDate: '2023-01-26T00:00:00.000Z'
                        isSplitPayment: false
                        isPaid: false
                        paidAmount: 0
                        bankAccountNumber: 29 1111 1111 1111 1111 1111 1111
                      invoicePosition:
                        - invoiceProductId: 57822
                          positionType: SERVICE
                          productPosition: 0
                          productCategory: Facebook
                          productCategoryId: 808
                          productName: Facebook Ads
                          unit: szt.
                          unitNetPrice: 480
                          unitGrossPrice: 590.4
                          quantity: 12
                          discount: 0
                          vat: 23%
                          priceNet: 5760
                          netPrice: '5760'
                          vatAmt: 1324.8
                          priceGross: 7084.8
                          grossPrice: '7084.8'
                          gtu: '-'
                          deductions: true
                      attachments:
                        - id: 41660
                          fileName: 1_3_2022_1.pdf
                          fileSize: 26968
                      costCenterPerItem: false
                      accounting:
                        vatProcedures: []
                        isSubjectToVat: true
                        activeVat: true
                    defaults:
                      suggestedProducts:
                        - productId: 780
                          productName: Facebook Ads
                        - productId: 781
                          productName: Google Ads
                        - productId: 779
                          productName: Prowadzenie FP
                      suggestedContractor:
                        - contractorId: 106
                          tinCountry: PL
                          tin: '3748414103'
                          name: American Water Works Company, Inc.
                          contractorType: COMPANY
                        - contractorId: 104
                          tinCountry: PL
                          tin: '4387990234'
                          name: Whirlpool Corporation
                          contractorType: COMPANY
                        - contractorId: 87
                          tinCountry: PL
                          tin: '2231185845'
                          name: World Fuel Services Corporation
                          contractorType: COMPANY
                      suggestedCategories:
                        - categoryName: Google
                        - categoryName: Facebook
                        - categoryName: ''
                      suggestedReasons:
                        - Brak adnotacji "mechanizm podzielonej płatności"
                        - Pomyłka w cenie
                        - Pomyłka w dacie
                        - Pomyłka w danych nabywcy
                        - Pomyłka w ilości
                        - Pomyłka w kwocie
                        - Pomyłka w opisie
                        - Pomyłka w stawce VAT
                        - Rabat
                        - Reklamacja
                        - Zwrot towaru / płatności
                      units:
                        - szt.
                        - godz
                        - dni
                        - kg
                        - mb
                      pkwiu: []
                      vatPcs:
                        - name: 23%
                          value: 0.23
                        - name: 8%
                          value: 0.08
                        - name: 5%
                          value: 0.05
                        - name: zw
                          nameEN: exempt.
                          value: 0
                        - name: np
                          nameEN: reverse charge
                          value: 0
                        - name: 0%
                          value: 0
                    relatedInvoices: []
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Invoice:
      type: object
      x-examples:
        Example 1:
          modelType: INVOICE
          readOnly: false
          basicInformation:
            invoiceId: 118584
            invoiceType: PRO_FORMA
            invoiceFormat: PRO %N/%M/%Y
            invoiceNumber: PRO 2/12/2022
            year: 2022
            month: 12
            invoiceNumberInPeriod: 2
            statusId: SENT
            isReceipt: false
            isRelated: false
            netPrice: 5760
            grossPrice: 7084.8
            currency: PLN
            exchangeRate: 1.43
            vatPLN: 1324.8
            issueDate: '2022-12-27T00:00:00.000Z'
            saleDate: '2022-12-27T00:00:00.000Z'
            uploadDate: '2022-12-27T08:52:22.000Z'
            relatedInvoicesIds: []
            priceTypeId: NET
          buyer:
            contractorName: American Water Works Company, Inc.
            contractorId: 106
            taxIdentificationNumber: '3748414103'
            country: PL
            contractorType: COMPANY
            contractorRegion: POLAND
            defaultCurrency: PLN
            city: Norton Canes
            street: Dezsez View
            houseNumber: '396'
            flatNumber: '154'
            postCode: 97-135
            email: went@able.com,fv@altera.co
            phoneNumber: '420577850'
            areaNumber: ''
          seller:
            taxIdentificationNumber: '1397887352'
            contractorName: Express Scripts Inc.
          payments:
            paymentMethod: TRANSFER
            dueDate: '2023-01-26T00:00:00.000Z'
            isSplitPayment: false
            isPaid: false
            paidAmount: 0
            bankAccountNumber: 29 1111 1111 1111 1111 1111 1111
          invoicePosition:
            - invoiceProductId: 57822
              positionType: SERVICE
              productPosition: 0
              productCategory: Facebook
              productCategoryId: 808
              productName: Facebook Ads
              unit: szt.
              unitNetPrice: 480
              unitGrossPrice: 590.4
              quantity: 12
              discount: 0
              vat: 23%
              priceNet: 5760
              netPrice: '5760'
              vatAmt: 1324.8
              priceGross: 7084.8
              grossPrice: '7084.8'
              gtu: '-'
      title: Invoice
      properties:
        modelType:
          type: string
        readOnly:
          type: boolean
        basicInformation:
          type: object
          properties:
            invoiceId:
              type: integer
            invoiceType:
              type: string
              enum:
                - SALES
                - PRO_FORMA
                - INTERIM
                - INTERIM_FINAL
                - CORRECTION
              example: SALES
            invoiceFormat:
              type: string
            invoiceNumber:
              type: string
            year:
              type: integer
            month:
              type: integer
            invoiceNumberInPeriod:
              type: integer
            statusId:
              type: string
            isReceipt:
              type: boolean
            isRelated:
              type: boolean
            netPrice:
              type: integer
            grossPrice:
              type: number
            currency:
              type: string
            exchangeRate:
              type: number
            vatPLN:
              type: number
            issueDate:
              type: string
            saleDate:
              type: string
            uploadDate:
              type: string
            relatedInvoicesIds:
              type: array
              items:
                type: object
            priceTypeId:
              type: string
          required:
            - invoiceId
            - invoiceType
            - invoiceFormat
            - year
            - month
        contractor:
          type: object
          x-stoplight:
            id: 3h79oxtj5267w
          properties:
            contractorName:
              type: string
            contractorId:
              type: integer
            taxIdentificationNumber:
              type: string
            country:
              type: string
            contractorType:
              type: string
            contractorRegion:
              type: string
            defaultCurrency:
              type: string
            city:
              type: string
            street:
              type: string
            houseNumber:
              type: string
            flatNumber:
              type: string
            postCode:
              type: string
            email:
              type: string
            phoneNumber:
              type: string
            areaNumber:
              type: string
        seller:
          type: object
          properties:
            taxIdentificationNumber:
              type: string
            contractorName:
              type: string
        payments:
          type: object
          properties:
            paymentMethod:
              type: string
            dueDate:
              type: string
            isSplitPayment:
              type: boolean
            isPaid:
              type: boolean
            paidAmount:
              type: integer
            bankAccountNumber:
              type: string
        ksef:
          type: object
          properties:
            ksefId:
              type: string
            ksefSubmissionDate:
              type: string
            ksefStatus:
              type: string
              enum:
                - ACCEPTED
                - PENDING
                - ERROR
            ksefErrorMessage:
              type: string
            ksefRetryCount:
              type: integer
            ksefSourceXmlKey:
              type: string
        offlineMode:
          type: boolean
        offlineModeReason:
          type: string
        invoicePosition:
          type: array
          items:
            type: object
            properties:
              invoiceProductId:
                type: integer
              positionType:
                type: string
              productPosition:
                type: integer
              productCategory:
                type: string
              productCategoryId:
                type: integer
              productName:
                type: string
              unit:
                type: string
              unitNetPrice:
                type: integer
              unitGrossPrice:
                type: number
              quantity:
                type: integer
              discount:
                type: integer
              vat:
                type: string
              priceNet:
                type: integer
              netPrice:
                type: string
              vatAmt:
                type: number
              priceGross:
                type: number
              grossPrice:
                type: string
              gtu:
                type: string
      description: Invoice model for objects returned from server
    ErrorResponse:
      type: object
      x-examples:
        Example 1:
          result: Error
          errorMessage: >-
            This tag cannot be deleted, it has been used in at least one
            invoice. You can disable it so it won't appear on the suggestion
            lists.
          errorMessagePL: >-
            Ta kategoria nie może zostać usunięta ponieważ została użyta w
            przynajmniej jednej fakturze. Możesz ją zablokować aby nie pojawiała
            się na liście sugerowanych.
      examples:
        - result: Error
          errorMessage: >-
            This tag cannot be deleted, it has been used in at least one
            invoice. You can disable it so it won't appear on the suggestion
            lists.
          errorMessagePL: >-
            Ta kategoria nie może zostać usunięta ponieważ została użyta w
            przynajmniej jednej fakturze. Możesz ją zablokować aby nie pojawiała
            się na liście sugerowanych.
      properties:
        result:
          type: string
          enum:
            - Error
          default: Error
          example: Error
        errorMessage:
          type: string
        errorMessagePL:
          type: string
      description: >-
        Default error message format in Altera API

        Depending on particular reason, different HTTP Status codes will be
        employed
  securitySchemes:
    Authorization:
      name: Authorization
      type: apiKey
      in: header
      description: OpenApi Key created within Altera.app for a certain company

````