openapi: 3.1.0
servers:
  - description: Production
    url: https://api.codat.io
info:
  contact:
    email: support@codat.io
    name: Codat
    url: https://www.codat.io/contact/
  description: |-
    Codat's Assess API enable you to make smarter credit decisions on your small business customers. Assess enriches your customer's accounting, commerce and banking data to surface actionable insights you didn't have before.

    [Read more...](https://www.codat.io/assess/)

    [See our OpenAPI spec](https://github.com/codatio/oas) 
  summary: Codat's financial insights API
  termsOfService: https://www.codat.io/legals/
  title: Assess API
  version: "1.0"
  x-apisguru-categories:
    - financial
  x-logo:
    url: https://static.codat.io/public/branding/codat-icon-blue.svg
  x-origin:
    - format: openapi
      url: https://raw.githubusercontent.com/codatio/oas/main/json/Codat-Assess.json
      version: "3.1"
  x-providerName: codat.io
  x-serviceName: assess
security:
  - auth_header: []
tags:
  - description: Data integrity is important
    name: Data integrity
  - description: Data integrity is important
    name: Reports
  - description: Downloadable reports
    name: Excel reports
  - description: Categorisation
    name: Categories
paths:
  "/companies/{companyId}/reports/enhancedBalanceSheet/accounts":
    get:
      description: |-
        The Enhanced Balance Sheet Accounts endpoint returns a list of categorized accounts that appear on a company’s Balance Sheet along with a balance per financial statement date.

        Codat suggests a category for each account automatically, but you can [change it](/docs/assess-categorizing-accounts-ecommerce-lending) to a more suitable one.
      operationId: get-accounts-for-enhanced-balance-sheet
      parameters:
        - $ref: "#/components/parameters/reportDate"
        - $ref: "#/components/parameters/numberOfPeriods"
      responses:
        "200":
          content:
            application/json:
              example:
                reportInfo:
                  companyName: Biscuits
                  currency: GBP
                  generatedDate: 2023-03-24T16:42:09.2973105Z
                  reportName: EnhancedBalanceSheetAccounts
                reportItems:
                  - accountCategory:
                      levels:
                        - levelName: Asset
                        - levelName: Current
                        - levelName: AccruedDeferredAssets
                        - levelName: PrepaidExpenses
                      status: Suggested
                    accountId: 22de1660-d745-4809-a363-16b134607e66
                    accountName: Prepayments
                    balance: 12973.03
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Asset
                        - levelName: Current
                        - levelName: Bank
                      status: Suggested
                    accountId: dbcaf288-2b39-4b95-8ab3-42202ab15918
                    accountName: Business Current Account
                    balance: 316065.92
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Asset
                        - levelName: Current
                        - levelName: Inventory
                      status: Suggested
                    accountId: e5d7612c-1671-47b4-b733-5db48363fcd0
                    accountName: Inventory
                    balance: 65945.07
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Asset
                        - levelName: Current
                        - levelName: Receivables
                        - levelName: AccountsReceivables
                      status: Suggested
                    accountId: 1b6266d1-1e44-46c5-8eb5-a8f98e03124e
                    accountName: Accounts Receivable
                    balance: 71937.95
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Asset
                        - levelName: NonCurrent
                        - levelName: AccumulatedDepreciationDepletionAmortization
                      status: Suggested
                    accountId: 724ca578-8b5d-4bdb-ad45-e3820eee9de9
                    accountName: Office Equipment
                    balance: 2180148.56
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Asset
                        - levelName: NonCurrent
                        - levelName: AccumulatedDepreciationDepletionAmortization
                      status: Suggested
                    accountId: be3eb911-034b-42de-95db-0d58ac978b7f
                    accountName: Computer Equipment
                    balance: 1804674.9
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Equity
                        - levelName: RetainedEarnings
                        - levelName: CapitalIncomeReserve
                      status: Suggested
                    accountId: 39225d6f-3722-4508-ac3f-a2f6ec96ad31
                    accountName: Retained Earnings
                    balance: 3417424.16
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Equity
                        - levelName: ShareCapital
                        - levelName: CommonStock
                      status: Suggested
                    accountId: 78828dd9-6008-4662-b43c-e9d87907fd2b
                    accountName: Current Year Earnings
                    balance: 44252.52
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Liability
                        - levelName: Current
                        - levelName: AccountsPayable
                      status: Suggested
                    accountId: 53bf27a7-7497-4c61-9887-dfaad5c6d80a
                    accountName: Accounts Payable
                    balance: 75835.64
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Liability
                        - levelName: Current
                        - levelName: AccruedLiabilities
                      status: Suggested
                    accountId: e2530acd-91c8-48f8-a35f-935dbd7432e2
                    accountName: Accruals
                    balance: 208264.65
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Liability
                        - levelName: Current
                        - levelName: Bank
                      status: Suggested
                    accountId: d19852a2-e292-4eb9-a909-9dadb95c0e76
                    accountName: Rounding
                    balance: 0
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Liability
                        - levelName: Current
                        - levelName: Debt
                        - levelName: CreditCards
                      status: Suggested
                    accountId: 62060aae-e5a6-4db5-a3bb-6abec6d47959
                    accountName: Credit Card Control Account
                    balance: 25184.57
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Liability
                        - levelName: Current
                        - levelName: Debt
                        - levelName: LoansPayable
                      status: Suggested
                    accountId: 9be6382f-6b33-402d-b448-0db1dbf67a98
                    accountName: Historical Adjustment
                    balance: 9650.58
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Liability
                        - levelName: Current
                        - levelName: Debt
                        - levelName: LoansPayable
                      status: Suggested
                    accountId: 8636effc-50fb-45ba-8b2b-18336fa29b6b
                    accountName: John Smith
                    balance: 2022.41
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Liability
                        - levelName: Current
                        - levelName: Personnel
                        - levelName: PensionPayable
                      status: Confirmed
                    accountId: 3a872b81-d1af-4d31-9bfa-a37280b8f68c
                    accountName: VAT
                    balance: 29034.75
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Liability
                        - levelName: Current
                        - levelName: Personnel
                        - levelName: PensionPayable
                      status: Confirmed
                    accountId: 3b58f7ff-fa16-453a-9931-f020816d76e7
                    accountName: Interest Payables
                    balance: 1076.55
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Liability
                        - levelName: NonCurrent
                      status: Suggested
                    accountId: 8852a857-aa9d-4706-839f-638e9d6b5a66
                    accountName: Unpaid Expense Claims
                    balance: 0
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Liability
                        - levelName: NonCurrent
                      status: Suggested
                    accountId: 55008233-40e7-41ac-84af-2255fa028c2e
                    accountName: Loan
                    balance: 638999.6
                    date: 2022-08-31T00:00:00
              schema:
                $ref: "#/components/schemas/EnhancedReport"
          description: OK
      summary: Enhanced Balance Sheet Accounts
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
  "/companies/{companyId}/reports/enhancedCashFlow/transactions":
    get:
      description: The Enhanced Cash Flow Transactions endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources.
      operationId: get-enhanced-cash-flow-transactions
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
      responses:
        "200":
          content:
            application/json:
              example:
                dataSources:
                  - accounts:
                      - accountName: Business Savings Account
                        accountProvider: Lloyds Bank
                        accountType: Debit
                        currency: GBP
                        currentBalance: 0
                        platformName: Banking Sandbox
                        sourceRef:
                          sourceType: Banking
                      - accountName: Banking - Business Credit Card
                        accountProvider: Lloyds Bank
                        accountType: Credit
                        currency: GBP
                        currentBalance: 0
                        platformName: Banking Sandbox
                        sourceRef:
                          sourceType: Banking
                      - accountName: Business Undeposited Funds
                        accountProvider: Lloyds Bank
                        accountType: Debit
                        currency: GBP
                        currentBalance: 0
                        platformName: Banking Sandbox
                        sourceRef:
                          sourceType: Banking
                      - accountName: Business Current Account
                        accountProvider: Lloyds Bank
                        accountType: Debit
                        currency: GBP
                        currentBalance: 0
                        platformName: Banking Sandbox
                        sourceRef:
                          sourceType: Banking
                reportInfo:
                  companyName: test
                  generatedDate: 2023-03-24T16:44:17.5302732Z
                  pageNumber: 1
                  pageSize: 10
                  reportName: Cash flow transactions report
                  totalResults: 2194
                reportItems:
                  - transactions:
                      - amount: -6905.44
                        currency: GBP
                        date: 2022-11-08T00:00:00
                        description: Payment m86SDGpQr3
                        id: ab5e07a0-5578-4d91-8421-2dc72713b74f
                        sourceRef:
                          sourceType: Banking
                        transactionCategory:
                          levels: []
                      - amount: 4332.84
                        currency: GBP
                        date: 2022-11-08T00:00:00
                        description: Payment from customer a5c68c7b-6825-46de-bf63-6ad23ef506a4
                        id: 9846bbed-46d3-472c-a848-1ce8ebea7213
                        sourceRef:
                          sourceType: Banking
                        transactionCategory:
                          levels: []
                      - amount: 4034.3
                        currency: GBP
                        date: 2022-11-08T00:00:00
                        description: Payment from customer a5c68c7b-6825-46de-bf63-6ad23ef506a4
                        id: 94b213fb-d742-435e-90f1-bfe723a076d5
                        sourceRef:
                          sourceType: Banking
                        transactionCategory:
                          levels: []
                      - amount: -313.76
                        currency: GBP
                        date: 2022-11-08T00:00:00
                        description: Payment to supplier 78792d13-90a0-4ea2-8e07-81c3c893997e
                        id: cfceb7ff-eaa2-45b6-aca7-fa0e0b439161
                        sourceRef:
                          sourceType: Banking
                        transactionCategory:
                          levels: []
                      - amount: -614.4
                        currency: GBP
                        date: 2022-11-08T00:00:00
                        description: Payment to supplier 46d2e1fb-b4e9-469c-814a-21ff8105a26e
                        id: ba814f14-0fe3-41d0-9308-57f40642ac75
                        sourceRef:
                          sourceType: Banking
                        transactionCategory:
                          levels: []
                      - amount: 5199.62
                        currency: GBP
                        date: 2022-11-08T00:00:00
                        description: Payment from customer a5c68c7b-6825-46de-bf63-6ad23ef506a4
                        id: e67cc30e-fd5c-4eea-8365-ec40dfdd3ef6
                        sourceRef:
                          sourceType: Banking
                        transactionCategory:
                          levels: []
                      - amount: -21420.94
                        currency: GBP
                        date: 2022-11-08T00:00:00
                        description: Payment to supplier 18ac18dc-945b-4083-9013-e8a100b999fa
                        id: e0f08a0b-3575-4dde-98c4-3c854028d2d2
                        sourceRef:
                          sourceType: Banking
                        transactionCategory:
                          levels: []
                      - amount: -30924.22
                        currency: GBP
                        date: 2022-11-08T00:00:00
                        description: Payment to supplier 630a3f16-5f01-4986-ae6b-82333ec49449
                        id: 4b70d379-8284-4f44-bb37-c7935df950cc
                        sourceRef:
                          sourceType: Banking
                        transactionCategory:
                          levels: []
                      - amount: -568.78
                        currency: GBP
                        date: 2022-11-08T00:00:00
                        description: Payment to supplier bQATU4eSb9
                        id: 76b73373-9345-472e-8edf-5be849d797fe
                        sourceRef:
                          sourceType: Banking
                        transactionCategory:
                          levels: []
                      - amount: -13050.79
                        currency: GBP
                        date: 2022-11-08T00:00:00
                        description: Payment to supplier 9c37eb21-579a-4886-8296-3a853076b7bd
                        id: ee92fd6f-e0f7-4391-85fd-4b50921b973f
                        sourceRef:
                          sourceType: Banking
                        transactionCategory:
                          levels: []
              schema:
                $ref: "#/components/schemas/EnhancedCashFlowTransactions"
          description: OK
      summary: Get enhanced cash flow report
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
  "/companies/{companyId}/reports/enhancedInvoices":
    get:
      description: Gets a list of invoices linked to the corresponding banking transaction
      operationId: get-enhanced-invoices-report
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
      responses:
        "200":
          content:
            application/json:
              example:
                reportInfo:
                  companyName: Small Sandbox
                  generatedDate: 2023-03-24T13:27:28.1156686Z
                  pageNumber: 1
                  pageSize: 10
                  reportName: Invoices report
                  totalResults: 101
                reportItems:
                  - amountDue: 0
                    currency: GBP
                    customerRef:
                      companyName: Serena Keeling
                      id: ee4d0eee-063d-4c9f-8226-2c9a6a816249
                    dueDate: 2021-04-06T09:44:00
                    id: 15221fa4-e91a-4f64-a2bb-caeab4db85a4
                    invoiceNumber: UDs5KlfE
                    issueDate: 2021-04-06T09:44:00
                    paidOnDate: 2021-04-06T09:44:00
                    payments: []
                    status: Paid
                    totalAmount: 7044.83
                  - amountDue: 0
                    currency: GBP
                    customerRef:
                      companyName: Quinton Kovacek
                      id: 81e9c0df-3e5e-4180-b20c-c8e58100cdf3
                    dueDate: 2021-04-06T09:44:00
                    id: 58aea1cb-5b31-4eed-ba16-489dfa67a831
                    invoiceNumber: 1IU1PMoT
                    issueDate: 2021-04-06T09:44:00
                    paidOnDate: 2021-04-06T09:44:00
                    payments: []
                    status: Paid
                    totalAmount: 3567.59
                  - amountDue: 0
                    currency: GBP
                    customerRef:
                      companyName: Antwon Dach
                      id: c7326084-cd56-48e6-bcfa-be8919e024e1
                    dueDate: 2021-04-18T01:27:00
                    id: 9ecd07bc-9cab-4516-bad0-a0cd565cdbaf
                    invoiceNumber: eEIWyPN4
                    issueDate: 2021-04-08T01:27:00
                    paidOnDate: 2021-04-10T12:31:00
                    payments:
                      - amount: 153233.36
                        currency: GBP
                        currencyRate: 1
                        date: 2021-04-10T12:31:00
                        id: 271f2bd4-fab2-468c-9ea5-636b02c865b2
                        paymentType: payments
                    status: Paid
                    totalAmount: 153233.36
                  - amountDue: 0
                    currency: GBP
                    customerRef:
                      companyName: Dolores Rath
                      id: 44e8516d-bcb0-459f-9e5d-7beaa56d57d0
                    dueDate: 2021-04-23T17:30:00
                    id: 7cea078a-5c9a-4788-ae72-9bb60c5cc184
                    invoiceNumber: BXb8mYQW
                    issueDate: 2021-04-16T17:30:00
                    paidOnDate: 2021-04-23T17:30:00
                    payments:
                      - amount: 12657.69
                        currency: GBP
                        currencyRate: 1
                        date: 2021-04-23T17:30:00
                        id: 701608b9-2c52-443a-a272-7acc820e7065
                        paymentType: payments
                    status: Paid
                    totalAmount: 12657.69
                  - amountDue: 381.09
                    currency: GBP
                    customerRef:
                      companyName: Bryana Douglas
                      id: 5cbaf1af-4f02-4206-85ab-c525bd9b4f99
                    dueDate: 2021-04-27T06:46:00
                    id: aa4503d7-fe01-49fe-ba42-259b421ac640
                    invoiceNumber: wdjwiL5B
                    issueDate: 2021-04-20T06:46:00
                    paidOnDate: 0001-01-01T00:00:00
                    payments:
                      - amount: 12554.3
                        currency: GBP
                        currencyRate: 1
                        date: 2021-04-23T14:59:00
                        id: 8c353289-0828-4991-983c-0285c7fc4fb3
                        paymentType: payments
                    status: PartiallyPaid
                    totalAmount: 12935.39
                  - amountDue: 0
                    currency: GBP
                    customerRef:
                      companyName: Brady Wilderman
                      id: 6f5290e5-70aa-4d0c-816e-9d2312cf217f
                    dueDate: 2021-05-03T09:32:00
                    id: d8a0e26e-4ec8-4fb5-887d-8b7531e3bedf
                    invoiceNumber: cTjJcu8x
                    issueDate: 2021-04-23T09:32:00
                    paidOnDate: 2021-05-03T09:32:00
                    payments:
                      - amount: 21506.72
                        currency: GBP
                        currencyRate: 1
                        date: 2021-05-03T09:32:00
                        id: a91beee3-3b73-4194-8ded-837955d62900
                        paymentType: payments
                    status: Paid
                    totalAmount: 21526.72
                  - amountDue: 1225.06
                    currency: GBP
                    customerRef:
                      companyName: Dolores Rath
                      id: 44e8516d-bcb0-459f-9e5d-7beaa56d57d0
                    dueDate: 2021-05-11T23:23:00
                    id: 06890e67-35fb-4276-9857-95db40cfd15d
                    invoiceNumber: htXJuUDb
                    issueDate: 2021-05-01T23:23:00
                    paidOnDate: 0001-01-01T00:00:00
                    payments:
                      - amount: 5926.35
                        currency: GBP
                        currencyRate: 1
                        date: 2021-05-04T17:57:00
                        id: 36c9294d-ed7b-4903-813d-e44f259cc4d6
                        paymentType: payments
                    status: PartiallyPaid
                    totalAmount: 7151.41
                  - amountDue: 14408.54
                    currency: GBP
                    customerRef:
                      companyName: Dolores Rath
                      id: 44e8516d-bcb0-459f-9e5d-7beaa56d57d0
                    dueDate: 2021-05-25T08:53:00
                    id: 160e8b51-1fa0-46b9-98fe-1ff5399ce99b
                    invoiceNumber: 9wegEXpG
                    issueDate: 2021-05-18T08:53:00
                    paidOnDate: 0001-01-01T00:00:00
                    payments:
                      - amount: 8113.8
                        currency: GBP
                        currencyRate: 1
                        date: 2021-05-23T04:04:00
                        id: c913cd2e-9dac-4403-91cd-487892a7add0
                        paymentType: payments
                    status: PartiallyPaid
                    totalAmount: 22522.34
                  - amountDue: 0
                    currency: GBP
                    customerRef:
                      companyName: Ignacio Moore
                      id: cc96af36-e2f5-49f7-bf40-271503f45071
                    dueDate: 2021-06-04T19:51:00
                    id: 5a934955-561d-436a-a564-fd624a79f54c
                    invoiceNumber: l7YwGxG7
                    issueDate: 2021-05-25T19:51:00
                    paidOnDate: 2021-05-28T07:31:00
                    payments:
                      - amount: 11047.08
                        currency: GBP
                        currencyRate: 1
                        date: 2021-05-28T07:31:00
                        id: d7b2371d-94bd-4c58-a585-a893567d4ccd
                        paymentType: payments
                    status: Paid
                    totalAmount: 11047.08
                  - amountDue: 5036.83
                    currency: GBP
                    customerRef:
                      companyName: Freida Ebert
                      id: e1ecc8f2-8a63-4fe9-97c9-c87fd90ca0a6
                    dueDate: 2021-06-03T19:07:00
                    id: 17690788-2936-46b5-ba46-ba6a36a87483
                    invoiceNumber: ntH1cRYz
                    issueDate: 2021-05-27T19:07:00
                    paidOnDate: 0001-01-01T00:00:00
                    payments:
                      - amount: 2154.49
                        currency: GBP
                        currencyRate: 1
                        date: 2021-06-03T19:07:00
                        id: b152a8b3-0320-42a7-817e-9781ac6ca951
                        paymentType: payments
                    status: PartiallyPaid
                    totalAmount: 7191.32
              schema:
                $ref: "#/components/schemas/EnhancedInvoicesReport"
              x-speakeasy-usage-example: true
          description: OK
      summary: Enhanced Invoices Report
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
  "/companies/{companyId}/reports/enhancedProfitAndLoss/accounts":
    get:
      description: |-
        The Enhanced Profit and Loss Accounts endpoint returns a list of categorized accounts that appear on a company’s Profit and Loss. It also includes a balance per the financial statement date.

        Codat suggests a category for each account automatically, but you can [change it](/docs/assess-categorizing-accounts-ecommerce-lending) to a more suitable one.
      operationId: get-accounts-for-enhanced-profit-and-loss
      parameters:
        - $ref: "#/components/parameters/reportDate"
        - $ref: "#/components/parameters/numberOfPeriods"
      responses:
        "200":
          content:
            application/json:
              example:
                reportInfo:
                  companyName: Biscuits
                  currency: GBP
                  generatedDate: 2023-03-24T16:40:59.0847354Z
                  reportName: EnhancedProfitAndLossAccounts
                reportItems:
                  - accountCategory:
                      levels:
                        - levelName: Expense
                      status: Suggested
                    accountId: 04f7111b-55d4-4efc-b329-1bd5c791933a
                    accountName: Repairs & Maintenance
                    balance: 830.93
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: CostOfSales
                      status: Suggested
                    accountId: 7f6a0e92-65be-4333-9a0a-d981b03bedd1
                    accountName: Wages
                    balance: 12000
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: CostOfSales
                        - levelName: Inventory
                      status: Suggested
                    accountId: 7403e960-5b72-42ff-abf4-c870ad8910bd
                    accountName: Purchases
                    balance: 28937.71
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: CostOfSales
                        - levelName: Inventory
                      status: Suggested
                    accountId: e8a0a24e-2dab-46b1-bfe1-6e92551c04e8
                    accountName: Purchase Discounts
                    balance: 582.4
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: NonOperating
                        - levelName: Donations
                      status: Suggested
                    accountId: cbf82e0d-87a7-464d-b567-9274ea94a1c0
                    accountName: Charitable and Political Donations
                    balance: 350.44
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: NonOperating
                        - levelName: Interest
                      status: Suggested
                    accountId: 78785fd7-f197-4c34-aa17-6e76b9255d34
                    accountName: Interest Paid (operating)
                    balance: 535.81
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: NonOperating
                        - levelName: Taxes
                        - levelName: CorporationTaxes
                      status: Suggested
                    accountId: fb3210ef-edeb-48af-bb49-b85d40c1e6bb
                    accountName: Corporation Tax
                    balance: 633.05
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: BankCharges
                      status: Suggested
                    accountId: f3aa84fe-5c31-4107-b207-7e0419f636d7
                    accountName: Bank Fees
                    balance: 782.61
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: Leases
                        - levelName: BuildingRentLease
                      status: Suggested
                    accountId: 9cbe5fe4-ca60-4792-8bf1-de01fb7010aa
                    accountName: Rent
                    balance: 8000
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: Leases
                        - levelName: EquipmentRentLease
                      status: Suggested
                    accountId: 138a8eb3-5c08-4e59-a3bc-892119694447
                    accountName: Motor Vehicle Expenses
                    balance: 1090.68
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: Marketing
                      status: Suggested
                    accountId: 868591ad-f9c2-4956-a5ec-c32c1d48c6f3
                    accountName: Advertising & Marketing
                    balance: 26307.02
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: Marketing
                      status: Suggested
                    accountId: 1734ff00-2a17-45b4-8db6-2dc2e832c460
                    accountName: Postage, Freight & Courier
                    balance: 1128.85
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: Marketing
                      status: Suggested
                    accountId: 7d8d0322-f452-47de-a8e8-54b0130e6f38
                    accountName: Subscriptions
                    balance: 40
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: NonCash
                        - levelName: Amortization
                      status: Suggested
                    accountId: 4378ddba-36b4-4b35-9970-bd972b20d137
                    accountName: Amortization
                    balance: 5.72
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: NonCash
                        - levelName: Depreciation
                      status: Suggested
                    accountId: 940c8a59-3348-4a0b-a1b1-781d9f29cc8b
                    accountName: Depreciation Expense
                    balance: 1539.18
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: Personnel
                        - levelName: EmployeeBenefits
                      status: Suggested
                    accountId: e7ac3baa-cfbe-40c1-a172-83d22e84435b
                    accountName: Entertainment-100% business
                    balance: 1416.05
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: SalesGeneralAdministrative
                      status: Suggested
                    accountId: b5e801e8-8dbc-4390-ac99-3b0fff54a89f
                    accountName: General Expenses
                    balance: 1465.61
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: SalesGeneralAdministrative
                      status: Suggested
                    accountId: 5360066d-1474-49f6-a7a5-c66d5f6032ba
                    accountName: Light, Power, Heating
                    balance: 7347.35
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: SalesGeneralAdministrative
                      status: Suggested
                    accountId: 7aa7988a-ff61-4cb8-bef3-15395355d108
                    accountName: Printing & Stationery
                    balance: 1027.25
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: SalesGeneralAdministrative
                      status: Suggested
                    accountId: 043b6bcb-dfe6-4c97-9b4c-f9b300fe3f03
                    accountName: Telephone & Internet
                    balance: 45
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: SalesGeneralAdministrative
                      status: Suggested
                    accountId: eef78ed1-dfed-447c-bdba-3a49fb2c044b
                    accountName: Audit & Accountancy fees
                    balance: 0
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: SalesGeneralAdministrative
                      status: Suggested
                    accountId: c16f5c35-8283-47da-9d09-5fecb183b0cb
                    accountName: Cleaning
                    balance: 130
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Expense
                        - levelName: Operating
                        - levelName: Travel
                      status: Suggested
                    accountId: df62060b-41cc-4bf2-9de7-c7e537b5663a
                    accountName: Travel - National
                    balance: 860.02
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Income
                        - levelName: Revenue
                        - levelName: Online
                      status: Suggested
                    accountId: 68794a8f-b22d-4520-b97b-025b7cb10f94
                    accountName: Other Revenue
                    balance: 850.22
                    date: 2022-08-31T00:00:00
                  - accountCategory:
                      levels:
                        - levelName: Income
                        - levelName: Revenue
                        - levelName: Wholesale
                      status: Suggested
                    accountId: 72df89d2-512b-4455-af51-a6b563733842
                    accountName: Sales
                    balance: 138457.98
                    date: 2022-08-31T00:00:00
              schema:
                $ref: "#/components/schemas/EnhancedReport"
          description: OK
      summary: Enhanced Profit and Loss Accounts
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
  /data/assess/accounts/categories:
    get:
      deprecated: true
      description: "Lists available account categories Codat's categorisation engine can provide. "
      operationId: list-available-account-categories
      responses:
        "200":
          content:
            application/json:
              examples: {}
              schema:
                $ref: "#/components/schemas/Categories"
          description: OK
      summary: List account categories
      tags:
        - Categories
    parameters: []
  "/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/details":
    get:
      description: Gets record-by-record match results for a given company and datatype, optionally restricted by a Codat query string.
      operationId: get-data-integrity-details
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
        - $ref: "#/components/parameters/orderBy"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Details"
          description: OK
      summary: Lists data integrity details for date type
      tags:
        - Data integrity
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/dataIntegrityDataType"
  "/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/status":
    get:
      description: Gets match status for a given company and datatype.
      operationId: get-data-integrity-status
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Status"
          description: OK
      summary: Get data integrity status
      tags:
        - Data integrity
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/dataIntegrityDataType"
  "/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/summaries":
    get:
      description: Gets match summary for a given company and datatype, optionally restricted by a Codat query string.
      operationId: get-data-integrity-summaries
      parameters:
        - $ref: "#/components/parameters/query"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Summaries"
          description: OK
      summary: Get data integrity summary
      tags:
        - Data integrity
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/dataIntegrityDataType"
  "/data/companies/{companyId}/assess/excel":
    get:
      description: Returns the status of the latest report requested.
      operationId: get-excel-report-generation-status
      parameters:
        - $ref: "#/components/parameters/excelReportType"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExcelStatus"
          description: OK
      summary: Get status of Excel report
      tags:
        - Excel reports
    parameters:
      - $ref: "#/components/parameters/companyId"
    post:
      description: Generate an Excel report which can subsequently be downloaded.
      operationId: generate-excel-report
      parameters:
        - $ref: "#/components/parameters/excelReportType"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExcelStatus"
          description: OK
      summary: Generate an Excel report
      tags:
        - Excel reports
  "/data/companies/{companyId}/assess/excel/download":
    get:
      description: Download the previously generated Excel report to a local drive.
      operationId: get-excel-report
      parameters:
        - $ref: "#/components/parameters/excelReportType"
      responses:
        "200":
          content:
            application/octet-stream:
              schema:
                type: object
          description: OK
      summary: Download generated excel report
      tags:
        - Excel reports
    parameters:
      - $ref: "#/components/parameters/companyId"
    post:
      deprecated: true
      description: Download the previously generated Excel report to a local drive.
      operationId: download-excel-report
      parameters:
        - $ref: "#/components/parameters/excelReportType"
      responses:
        "200":
          content:
            application/octet-stream:
              schema:
                type: object
          description: OK
      summary: Download generated excel report
      tags:
        - Excel reports
  "/data/companies/{companyId}/connections/{connectionId}/assess/accountingMetrics/marketing":
    get:
      description: Request an Excel report for download.
      operationId: get-accounting-marketing-metrics
      parameters:
        - $ref: "#/components/parameters/reportDate"
        - $ref: "#/components/parameters/periodLength"
        - $ref: "#/components/parameters/numberOfPeriods"
        - $ref: "#/components/parameters/periodUnit"
        - $ref: "#/components/parameters/includeDisplayNames"
        - description: If set to true, then the system includes the input values within the response.
          in: query
          name: showInputValues
          schema:
            type: boolean
      responses:
        "200":
          content:
            application/json:
              example:
                - dimensions:
                    - displayName: Period
                      index: 0
                      items:
                        - displayName: Period 0
                          end: 2022-12-31
                          index: 0
                          start: 2022-01-01
                      type: datespan
                    - displayName: Marketing metrics
                      index: 1
                      items:
                        - index: 0
                          value: Marketing to revenue
                        - index: 1
                          value: Marketing to expense
                      type: string
                  measures:
                    - displayName: Percentage
                      index: 0
                      type: percentage
                      units: "%"
                    - displayName: Percentage change vs previous period
                      index: 1
                      type: percentage
                      units: "%"
                  reportData:
                    - components:
                        - dimension: 1
                          dimensionDisplayName: Marketing metrics
                          item: 0
                          itemDisplayName: Marketing to revenue
                          measures:
                            - index: 0
                              measureDisplayName: Percentage
                              value: 564.17
                            - index: 1
                              measureDisplayName: Percentage change vs previous period
                              value: 8.33
                        - dimension: 1
                          dimensionDisplayName: Marketing metrics
                          item: 1
                          itemDisplayName: Marketing to expense
                          measures:
                            - index: 0
                              measureDisplayName: Percentage
                              value: 27.63
                            - index: 1
                              measureDisplayName: Percentage change vs previous period
                              value: 0.12
                      dimension: 0
                      dimensionDisplayName: Period
                      item: 0
                      itemDisplayName: Period 0
                  reportInfo:
                    displayName: Marketing metrics
                    name: marketing_metrics
              schema:
                $ref: "#/components/schemas/Report"
          description: OK
      summary: Get the marketing metrics from an accounting source for a given company.
      tags:
        - Excel reports
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/data/companies/{companyId}/connections/{connectionId}/assess/accounts/categories":
    get:
      deprecated: true
      description: Lists suggested and confirmed chart of account categories for the given company and data connection.
      operationId: list-accounts-categories
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/pageSize"
        - $ref: "#/components/parameters/query"
        - $ref: "#/components/parameters/orderBy"
      responses:
        "200":
          content:
            application/json:
              examples:
                Example 1:
                  value:
                    _links:
                      current:
                        href: /data/companies/companyId/connections/connectionId/assess/accounts/categories?page=1&pageSize=10
                      self:
                        href: /data/companies/companyId/connections/connectionId/assess/accounts/categories
                    pageNumber: 1
                    pageSize: 10
                    results:
                      - accountRef:
                          id: 13d946f0-c5d5-42bc-b092-97ece17923ab
                          name: string
                        confirmed:
                          detailType: Cash
                          modifiedDate: 2019-08-24T14:15:22Z
                          subtype: Current
                          type: Asset
                        suggested:
                          detailType: Cash
                          modifiedDate: 2019-08-24T14:15:22Z
                          subtype: Current
                          type: Asset
                    totalResults: 1
              schema:
                $ref: "#/components/schemas/CategorisedAccounts"
          description: OK
      summary: List suggested and confirmed account categories
      tags:
        - Categories
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
    patch:
      deprecated: true
      description: Comfirms the categories for all or a batch of accounts for a specific connection.
      operationId: update-accounts-categories
      requestBody:
        content:
          application/json:
            examples: {}
            schema:
              $ref: "#/components/schemas/ConfirmCategories"
        description: ""
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/CategorisedAccount"
                type: array
          description: OK
      summary: Confirm categories for accounts
      tags:
        - Categories
  "/data/companies/{companyId}/connections/{connectionId}/assess/accounts/{accountId}/categories":
    get:
      deprecated: true
      description: Get category for specific nominal account.
      operationId: get-account-category
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CategorisedAccount"
          description: OK
      summary: Get suggested and/or confirmed category for a specific account
      tags:
        - Categories
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
      - description: Nominal account id
        in: path
        name: accountId
        required: true
        schema:
          type: string
    patch:
      deprecated: true
      description: Update category for a specific nominal account
      operationId: update-account-category
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ConfirmCategory"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CategorisedAccount"
          description: OK
      summary: Patch account categories
      tags:
        - Categories
  "/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/customerRetention":
    get:
      description: Gets the customer retention metrics for a specific company connection, over one or more periods of time.
      operationId: get-commerce-customer-retention-metrics
      parameters:
        - $ref: "#/components/parameters/reportDate"
        - $ref: "#/components/parameters/periodLength"
        - $ref: "#/components/parameters/numberOfPeriods"
        - $ref: "#/components/parameters/periodUnit"
        - $ref: "#/components/parameters/includeDisplayNames"
      responses:
        "200":
          content:
            application/json:
              example:
                - dimensions:
                    - displayName: Period
                      index: 0
                      items:
                        - displayName: Period 0
                          end: 2022-12-31
                          index: 0
                          start: 2022-01-01
                      type: datespan
                    - displayName: Customer retention metrics
                      index: 1
                      items:
                        - index: 0
                          value: Existing customers
                        - index: 1
                          value: New customers
                        - index: 2
                          value: Total customers
                        - index: 3
                          value: Retention rate
                        - index: 4
                          value: Repeat rate
                      type: string
                  measures:
                    - displayName: Count
                      index: 0
                      type: int
                    - displayName: Percentage
                      index: 1
                      type: percentage
                  reportData:
                    - components:
                        - dimension: 1
                          dimensionDisplayName: Customer retention metrics
                          item: 0
                          itemDisplayName: Existing customers
                          measures:
                            - index: 0
                              measureDisplayName: Count
                              value: 13
                        - dimension: 1
                          dimensionDisplayName: Customer retention metrics
                          item: 1
                          itemDisplayName: New customers
                          measures:
                            - index: 0
                              measureDisplayName: Count
                              value: 47
                        - dimension: 1
                          dimensionDisplayName: Customer retention metrics
                          item: 2
                          itemDisplayName: Total customers
                          measures:
                            - index: 0
                              measureDisplayName: Count
                              value: 60
                        - dimension: 1
                          dimensionDisplayName: Customer retention metrics
                          item: 3
                          itemDisplayName: Retention rate
                          measures:
                            - index: 1
                              measureDisplayName: Percentage
                              value: 0
                        - dimension: 1
                          dimensionDisplayName: Customer retention metrics
                          item: 4
                          itemDisplayName: Repeat rate
                          measures:
                            - index: 1
                              measureDisplayName: Percentage
                              value: 21.67
                      dimension: 0
                      dimensionDisplayName: Period
                      item: 0
                      itemDisplayName: Period 0
                  reportInfo:
                    displayName: Customer Retention
                    name: customer_retention
              schema:
                $ref: "#/components/schemas/Report"
          description: OK
      summary: Get the customer retention metrics for a specific company.
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/lifetimeValue":
    get:
      description: Gets the lifetime value metric for a specific company connection, over one or more periods of time.
      operationId: get-commerce-lifetime-value-metrics
      parameters:
        - $ref: "#/components/parameters/reportDate"
        - $ref: "#/components/parameters/periodLength"
        - $ref: "#/components/parameters/numberOfPeriods"
        - $ref: "#/components/parameters/periodUnit"
        - $ref: "#/components/parameters/includeDisplayNames"
      responses:
        "200":
          content:
            application/json:
              example:
                - dimensions:
                    - displayName: Period
                      index: 0
                      items:
                        - displayName: Period 0
                          end: 2022-12-31
                          index: 0
                          start: 2022-01-01
                      type: datespan
                    - displayName: Lifetime value metrics
                      index: 1
                      items:
                        - index: 0
                          value: Lifetime value
                      type: string
                  measures:
                    - displayName: Value
                      index: 0
                      type: currency
                      units: GBP
                  reportData:
                    - components:
                        - dimension: 1
                          dimensionDisplayName: Lifetime value metrics
                          item: 0
                          itemDisplayName: Lifetime value
                          measures:
                            - index: 0
                              measureDisplayName: Value
                              value: 3782.07
                      dimension: 0
                      dimensionDisplayName: Period
                      item: 0
                      itemDisplayName: Period 0
                  reportInfo:
                    displayName: Lifetime Value
                    name: lifetime_value
              schema:
                $ref: "#/components/schemas/Report"
          description: OK
      summary: Get the lifetime value metric for a specific company.
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/orders":
    get:
      description: Gets the order information for a specific company connection, over one or more periods of time.
      operationId: get-commerce-orders-metrics
      parameters:
        - $ref: "#/components/parameters/reportDate"
        - $ref: "#/components/parameters/periodLength"
        - $ref: "#/components/parameters/numberOfPeriods"
        - $ref: "#/components/parameters/periodUnit"
        - $ref: "#/components/parameters/includeDisplayNames"
      responses:
        "200":
          content:
            application/json:
              example:
                - dimensions:
                    - displayName: Period
                      index: 0
                      items:
                        - displayName: Period 0
                          end: 2022-12-31
                          index: 0
                          start: 2022-01-01
                      type: datespan
                    - displayName: Order metrics
                      index: 1
                      items:
                        - index: 0
                          value: Number of orders
                        - index: 1
                          value: Total value
                        - index: 2
                          value: Average order value
                      type: string
                  measures:
                    - displayName: Count
                      index: 0
                      type: int
                    - displayName: Value
                      index: 1
                      type: currency
                      units: GBP
                  reportData:
                    - components:
                        - dimension: 1
                          dimensionDisplayName: Order metrics
                          item: 0
                          itemDisplayName: Number of orders
                          measures:
                            - index: 0
                              measureDisplayName: Count
                              value: 94
                        - dimension: 1
                          dimensionDisplayName: Order metrics
                          item: 1
                          itemDisplayName: Total value
                          measures:
                            - index: 1
                              measureDisplayName: Value
                              value: 3315.18
                        - dimension: 1
                          dimensionDisplayName: Order metrics
                          item: 2
                          itemDisplayName: Average order value
                          measures:
                            - index: 1
                              measureDisplayName: Value
                              value: 35.27
                      dimension: 0
                      dimensionDisplayName: Period
                      item: 0
                      itemDisplayName: Period 0
                  reportInfo:
                    displayName: Orders
                    name: orders
              schema:
                $ref: "#/components/schemas/Report"
          description: OK
      summary: Get order information for a specific company
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/refunds":
    get:
      description: Gets the refunds information for a specific company connection, over one or more periods of time.
      operationId: get-commerce-refunds-metrics
      parameters:
        - $ref: "#/components/parameters/reportDate"
        - $ref: "#/components/parameters/periodLength"
        - $ref: "#/components/parameters/numberOfPeriods"
        - $ref: "#/components/parameters/periodUnit"
        - $ref: "#/components/parameters/includeDisplayNames"
      responses:
        "200":
          content:
            application/json:
              example:
                - dimensions:
                    - displayName: Period
                      index: 0
                      items:
                        - displayName: Period 0
                          end: 2022-12-31
                          index: 0
                          start: 2022-01-01
                      type: datespan
                    - displayName: Refund metrics
                      index: 1
                      items:
                        - index: 0
                          value: Number of refunds
                        - index: 1
                          value: Value of refunds
                        - index: 2
                          value: Refund rate
                      type: string
                  measures:
                    - displayName: Count
                      index: 0
                      type: int
                    - displayName: Value
                      index: 1
                      type: currency
                      units: GBP
                    - displayName: Percentage
                      index: 2
                      type: percentage
                      units: "%"
                  reportData:
                    - components:
                        - dimension: 1
                          dimensionDisplayName: Refund metrics
                          item: 0
                          itemDisplayName: Number of refunds
                          measures:
                            - index: 0
                              measureDisplayName: Count
                              value: 39
                        - dimension: 1
                          dimensionDisplayName: Refund metrics
                          item: 1
                          itemDisplayName: Value of refunds
                          measures:
                            - index: 1
                              measureDisplayName: Value
                              value: 642.82
                        - dimension: 1
                          dimensionDisplayName: Refund metrics
                          item: 2
                          itemDisplayName: Refund rate
                          measures:
                            - index: 2
                              measureDisplayName: Percentage
                              value: 0.41
                      dimension: 0
                      dimensionDisplayName: Period
                      item: 0
                      itemDisplayName: Period 0
                  reportInfo:
                    displayName: Refunds
                    name: refunds
              schema:
                $ref: "#/components/schemas/Report"
          description: OK
      summary: Get the refunds information for a specific company
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/revenue":
    get:
      description: Get the revenue and revenue growth for a specific company connection, over one or more periods of time.
      operationId: get-commerce-revenue-metrics
      parameters:
        - $ref: "#/components/parameters/reportDate"
        - $ref: "#/components/parameters/periodLength"
        - $ref: "#/components/parameters/numberOfPeriods"
        - $ref: "#/components/parameters/periodUnit"
        - $ref: "#/components/parameters/includeDisplayNames"
      responses:
        "200":
          content:
            application/json:
              example:
                - dimensions:
                    - displayName: Period
                      index: 0
                      items:
                        - displayName: Period 0
                          end: 2022-12-31
                          index: 0
                          start: 2022-01-01
                      type: datespan
                    - displayName: Revenue metrics
                      index: 1
                      items:
                        - index: 0
                          value: Revenue
                        - index: 1
                          value: Revenue growth
                      type: string
                  measures:
                    - displayName: Value
                      index: 0
                      type: currency
                      units: GBP
                    - displayName: Percentage change vs. previous period
                      index: 1
                      type: percentage
                      units: "%"
                  reportData:
                    - components:
                        - dimension: 1
                          dimensionDisplayName: Revenue metrics
                          item: 0
                          itemDisplayName: Revenue
                          measures:
                            - index: 0
                              measureDisplayName: Value
                              value: 2392.48
                        - dimension: 1
                          dimensionDisplayName: Revenue metrics
                          item: 1
                          itemDisplayName: Revenue growth
                          measures:
                            - index: 1
                              measureDisplayName: Percentage change vs. previous period
                              value: 276.65
                      dimension: 0
                      dimensionDisplayName: Period
                      item: 0
                      itemDisplayName: Period 0
                  reportInfo:
                    displayName: Revenue
                    name: revenue
              schema:
                $ref: "#/components/schemas/Report"
          description: OK
      summary: Commerce Revenue Metrics
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/data/companies/{companyId}/connections/{connectionId}/assess/enhancedBalanceSheet":
    get:
      deprecated: true
      description: Gets a fully categorized balance sheet statement for a given company, over one or more period(s).
      operationId: get-enhanced-balance-sheet
      parameters:
        - $ref: "#/components/parameters/reportDate"
        - $ref: "#/components/parameters/periodLength"
        - $ref: "#/components/parameters/numberOfPeriods"
        - $ref: "#/components/parameters/includeDisplayNames"
      responses:
        "200":
          content:
            application/json:
              example:
                dimensions:
                  - displayName: Period
                    index: 0
                    items:
                      - displayName: Period 0
                        end: 2022-12-31
                        index: 0
                        start: 2022-01-01
                    type: datespan
                  - displayName: Category
                    index: 1
                    items:
                      - index: 0
                        value: Asset
                      - index: 1
                        value: Liability
                      - index: 2
                        value: Equity
                      - index: 3
                        value: Net Assets
                    type: string
                  - displayName: Sub Type
                    index: 2
                    items:
                      - index: 0
                        value: Non-current assets
                      - index: 1
                        value: Current assets
                      - index: 2
                        value: Current liabilities
                      - index: 3
                        value: Non-current liabilities
                      - index: 4
                        value: Equity
                    type: string
                  - displayName: Detail Type
                    index: 3
                    items:
                      - index: 0
                        value: Fixtures and fittings
                      - index: 1
                        value: Equipment and machinery
                      - index: 2
                        value: Accounts receivable
                      - index: 3
                        value: Prepaid expenses
                      - index: 4
                        value: Inventory - merchandise
                      - index: 5
                        value: Cash
                      - index: 6
                        value: Taxes payable
                      - index: 7
                        value: Other current liabilities
                      - index: 8
                        value: Accounts payable
                      - index: 9
                        value: Due to employees
                      - index: 10
                        value: Interest payable
                      - index: 11
                        value: Notes payable
                      - index: 12
                        value: Accrued liabilities
                      - index: 13
                        value: Credit cards
                      - index: 14
                        value: Loans payable
                      - index: 15
                        value: Retained earnings
                    type: string
                  - displayName: Accounts
                    index: 4
                    items:
                      - dataType: account
                        displayName: Office Equipment
                        id: 724ca578-8b5d-4bdb-ad45-e3820eee9de9
                        index: 0
                      - dataType: account
                        displayName: Computer Equipment
                        id: be3eb911-034b-42de-95db-0d58ac978b7f
                        index: 1
                      - dataType: account
                        displayName: Accounts Receivable
                        id: 1b6266d1-1e44-46c5-8eb5-a8f98e03124e
                        index: 2
                      - dataType: account
                        displayName: Prepayments
                        id: 22de1660-d745-4809-a363-16b134607e66
                        index: 3
                      - dataType: account
                        displayName: Inventory
                        id: e5d7612c-1671-47b4-b733-5db48363fcd0
                        index: 4
                      - dataType: account
                        displayName: Business Current Account
                        id: dbcaf288-2b39-4b95-8ab3-42202ab15918
                        index: 5
                      - dataType: account
                        displayName: VAT
                        id: 3a872b81-d1af-4d31-9bfa-a37280b8f68c
                        index: 6
                      - dataType: account
                        displayName: Rounding
                        id: d19852a2-e292-4eb9-a909-9dadb95c0e76
                        index: 7
                      - dataType: account
                        displayName: Historical Adjustment
                        id: 9be6382f-6b33-402d-b448-0db1dbf67a98
                        index: 8
                      - dataType: account
                        displayName: Accounts Payable
                        id: 53bf27a7-7497-4c61-9887-dfaad5c6d80a
                        index: 9
                      - dataType: account
                        displayName: Unpaid Expense Claims
                        id: 8852a857-aa9d-4706-839f-638e9d6b5a66
                        index: 10
                      - dataType: account
                        displayName: Interest Payables
                        id: 3b58f7ff-fa16-453a-9931-f020816d76e7
                        index: 11
                      - dataType: account
                        displayName: John Smith
                        id: 8636effc-50fb-45ba-8b2b-18336fa29b6b
                        index: 12
                      - dataType: account
                        displayName: Accruals
                        id: e2530acd-91c8-48f8-a35f-935dbd7432e2
                        index: 13
                      - dataType: account
                        displayName: Credit Card Control Account
                        id: 62060aae-e5a6-4db5-a3bb-6abec6d47959
                        index: 14
                      - dataType: account
                        displayName: Loan
                        id: 55008233-40e7-41ac-84af-2255fa028c2e
                        index: 15
                      - dataType: account
                        displayName: Retained Earnings
                        id: 39225d6f-3722-4508-ac3f-a2f6ec96ad31
                        index: 16
                      - dataType: account
                        displayName: Current Year Earnings
                        id: 78828dd9-6008-4662-b43c-e9d87907fd2b
                        index: 17
                    type: recordRef
                measures:
                  - displayName: Value
                    index: 0
                    type: currency
                    units: GBP
                  - displayName: Percentage change vs previous period
                    index: 1
                    type: percentage
                    units: "%"
                reportData:
                  - components:
                      - components:
                          - components:
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 0
                                    itemDisplayName: Office Equipment
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 2116634.16
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 0
                                itemDisplayName: FixturesFittings
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 2116634.16
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 1
                                    itemDisplayName: Computer Equipment
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 2095078.83
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 1
                                itemDisplayName: EquipmentMachinery
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 2095078.83
                            dimension: 2
                            dimensionDisplayName: Sub Type
                            item: 0
                            itemDisplayName: NonCurrent
                            measures:
                              - index: 0
                                measureDisplayName: Value
                                value: 4211712.99
                          - components:
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 2
                                    itemDisplayName: Accounts Receivable
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 59801.56
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 2
                                itemDisplayName: AccountsReceivable
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 59801.56
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 3
                                    itemDisplayName: Prepayments
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 17370.58
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 3
                                itemDisplayName: PrepaidExpenses
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 17370.58
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 4
                                    itemDisplayName: Inventory
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 76076.15
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 4
                                itemDisplayName: InventoryMerchandise
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 76076.15
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 5
                                    itemDisplayName: Business Current Account
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 250411.79
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 5
                                itemDisplayName: Cash
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 250411.79
                            dimension: 2
                            dimensionDisplayName: Sub Type
                            item: 1
                            itemDisplayName: Current
                            measures:
                              - index: 0
                                measureDisplayName: Value
                                value: 403660.08
                        dimension: 1
                        dimensionDisplayName: Category
                        item: 0
                        itemDisplayName: Asset
                        measures:
                          - index: 0
                            measureDisplayName: Value
                            value: 4615373.07
                      - components:
                          - components:
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 6
                                    itemDisplayName: VAT
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 22517.58
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 6
                                itemDisplayName: TaxesPayable
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 22517.58
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 7
                                    itemDisplayName: Rounding
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 0
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 8
                                    itemDisplayName: Historical Adjustment
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 7315.78
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 7
                                itemDisplayName: Other
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 7315.78
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 9
                                    itemDisplayName: Accounts Payable
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 39512.94
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 8
                                itemDisplayName: AccountsPayable
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 39512.94
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 11
                                    itemDisplayName: Interest Payables
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 1232.43
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 10
                                itemDisplayName: InterestPayable
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 1232.43
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 12
                                    itemDisplayName: John Smith
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 1575.93
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 11
                                itemDisplayName: NotesPayable
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 1575.93
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 13
                                    itemDisplayName: Accruals
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 235869.49
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 12
                                itemDisplayName: AccruedLiabilities
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 235869.49
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 14
                                    itemDisplayName: Credit Card Control Account
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 22844.77
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 13
                                itemDisplayName: CreditCards
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 22844.77
                            dimension: 2
                            dimensionDisplayName: Sub Type
                            item: 2
                            itemDisplayName: Current
                            measures:
                              - index: 0
                                measureDisplayName: Value
                                value: 330868.92
                          - components:
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 10
                                    itemDisplayName: Unpaid Expense Claims
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 0
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 9
                                itemDisplayName: DueToEmployees
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 0
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 15
                                    itemDisplayName: Loan
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 638999.6
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 14
                                itemDisplayName: LoansPayable
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 638999.6
                            dimension: 2
                            dimensionDisplayName: Sub Type
                            item: 3
                            itemDisplayName: NonCurrent
                            measures:
                              - index: 0
                                measureDisplayName: Value
                                value: 638999.6
                        dimension: 1
                        dimensionDisplayName: Category
                        item: 1
                        itemDisplayName: Liability
                        measures:
                          - index: 0
                            measureDisplayName: Value
                            value: 969868.52
                      - components:
                          - components:
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 16
                                    itemDisplayName: Retained Earnings
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 3599540.05
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 17
                                    itemDisplayName: Current Year Earnings
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 45964.5
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 15
                                itemDisplayName: RetainedEarnings
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 3645504.55
                            dimension: 2
                            dimensionDisplayName: Sub Type
                            item: 4
                            itemDisplayName: Equity
                            measures:
                              - index: 0
                                measureDisplayName: Value
                                value: 3645504.55
                        dimension: 1
                        dimensionDisplayName: Category
                        item: 2
                        itemDisplayName: Equity
                        measures:
                          - index: 0
                            measureDisplayName: Value
                            value: 3645504.55
                      - dimension: 1
                        dimensionDisplayName: Category
                        item: 3
                        itemDisplayName: Net Assets
                        measures:
                          - index: 0
                            measureDisplayName: Value
                            value: 3645504.55
                    dimension: 0
                    dimensionDisplayName: Period
                    item: 0
                    itemDisplayName: Period 0
                reportInfo:
                  displayName: Enhanced Balance Sheet
                  name: enhanced_balance_sheet
              schema:
                $ref: "#/components/schemas/Report"
          description: OK
      summary: Enhanced Balance Sheet
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/data/companies/{companyId}/connections/{connectionId}/assess/enhancedProfitAndLoss":
    get:
      deprecated: true
      description: Gets a fully categorized profit and loss statement for a given company, over one or more period(s).
      operationId: get-enhanced-profit-and-loss
      parameters:
        - $ref: "#/components/parameters/reportDate"
        - $ref: "#/components/parameters/periodLength"
        - $ref: "#/components/parameters/numberOfPeriods"
        - $ref: "#/components/parameters/includeDisplayNames"
      responses:
        "200":
          content:
            application/json:
              example:
                dimensions:
                  - displayName: Period
                    index: 0
                    items:
                      - displayName: Period 0
                        end: 2022-01-31
                        index: 0
                        start: 2021-02-01
                    type: datespan
                  - displayName: Category
                    index: 1
                    items:
                      - index: 0
                        value: Income
                      - index: 1
                        value: Expense
                      - index: 2
                        value: Gross Profit
                      - index: 3
                        value: Net Operating Profit
                      - index: 4
                        value: Net Profit
                    type: string
                  - displayName: Sub Type
                    index: 2
                    items:
                      - index: 0
                        value: Operating
                      - index: 1
                        value: Cost of sales
                      - index: 2
                        value: Non-operating
                    type: string
                  - displayName: Detail Type
                    index: 3
                    items:
                      - index: 0
                        value: Other operating income
                      - index: 1
                        value: Materials
                      - index: 2
                        value: Marketing
                      - index: 3
                        value: Depreciation and depletion
                      - index: 4
                        value: Entertainment
                      - index: 5
                        value: General and Administrative
                      - index: 6
                        value: Repairs and maintenance
                      - index: 7
                        value: Distribution
                      - index: 8
                        value: Buildings rent and lease
                      - index: 9
                        value: Subscription fees
                      - index: 10
                        value: Travel
                      - index: 11
                        value: Bank charges
                      - index: 12
                        value: Taxes
                      - index: 13
                        value: Labour
                      - index: 14
                        value: Amortization
                      - index: 15
                        value: Interest
                      - index: 16
                        value: Other non-operating expenses
                    type: string
                  - displayName: Accounts
                    index: 4
                    items:
                      - dataType: account
                        displayName: Sales
                        id: 72df89d2-512b-4455-af51-a6b563733842
                        index: 0
                      - dataType: account
                        displayName: Other Revenue
                        id: 68794a8f-b22d-4520-b97b-025b7cb10f94
                        index: 1
                      - dataType: account
                        displayName: Purchases
                        id: 7403e960-5b72-42ff-abf4-c870ad8910bd
                        index: 2
                      - dataType: account
                        displayName: Advertising & Marketing
                        id: 868591ad-f9c2-4956-a5ec-c32c1d48c6f3
                        index: 3
                      - dataType: account
                        displayName: Depreciation Expense
                        id: 940c8a59-3348-4a0b-a1b1-781d9f29cc8b
                        index: 4
                      - dataType: account
                        displayName: Entertainment-100% business
                        id: e7ac3baa-cfbe-40c1-a172-83d22e84435b
                        index: 5
                      - dataType: account
                        displayName: General Expenses
                        id: b5e801e8-8dbc-4390-ac99-3b0fff54a89f
                        index: 6
                      - dataType: account
                        displayName: Light, Power, Heating
                        id: 5360066d-1474-49f6-a7a5-c66d5f6032ba
                        index: 7
                      - dataType: account
                        displayName: Motor Vehicle Expenses
                        id: 138a8eb3-5c08-4e59-a3bc-892119694447
                        index: 8
                      - dataType: account
                        displayName: Postage, Freight & Courier
                        id: 1734ff00-2a17-45b4-8db6-2dc2e832c460
                        index: 9
                      - dataType: account
                        displayName: Printing & Stationery
                        id: 7aa7988a-ff61-4cb8-bef3-15395355d108
                        index: 10
                      - dataType: account
                        displayName: Rent
                        id: 9cbe5fe4-ca60-4792-8bf1-de01fb7010aa
                        index: 11
                      - dataType: account
                        displayName: Repairs & Maintenance
                        id: 04f7111b-55d4-4efc-b329-1bd5c791933a
                        index: 12
                      - dataType: account
                        displayName: Subscriptions
                        id: 7d8d0322-f452-47de-a8e8-54b0130e6f38
                        index: 13
                      - dataType: account
                        displayName: Telephone & Internet
                        id: 043b6bcb-dfe6-4c97-9b4c-f9b300fe3f03
                        index: 14
                      - dataType: account
                        displayName: Travel - National
                        id: df62060b-41cc-4bf2-9de7-c7e537b5663a
                        index: 15
                      - dataType: account
                        displayName: Audit & Accountancy fees
                        id: eef78ed1-dfed-447c-bdba-3a49fb2c044b
                        index: 16
                      - dataType: account
                        displayName: Bank Fees
                        id: f3aa84fe-5c31-4107-b207-7e0419f636d7
                        index: 17
                      - dataType: account
                        displayName: Cleaning
                        id: c16f5c35-8283-47da-9d09-5fecb183b0cb
                        index: 18
                      - dataType: account
                        displayName: Corporation Tax
                        id: fb3210ef-edeb-48af-bb49-b85d40c1e6bb
                        index: 19
                      - dataType: account
                        displayName: Wages
                        id: 7f6a0e92-65be-4333-9a0a-d981b03bedd1
                        index: 20
                      - dataType: account
                        displayName: Purchase Discounts
                        id: e8a0a24e-2dab-46b1-bfe1-6e92551c04e8
                        index: 21
                      - dataType: account
                        displayName: Amortization
                        id: 4378ddba-36b4-4b35-9970-bd972b20d137
                        index: 22
                      - dataType: account
                        displayName: Interest Paid (operating)
                        id: 78785fd7-f197-4c34-aa17-6e76b9255d34
                        index: 23
                      - dataType: account
                        displayName: Charitable and Political Donations
                        id: cbf82e0d-87a7-464d-b567-9274ea94a1c0
                        index: 24
                    type: recordRef
                measures:
                  - displayName: Value
                    index: 0
                    type: currency
                    units: GBP
                  - displayName: Percentage change vs previous period
                    index: 1
                    type: percentage
                    units: "%"
                reportData:
                  - components:
                      - components:
                          - components:
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 0
                                    itemDisplayName: Sales
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 1412199.76
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 1
                                    itemDisplayName: Other Revenue
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 10202.64
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 0
                                itemDisplayName: OtherOperatingIncome
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 1422402.4
                            dimension: 2
                            dimensionDisplayName: Sub Type
                            item: 0
                            itemDisplayName: Operating
                            measures:
                              - index: 0
                                measureDisplayName: Value
                                value: 1422402.4
                        dimension: 1
                        dimensionDisplayName: Category
                        item: 0
                        itemDisplayName: Income
                        measures:
                          - index: 0
                            measureDisplayName: Value
                            value: 1422402.4
                      - components:
                          - components:
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 2
                                    itemDisplayName: Purchases
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 301322.16
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 21
                                    itemDisplayName: Purchase Discounts
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 5367.29
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 1
                                itemDisplayName: Materials
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 306689.45
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 20
                                    itemDisplayName: Wages
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 144000
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 13
                                itemDisplayName: Labour
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 144000
                            dimension: 2
                            dimensionDisplayName: Sub Type
                            item: 1
                            itemDisplayName: CostOfSales
                            measures:
                              - index: 0
                                measureDisplayName: Value
                                value: 450689.45
                          - components:
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 3
                                    itemDisplayName: Advertising & Marketing
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 269531.7
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 2
                                itemDisplayName: Marketing
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 269531.7
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 4
                                    itemDisplayName: Depreciation Expense
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 13256.93
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 3
                                itemDisplayName: DepreciationDepletion
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 13256.93
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 5
                                    itemDisplayName: Entertainment-100% business
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 15526.09
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 4
                                itemDisplayName: Entertainment
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 15526.09
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 6
                                    itemDisplayName: General Expenses
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 16654.32
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 7
                                    itemDisplayName: Light, Power, Heating
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 14859.1
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 10
                                    itemDisplayName: Printing & Stationery
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 15404.82
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 14
                                    itemDisplayName: Telephone & Internet
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 540
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 16
                                    itemDisplayName: Audit & Accountancy fees
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 46.96
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 18
                                    itemDisplayName: Cleaning
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 1560
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 5
                                itemDisplayName: GeneralAdministrative
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 49065.2
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 8
                                    itemDisplayName: Motor Vehicle Expenses
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 13531.13
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 12
                                    itemDisplayName: Repairs & Maintenance
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 8890.04
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 6
                                itemDisplayName: RepairsMaintenance
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 22421.17
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 9
                                    itemDisplayName: Postage, Freight & Courier
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 12593.28
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 7
                                itemDisplayName: Distribution
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 12593.28
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 11
                                    itemDisplayName: Rent
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 96000
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 8
                                itemDisplayName: BuildingRentLease
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 96000
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 13
                                    itemDisplayName: Subscriptions
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 480
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 9
                                itemDisplayName: SubscriptionFees
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 480
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 15
                                    itemDisplayName: Travel - National
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 15505.18
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 10
                                itemDisplayName: Travel
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 15505.18
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 17
                                    itemDisplayName: Bank Fees
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 14529.79
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 11
                                itemDisplayName: BankCharges
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 14529.79
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 22
                                    itemDisplayName: Amortization
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 68.64
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 14
                                itemDisplayName: Amortization
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 68.64
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 23
                                    itemDisplayName: Interest Paid (operating)
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 4729.93
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 15
                                itemDisplayName: Interest
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 4729.93
                            dimension: 2
                            dimensionDisplayName: Sub Type
                            item: 0
                            itemDisplayName: Operating
                            measures:
                              - index: 0
                                measureDisplayName: Value
                                value: 513707.91
                          - components:
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 19
                                    itemDisplayName: Corporation Tax
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 10801.01
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 12
                                itemDisplayName: Taxes
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 10801.01
                              - components:
                                  - dimension: 4
                                    dimensionDisplayName: Accounts
                                    item: 24
                                    itemDisplayName: Charitable and Political Donations
                                    measures:
                                      - index: 0
                                        measureDisplayName: Value
                                        value: 4205.28
                                dimension: 3
                                dimensionDisplayName: Detail Type
                                item: 16
                                itemDisplayName: OtherNonOperatingExpenses
                                measures:
                                  - index: 0
                                    measureDisplayName: Value
                                    value: 4205.28
                            dimension: 2
                            dimensionDisplayName: Sub Type
                            item: 2
                            itemDisplayName: NonOperating
                            measures:
                              - index: 0
                                measureDisplayName: Value
                                value: 15006.29
                        dimension: 1
                        dimensionDisplayName: Category
                        item: 1
                        itemDisplayName: Expense
                        measures:
                          - index: 0
                            measureDisplayName: Value
                            value: 979403.65
                      - dimension: 1
                        dimensionDisplayName: Category
                        item: 2
                        itemDisplayName: Gross Profit
                        measures:
                          - index: 0
                            measureDisplayName: Value
                            value: 971712.95
                      - dimension: 1
                        dimensionDisplayName: Category
                        item: 3
                        itemDisplayName: Net Operating Profit
                        measures:
                          - index: 0
                            measureDisplayName: Value
                            value: 458005.04
                      - dimension: 1
                        dimensionDisplayName: Category
                        item: 4
                        itemDisplayName: Net Profit
                        measures:
                          - index: 0
                            measureDisplayName: Value
                            value: 442998.75
                    dimension: 0
                    dimensionDisplayName: Period
                    item: 0
                    itemDisplayName: Period 0
                reportInfo:
                  displayName: Enhanced Profit and Loss
                  name: enhanced_profit_and_loss
              schema:
                $ref: "#/components/schemas/Report"
          description: OK
      summary: Enhanced Profit and Loss
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/data/companies/{companyId}/connections/{connectionId}/assess/financialMetrics":
    get:
      deprecated: true
      description: Gets all the available financial metrics for a given company, over one or more periods.
      operationId: get-enhanced-financial-metrics
      parameters:
        - $ref: "#/components/parameters/reportDate"
        - $ref: "#/components/parameters/periodLength"
        - $ref: "#/components/parameters/numberOfPeriods"
        - description: If set to true, then the system includes the input values within the response.
          in: query
          name: showMetricInputs
          schema:
            type: boolean
      responses:
        "200":
          content:
            application/json:
              example:
                currency: GBP
                errors:
                  - message: Account categories data has not been synced
                    type: DataNotSynced
                metrics:
                  - errors:
                      - details:
                          accountIds:
                            - "123"
                            - "456"
                            - "789"
                        message: There are uncategorized accounts, see details.
                        type: UncategorizedAccounts
                    key: EBITDA
                    metricUnit: Money
                    name: string
                    periods:
                      - errors:
                          - details:
                              missingData:
                                - Expense.Operating.Interest
                                - Expense.NonOperating.Interest
                            massage: Missing account data
                            type: MissingAccountData
                        fromDate: 2022-02-12
                        inputs:
                          - name: string
                            value: 0
                        toDate: 2022-12-31
                        value: 0
                periodUnit: Month
              schema:
                $ref: "#/components/schemas/FinancialMetrics"
          description: OK
      summary: List financial metrics
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/data/companies/{companyId}/connections/{connectionId}/assess/subscriptions/mrr":
    get:
      description: Gets key metrics for subscription revenue.
      operationId: get-recurring-revenue-metrics
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Report"
          description: OK
      summary: Get key metrics for subscription revenue
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
  "/data/companies/{companyId}/connections/{connectionId}/assess/subscriptions/process":
    get:
      description: Request production of key subscription revenue metrics.
      operationId: request-recurring-revenue-metrics
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Report"
          description: OK
      summary: Request production of key subscription revenue metrics
      tags:
        - Reports
    parameters:
      - $ref: "#/components/parameters/companyId"
      - $ref: "#/components/parameters/connectionId"
components:
  parameters:
    companyId:
      in: path
      name: companyId
      required: true
      schema:
        description: Unique identifier for your SMB in Codat.
        example: 8a210b68-6988-11ed-a1eb-0242ac120002
        format: uuid
        type: string
    connectionId:
      in: path
      name: connectionId
      required: true
      schema:
        description: Unique identifier for a company's data connection.
        example: 2e9d2c44-f675-40ba-8049-353bfcb5e171
        format: uuid
        type: string
    dataIntegrityDataType:
      description: A key for a Codat data type.
      in: path
      name: dataType
      required: true
      schema:
        enum:
          - banking-accounts
          - banking-transactions
          - bankAccounts
          - accountTransactions
        example: banking-accounts
        type: string
    excelReportType:
      description: The type of report you want to generate and download.
      in: query
      name: reportType
      required: true
      schema:
        enum:
          - audit
          - enhancedFinancials
        type: string
    includeDisplayNames:
      description: Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.
      in: query
      name: includeDisplayNames
      schema:
        type: boolean
    numberOfPeriods:
      description: The number of periods to return.  There will be no pagination as a query parameter, however Codat will limit the number of periods to request to 12 periods.
      in: query
      name: numberOfPeriods
      required: true
      schema:
        type: integer
    orderBy:
      description: Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).
      in: query
      name: orderBy
      required: false
      schema:
        example: -modifiedDate
        type: string
      x-stoplight:
        id: 4je9lwo02netu
    page:
      description: Page number. [Read more](https://docs.codat.io/using-the-api/paging).
      in: query
      name: page
      required: true
      schema:
        default: 1
        example: 1
        format: int32
        minimum: 0
        type: integer
      x-stoplight:
        id: 1318joqblpp4e
    pageSize:
      description: Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).
      in: query
      name: pageSize
      schema:
        default: 100
        example: 100
        format: int32
        maximum: 5000
        minimum: 1
        type: integer
      x-stoplight:
        id: s2ika6rltk5y6
    periodLength:
      description: The number of months per period. E.g. 2 = 2 months per period.
      in: query
      name: periodLength
      required: true
      schema:
        type: integer
    periodUnit:
      description: The period unit of time returned.
      in: query
      name: periodUnit
      required: true
      schema:
        enum:
          - Day
          - Week
          - Month
          - Year
        type: string
    query:
      description: Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).
      in: query
      name: query
      required: false
      schema:
        type: string
      x-stoplight:
        id: gupdb9kt30hfq
    reportDate:
      description: The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.
      in: query
      name: reportDate
      required: true
      schema:
        example: 29-09-2020
        type: string
  schemas:
    AccountCategoriesUpdatedWebhook:
      description: Webhook request body for account categories updated.
      examples:
        - alertId: a9367074-b5c3-42c4-9be4-be129f43577e
          clientId: 5e505642-9024-474d-9434-e5a44f505cc5
          clientName: Peach Inc.
          companyId: f1c35bdc-1546-41b9-baf4-3f31135af968
          data:
            modifiedDate: 2019-08-24T14:15:22Z
          dataConnectionId: 2e9d2c44-f675-40ba-8049-353bfcb5e171
          message: Account categories updated for company f1c35bdc-1546-41b9-baf4-3f31135af968.
          ruleId: 70af3071-65d9-4ec3-b3cb-5283e8d55dac
          ruleType: Account Categories Updated
      properties:
        alertId:
          description: Unique identifier of the alert.
          format: uuid
          type: string
        clientId:
          description: Unique identifier for your client in Codat.
          format: uuid
          type: string
        clientName:
          description: Name of your client in Codat.
          type: string
        companyId:
          $ref: "#/components/parameters/companyId/schema"
        data:
          properties:
            modifiedDate:
              description: The date on which this account categories were last modified in Codat.
              example: 2022-10-23
              title: Date
              type: string
          type: object
        dataConnectionId:
          $ref: "#/components/parameters/connectionId/schema"
        message:
          description: A human readable message about the webhook.
          type: string
        ruleId:
          description: Unique identifier for the rule.
          format: uuid
          type: string
        ruleType:
          description: The type of rule.
          type: string
          x-stoplight:
            id: 34d52a089f08a
      title: Account categories updated webhook
      type: object
    AccountCategory:
      examples:
        - detailType: Cash
          subtype: Current
          type: Asset
        - detailType: GeneralServices
          subtype: Operating
          type: Income
      properties:
        detailType:
          description: Most granular chart of account type.
          type: string
        subtype:
          description: The account subtype.
          type: string
        type:
          description: The top level account type.
          type: string
      title: Account category
      type: object
    Categories:
      items:
        allOf:
          - $ref: "#/components/schemas/AccountCategory"
          - properties:
              detailTypeDescription:
                description: A description of the fully categorized (to detail type) account.
                type: string
              detailTypeDisplayName:
                description: Human readable detailType display name.
                type: string
              subtypeDisplayName:
                description: Human readable subtype display name.
                type: string
            type: object
        examples:
          - detailType: Cash
            detailTypeDescription: Use 'Cash' for cash in the bank or held on premise. This should include overdrawn accounts.
            detailTypeDisplayName: Cash
            subtype: Current
            subtypeDisplayName: Current assets
            type: Asset
          - detailType: GeneralServices
            detailTypeDescription: Use 'General services' for income generated from services the company performs or usage fees charged.
            detailTypeDisplayName: General services
            subtype: Operating
            subtypeDisplayName: Operating
            type: Income
      type: array
      x-internal: true
    CategorisedAccount:
      definitions:
        accountCategoryDeprecated:
          allOf:
            - $ref: "#/components/schemas/AccountCategory"
            - properties:
                modifiedDate:
                  $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
                  description: The date on which this record was last modified in Codat.
              title: ModifiedDate
              type: object
              x-internal: true
          title: Account category
          type: object
        accountRef:
          description: An object containing account reference data.
          properties:
            id:
              description: "'id' from the Accounts data type."
              type: string
            name:
              description: "'name' from the Accounts data type."
              type: string
          title: Account reference
          type: object
      examples:
        - accountRef:
            id: 13d946f0-c5d5-42bc-b092-97ece17923ab
            name: string
          confirmed:
            detailType: Cash
            modifiedDate: 2019-08-24T14:15:22Z
            subtype: Current
            type: Asset
          suggested:
            detailType: Cash
            modifiedDate: 2019-08-24T14:15:22Z
            subtype: Current
            type: Asset
      properties:
        accountRef:
          $ref: "#/components/schemas/CategorisedAccount/definitions/accountRef"
        confirmed:
          $ref: "#/components/schemas/CategorisedAccount/definitions/accountCategoryDeprecated"
        suggested:
          $ref: "#/components/schemas/CategorisedAccount/definitions/accountCategoryDeprecated"
      title: Categorised account
      type: object
    CategorisedAccounts:
      allOf:
        - properties:
            results:
              description: A list confirmed and suggested account categories.
              items:
                $ref: "#/components/schemas/CategorisedAccount"
              type: array
          type: object
        - $ref: "#/components/schemas/PagingInfo"
      x-internal: true
    ConfirmCategories:
      properties:
        categories:
          description: "List of confirmed account categories set manually by the user. "
          items:
            properties:
              accountRef:
                properties:
                  id:
                    description: A unique, persistent identifier for this record
                    examples:
                      - 13d946f0-c5d5-42bc-b092-97ece17923ab
                      - 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
                      - 7110701885
                      - EILBDVJVNUAGVKRQ
                    type: string
                    x-codat-validation:
                      - validator: UniqueWithinConnection
                required:
                  - id
                type: object
                x-stoplight:
                  id: 516bf0ecc4907
              confirmed:
                $ref: "#/components/schemas/AccountCategory"
            type: object
          type: array
      type: object
      x-internal: true
    ConfirmCategory:
      properties:
        confirmed:
          $ref: "#/components/schemas/AccountCategory"
      required:
        - confirmed
      type: object
      x-internal: true
    Currency:
      description: |-
        The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

        ## Unknown currencies

        In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. 

        There are only a very small number of edge cases where this currency code is returned by the Codat system.
      examples:
        - GBP
        - USD
        - EUR
      format: ISO4217
      title: Currency
      type: string
      x-internal: true
    CurrencyRate:
      description: |-
        Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

        Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit.  

        Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). 

        For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places.

        ## Examples with base currency of GBP

        | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) |
        | :--------------- | :------------- | :------------ | :------------------------- |
        | **USD**          | $20            | 0.781         | £15.62                     |
        | **EUR**          | €20            | 0.885         | £17.70                     |
        | **RUB**          | ₽20            | 0.011         | £0.22                      |

        ## Examples with base currency of USD

        | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) |
        | :--------------- | :------------- | :------------ | :------------------------- |
        | **GBP**          | £20            | 1.277         | $25.54                     |
        | **EUR**          | €20            | 1.134         | $22.68                     |
        | **RUB**          | ₽20            | 0.015         | $0.30                      |
      nullable: true
      title: Currency rate
      type: number
    DataIntegrityDetails:
      definitions:
        dataIntegrityMatch:
          properties:
            amount:
              description: The transaction value.
              type: string
            connectionId:
              description: ID GUID representing the connection of the accounting or banking platform.
              format: uuid
              type: string
            currency:
              $ref: "#/components/schemas/Currency"
              description: The currency of the transaction.
            date:
              description: The date of the transaction.
              type: string
            description:
              description: The transaction description.
              type: string
            id:
              description: ID GUID of the transaction.
              type: string
            type:
              description: The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.
              type: string
          type: object
      properties:
        amount:
          description: The transaction value.
          type: number
        connectionId:
          description: ID GUID representing the connection of the accounting or banking platform.
          format: uuid
          readOnly: true
          type: string
        currency:
          $ref: "#/components/schemas/Currency"
          description: The currency of the transaction.
        date:
          $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
          description: The date of the transaction.
        description:
          description: The transaction description.
          type: string
        id:
          description: ID GUID of the transaction.
          type: string
        matches:
          items:
            $ref: "#/components/schemas/DataIntegrityDetails/definitions/dataIntegrityMatch"
          type: array
        type:
          description: The data type of the record.
          type: string
      title: Data integrity details
      type: object
    DataIntegrityStatus:
      allOf:
        - $ref: "#/components/schemas/DataIntegritySummary/definitions/dataIntegrityType"
        - properties:
            amounts:
              $ref: "#/components/schemas/DataIntegrityStatus/definitions/dataIntegrityAmounts"
            connectionIds:
              $ref: "#/components/schemas/DataIntegrityStatus/definitions/dataIntegrityConnectionId"
            dates:
              $ref: "#/components/schemas/DataIntegrityStatus/definitions/dataIntegrityDates"
            statusInfo:
              $ref: "#/components/schemas/DataIntegrityStatus/definitions/dataIntegrityStatusInfo"
          type: object
      definitions:
        dataIntegrityAmounts:
          description: Only returned for transactions. For accounts, there is nothing returned.
          properties:
            currency:
              $ref: "#/components/schemas/Currency"
            max:
              description: Highest value of transaction set.
              type: number
            min:
              description: Lowest value of transaction set.
              type: number
          type: object
        dataIntegrityConnectionId:
          properties:
            source:
              description: An array of strings. The connection IDs for the type specified in the url.
              items:
                type: string
              type: array
            target:
              description: An array of strings. The connection IDs for the type being matched to.
              items:
                type: string
              type: array
          type: object
        dataIntegrityDates:
          description: Only returned for transactions. For accounts, there is nothing returned.
          properties:
            maxDate:
              $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
              description: Latest date of transaction set.
              readOnly: true
            maxOverlappingDate:
              $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
              description: Latest date where transactions exist in both account and banking platforms.
              readOnly: true
            minDate:
              $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
              description: Earliest date of transaction set.
              readOnly: true
            minOverlappingDate:
              $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
              description: Earliest date where transactions exist in both accounting and banking platforms.
              readOnly: true
          type: object
        dataIntegrityStatusInfo:
          properties:
            currentStatus:
              $ref: "#/components/schemas/DataIntegrityStatus/definitions/integrityStatus"
            lastMatched:
              $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
              description: The date the matching algorithm last ran against the company’s data type specified.
              readOnly: true
              type: string
            statusMessage:
              description: Detailed explanation supporting the status value.
              type: string
          type: object
        integrityStatus:
          description: The current status of the most recently run matching algorithm.
          enum:
            - Unknown
            - DoesNotExist
            - Error
            - Complete
          type: string
      examples:
        - amounts:
            currency: GBP
            max: 2450
            min: 130
          connectionIds:
            source:
              - d5a8d1b2-b38a-4e44-8641-548ad43be6bb
              - da8c9f39-8af9-4a98-964b-f1e207942837
            target:
              - 3d7ce25a-c107-44bc-8e0c-36c10bdd14e0
              - a5300eac-01fa-4a77-b5b0-ea0b86a3be69
          dates:
            maxDate: 2021-12-16T12:12:53.441Z
            maxOverlappingDate: 2021-11-27T12:19:33.441Z
            minDate: 2021-09-17T12:09:33.441Z
            minOverlappingDate: 2021-09-30T12:09:13.441Z
          statusInfo:
            currentStatus: Unknown
            lastMatched: 2021-10-24T14:15:22Z
            statusMessage: string
          type: string
      title: Data integrity status
      type: object
    DataIntegritySummary:
      allOf:
        - $ref: "#/components/schemas/DataIntegritySummary/definitions/dataIntegrityType"
        - properties:
            byAmount:
              $ref: "#/components/schemas/DataIntegritySummary/definitions/dataIntegrityByAmount"
            byCount:
              $ref: "#/components/schemas/DataIntegritySummary/definitions/dataIntegrityByCount"
          type: object
      definitions:
        dataIntegrityByAmount:
          properties:
            currency:
              $ref: "#/components/schemas/Currency"
            matchPercentage:
              description: The percentage of the absolute value of transactions of the type specified in the route which have a match.
              type: number
            matched:
              description: The sum of the absolute value of transactions of the type specified in the route which have a match.
              type: number
            total:
              description: The total of unmatched and matched.
              type: number
            unmatched:
              description: The sum of the absolute value of transactions of the type specified in the route which don't have a match.
              type: number
          title: Data integrity by amount
          type: object
        dataIntegrityByCount:
          properties:
            matchPercentage:
              description: The percentage of records of the type specified in the route which have a match.
              type: number
            matched:
              description: The number of records of the type specified in the route which do have a match.
              type: number
            total:
              description: The total of unmatched and matched.
              type: number
            unmatched:
              description: The number of records of the type specified in the route which don't have a match.
              type: number
          title: Data integrity by count
          type: object
        dataIntegrityType:
          properties:
            type:
              description: The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.
              type: string
          type: object
      title: Data integrity summary
      type: object
    Details:
      allOf:
        - properties:
            results:
              items:
                $ref: "#/components/schemas/DataIntegrityDetails"
              type: array
          type: object
        - $ref: "#/components/schemas/PagingInfo"
      x-internal: true
    EnhancedCashFlowTransactions:
      definitions:
        accounts:
          properties:
            accountName:
              description: The name of the account according to the provider.
              type: string
            accountProvider:
              description: The bank or other financial institution providing the account.
              type: string
            accountType:
              description: The type of banking account, e.g. credit or debit.
              type: string
            currency:
              $ref: "#/components/schemas/Currency"
              description: The currency code for the bank account.
            currentBalance:
              description: The balance of the bank account.
              type: number
            platformName:
              description: Name of the banking data source, e.g. "Plaid".
              type: string
            sourceRef:
              $ref: "#/components/schemas/EnhancedCashFlowTransactions/definitions/sourceRef"
          title: Accounts
          type: object
        dataSource:
          properties:
            accounts:
              description: "An array containing bank account data for each connected banking data source that have the following data types enabled: `banking-accounts`, `banking-transactions`."
              items:
                $ref: "#/components/schemas/EnhancedCashFlowTransactions/definitions/accounts"
              type: array
          type: object
        enhancedCashFlowItem:
          properties:
            transactions:
              description: An array of transaction data.
              items:
                $ref: "#/components/schemas/EnhancedCashFlowTransactions/definitions/enhancedCashFlowTransaction"
              type: array
          type: object
        enhancedCashFlowTransaction:
          properties:
            amount:
              description: The bank transaction amount.
              type: number
            currency:
              type: string
            date:
              $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
              description: The date the bank transaction was posted.
            description:
              description: The description of the bank transaction.
              type: string
            id:
              description: The unique identifier of the bank transaction.
              type: string
            sourceRef:
              $ref: "#/components/schemas/EnhancedCashFlowTransactions/definitions/sourceRef"
            transactionCategory:
              $ref: "#/components/schemas/EnhancedCashFlowTransactions/definitions/transactionCategory"
              description: Contains an array of category levels.
          title: Cash flow transaction
          type: object
        sourceRef:
          description: A source reference containing the `sourceType` object "Banking".
          examples:
            - Example:
                value:
                  sourceRef:
                    sourceType: Banking
          properties:
            sourceType:
              type: string
          title: Report source reference
          type: object
        transactionCategory:
          properties:
            confidence:
              description: Returns the confidence of the suggested category for the transaction.
              type: number
            levels:
              description: An array of category levels against an individual transaction.
              items:
                type: string
              type: array
          title: Transaction category
          type: object
      description: ""
      properties:
        dataSources:
          items:
            $ref: "#/components/schemas/EnhancedCashFlowTransactions/definitions/dataSource"
          type: array
        reportInfo:
          $ref: "#/components/schemas/EnhancedInvoicesReport/definitions/reportInfo"
        reportItems:
          items:
            $ref: "#/components/schemas/EnhancedCashFlowTransactions/definitions/enhancedCashFlowItem"
          type: array
      title: Enhanced cash flow transactions
      type: object
    EnhancedInvoicesReport:
      definitions:
        customerRef:
          properties:
            companyName:
              description: "`customerName` from the Customer data type"
              nullable: true
              type: string
            id:
              description: "`id` from the Customers data type"
              minLength: 1
              type: string
          required:
            - id
          type: object
        enhancedInvoiceReportItem:
          properties:
            amountDue:
              type: number
            currency:
              $ref: "#/components/schemas/Currency"
            customerRef:
              $ref: "#/components/schemas/EnhancedInvoicesReport/definitions/customerRef"
            dueDate:
              $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
            id:
              description: ID of the invoice, which may be a GUID but it may be something else depending on the accounting platdform
              type: string
            invoiceNumber:
              type: string
            issueDate:
              $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
            paidOnDate:
              $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
            payments:
              items:
                $ref: "#/components/schemas/EnhancedInvoicesReport/definitions/payment"
              type: array
            status:
              $ref: "#/components/schemas/EnhancedInvoicesReport/definitions/invoiceStatus"
            totalAmount:
              type: number
          title: Enhanced invoice report item
          type: object
        invoiceStatus:
          description: |-
            Current state of the invoice:

            - `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email.
            - `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it (amountDue == totalAmount).
            - `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount (0 < amountDue < totalAmount).
            - `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid (amountDue == 0).
            - `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account.
          enum:
            - Unknown
            - Draft
            - Submitted
            - PartiallyPaid
            - Paid
            - Void
          type: string
        payment:
          allOf:
            - properties:
                accountRef:
                  $ref: "#/components/schemas/CategorisedAccount/definitions/accountRef"
                  description: Account the payment is recorded against in the accounting platform.
                currency:
                  $ref: "#/components/schemas/Currency"
                  description: ISO currency code recorded for the payment in the accounting platform.
                currencyRate:
                  $ref: "#/components/schemas/CurrencyRate"
                customerRef:
                  $ref: "#/components/schemas/EnhancedInvoicesReport/definitions/customerRef"
                  description: Customer the payment is recorded against in the accounting platform.
                date:
                  $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
                  description: Date the payment was recorded in the accounting software.
                id:
                  description: Identifier for the payment, unique to the company in the accounting platform.
                  type: string
                lines:
                  description: An array of payment lines.
                  items:
                    $ref: "#/components/schemas/EnhancedInvoicesReport/definitions/payment/definitions/paymentLine"
                  nullable: true
                  type: array
                metadata:
                  properties:
                    isDeleted:
                      description: Indicates whether the record has been deleted in the third-party system this record originated from.
                      nullable: true
                      type: boolean
                  type: object
                  x-internal: true
                note:
                  description: Any additional information associated with the payment.
                  nullable: true
                  type: string
                paymentMethodRef:
                  description: The Payment Method to which the payment is linked in the accounting platform.
                  properties:
                    id:
                      description: "`id` from the Payment Methods data type"
                      type: string
                    name:
                      description: "`name` from the Payment Methods data type"
                      nullable: true
                      type: string
                  type: object
                reference:
                  description: Friendly reference for the payment.
                  nullable: true
                  type: string
                supplementalData:
                  description: Reference to a configured dynamic key value pair that is unique to the accounting platform. This feature is in private beta, contact us if you would like to learn more.
                  properties:
                    content:
                      additionalProperties:
                        additionalProperties: {}
                        type: object
                      nullable: true
                      type: object
                  type: object
                totalAmount:
                  description: Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account.
                  type: number
              type: object
            - allOf:
                - $ref: "#/components/schemas/CategorisedAccount/definitions/accountCategoryDeprecated/allOf/1"
                - properties:
                    sourceModifiedDate:
                      $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
                      description: The date on which this record was last modified in the originating system
                  title: Source Modified Date
                  type: object
                  x-internal: true
              x-internal: true
          definitions:
            paymentLine:
              properties:
                allocatedOnDate:
                  $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
                  description: The date the payment was allocated.
                amount:
                  description: Amount in the payment currency.
                  type: number
                links:
                  items:
                    $ref: "#/components/schemas/EnhancedInvoicesReport/definitions/payment/definitions/paymentLineLink"
                  nullable: true
                  type: array
              required:
                - amount
              title: Payment Line
              type: object
            paymentLineLink:
              additionalProperties: false
              properties:
                amount:
                  description: |-
                    Amount by which the balance of the linked entity is altered, in the currency of the linked entity.  
                    A negative link amount _reduces_ the outstanding amount on the accounts receivable account.  
                    A positive link amount _increases_ the outstanding amount on the accounts receivable account.
                  nullable: true
                  type: number
                currencyRate:
                  $ref: "#/components/schemas/CurrencyRate"
                id:
                  description: Unique identifier of the transaction represented by the link.
                  type: string
                type:
                  $ref: "#/components/schemas/EnhancedInvoicesReport/definitions/payment/definitions/paymentLinkType"
              required:
                - type
              title: Payment Line Link
              type: object
            paymentLinkType:
              description: |-
                Types of payment line links, either:  
                `Unknown`  
                `Unlinked` - Not used  
                `Invoice` - ID refers to the invoice  
                `CreditNote` - ID refers to the credit note  
                `Refund` - ID refers to the sibling payment  
                `Payment` - ID refers to the sibling payment  
                `PaymentOnAccount` - ID refers to the customer  
                `Other` - ID refers to the customer  
                `Manual Journal`  
                `Discount` - ID refers to the payment
              enum:
                - Unknown
                - Unlinked
                - Invoice
                - CreditNote
                - Other
                - Refund
                - Payment
                - PaymentOnAccount
                - ManualJournal
                - Discount
              title: Payment Link Type
              type: string
          description: |-
            > **Payments or bill payments?**  
            > 
            >  In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/accounting-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/accounting-api#/schemas/Bill) and credit notes against bills.

            > View the coverage for payments in the <a className="external" href="https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=payments" target="_blank">Data coverage explorer</a>.

            ## Overview

            Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/accounting-api#/schemas/CreditNote).

            A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: 

            - A payment made against an invoice, like a credit card, cheque, or cash payment.
            - An allocation of a customer's credit note, either to an invoice or maybe a refund.
            - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account.

            Depending on the payments allowed by the underlying accounting package, some payment types may be combined. Please see the example for more details.

            In Codat, a payment contains details of:

            - When the payment was recorded in the accounting system.
            - How much it is for and in what currency that amount is in.
            - Who the payment was _paid by_ – the _customer_.
            - The payment method used.
            - The breakdown of the types of payments – the _line items_.

            Payments is a child data type of [account transactions](https://docs.codat.io/accounting-api#/schemas/AccountTransaction).

            ## Payment types

            ## Payment of an invoice

            A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties:

            - An _amount_ that indicates the amount of the invoice that was paid. This is always positive.
            - A **links** array containing one element with the following properties:
              - A **type** that indicates the type of **link**, in this case an `Invoice`.
              - An **id** that contains the ID of the invoice that was paid.
              - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`.

            The **amount** field on the **line** equals the **totalAmount** on the payment.

            ## Payment of multiple invoices

            A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books:

            - The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice).
            - The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available.

            Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment.

            ## Payments and refunds on account

            A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties:

            - A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive.
            - A **links** array containing one element with the following properties:
            - A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`.
            - The **id** containing the ID of the customer.
            - The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund.

            It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above.

            ## Using a credit note to pay an invoice

            The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties:

            - An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other.
            - A **links** array containing two elements:
              - The first **link** has:
                - A **type** that indicates the type of **link**, in this case an `Invoice`.
                - An **id** that contains the ID of the invoice that was paid.
              - The second **link** has:
                - A **type** that indicates the type of **link**, in this case a `CreditNote`.
                - An **id** that contains the ID of the credit note used by this payment.

            The **amount** field on the **line** equals the **totalAmount** on the payment.

            ## Refunding a credit note

            A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties:

            - An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund.
            - A **links** array that contains one element with the following properties:
              - A **type** that indicates the type of **link**, in this case a `CreditNote`.
              - An **id** that contains the ID of the credit note that was refunded.

            The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable.

            ## Refunding a payment

            If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: 

            - One for the incoming over payment.
            - Another for the outgoing refund.

            The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties:

            - An **amount** that indicates the amount that was refunded. This is always negative.
            - A **links** array that contains one element with the following properties:
              - A **type** that indicates the type of **link**, in this case a `Payment`.
              - An **id** that contains the ID of the payment that was refunded.

            The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable.

            The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. 

            For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: 

            - One for £1,000 linked to the invoice that was paid.
            - Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment.

            The **line** linked to the payment has the following properties:

            - An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund.
            - A **links** array containing one element with the following properties:
              - A **type** that indicates the type of **link**, in this case a `Refund`.
              - An **id** that contains the ID of the payment that refunded this line.

            > **Support for linked payments**
            > 
            > Not all accounting packages support linking payments in this way. In some platforms, you may see a payment on account and a refund on account.

            ## Foreign currencies

            There are two types of currency rate that are included in the payments data type: 

            Payment currency rate: 

            - Base currency of the accounts receivable account.
            - Foreign currency of the payment.

            Payment line link currency rate: 

            - Base currency of the item the link represents.
            - Foreign currency of the payment.

            These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either:

            - The base currency for the accounts receivable account. 
            - The currency of the item.

            ```json title="Currency rate example"
            {
                "id": "123",
                "note": ""
                "totalAmount": 99.99,
                "currency": "GBP",
                "lines": [
                    {
                        "amount": 99.99,
                        "links": [
                            {
                                "type": "Invoice",
                                "id": "178",
                                "amount": -50,
                                "currencyRate":  1.9998,
                            }
                        ]
                    }
                ]
            }
            ```



            ## Example data

            > **Object properties**
            > 
            > For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments).

            ## Simple examples

            ```json title="Payment for invoice"
            {
                "totalAmount": 1000,
                "lines": [
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "x",
                                "amount" : -1000
                            }
                        ]
                    }
                ]
            }
            ```



            ```json title="Allocation of credit note"
            {
                "totalAmount": 0,
                "lines": [
                    {
                        "amount" : 0,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "x",
                                "amount" : -1000
                            },
                            {
                                "type" : "CreditNote",
                                "id" : "y",
                                "amount" : 1000
                            }
                        ]
                    }
                ]
            }
            ```



            ```json title="Payment of invoice and payment on account"
            {
                "totalAmount": 2000,
                "lines": [
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "x",
                                "amount" : -1000
                            }
                        ]
                    },
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "PaymentOnAccount",
                                "id" : "y",
                                "amount" : -1000
                            }
                        ]
                    }
                ]
            }
            ```



            ```json title="Refund of credit note"
            {
                "totalAmount": -1000,
                "lines": [
                    {
                        "amount" : -1000,
                        "links" : [
                            {
                                "type" : "CreditNote",
                                "id" : "y",
                                "amount" : 1000
                            }
                        ]
                    }
                ]
            }
            ```



            ```json title="Refund on accounts receivable account"
            {
                "totalAmount": -1000,
                "lines": [
                    {
                        "amount" : -1000,
                        "links" : [
                            {
                                "type" : "PaymentOnAccount",
                                "id" : "y",
                                "amount" : 1000
                            }
                        ]
                    }
                ]
            }
            ```



            ```json title="Linked refund on accounts receivable account"
            {
                "id" : "payment-001",
                "totalAmount": 1000,
                "lines": [
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "Refund",
                                "id" : "refund-001",
                                "amount" : -1000
                            }
                        ]
                    }
                ]
            }
            {
                "id" : "refund-001",
                "totalAmount": -1000,
                "lines": [
                    {
                        "amount" : -1000,
                        "links" : [
                            {
                                "type" : "Payment",
                                "id" : "payment-001",
                                "amount" : 1000
                            }
                        ]
                    }
                ]
            }
            ```



            ```json title="Using a credit note and cash to pay an invoice"
            {
                "totalAmount": 250,
                "lines": [
                    {
                        "amount": 0,
                        "links": [
                            {
                                "type": "Invoice",
                                "id": "x",
                                "amount": -750
                            }, 
                            {
                                "type": "CreditNote",
                                "id": "y",
                                "amount": 750
                            }
                        ]
                    },
                    {
                        "amount": 250,
                        "links": [
                            {
                                "type": "Invoice",
                                "id": "x",
                                "amount": -250
                            }
                        ]
                    }
                ]
            }
            ```



            ## Complex examples

            ```json title="Use two credit notes and 1000 in to "bank" (cash, cheque etc.) to pay invoice"
            {
                "totalAmount": 1000,
                "lines": [
                    {
                        "amount" : 0,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "x",
                                "amount" : -1000
                            },
                            {
                                "type" : "CreditNote",
                                "id" : "y",
                                "amount" : 1000
                            }
                        ]
                    },
                    {
                        "amount" : 0,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "x",
                                "amount" : -1000
                            },
                            {
                                "type" : "CreditNote",
                                "id" : "z",
                                "amount" : 1000
                            }
                        ]
                    },
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "x",
                                "amount" : -1000
                            }
                        ]
                    }
                ]
            }
            ```



            ```json title="Pay an invoice with two credit notes and cash, with 1000 left 'on account'"
            {
                "totalAmount": 2000,
                "lines": [
                    {
                        "amount" : 0,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "x",
                                "amount" : -1000
                            },
                            {
                                "type" : "CreditNote",
                                "id" : "y",
                                "amount" : 1000
                            }
                        ]
                    },
                    {
                        "amount" : 0,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "x",
                                "amount" : -1000
                            },
                            {
                                "type" : "CreditNote",
                                "id" : "z",
                                "amount" : 1000
                            }
                        ]
                    },
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "x",
                                "amount" : -1000
                            }
                        ]
                    },
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "PaymentOnAccount",
                                "id" : "customer-001",
                                "amount" : -1000
                            }
                        ]
                    }
                ]
            }
            ```



            ```json title="Two credit notes pay two invoices with no allocation amount specified"
            {
                "totalAmount": 0,
                "lines": [
                    {
                        "amount" : 0,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "w",
                                "amount" : -1000
                            },
                            {
                                "type" : "Invoice",
                                "id" : "x",
                                "amount" : -1000
                            },
                            {
                                "type" : "CreditNote",
                                "id" : "y",
                                "amount" : 1000
                            },
                            {
                                "type" : "CreditNote",
                                "id" : "z",
                                "amount" : 1000
                            }
                        ]
                    }
                ]
            }
            ```



            ```json title="Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash"
            {
                "totalAmount": 2000,
                "lines": [
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "w",
                                "amount" : -1000
                            },
                            {
                                "type" : "Invoice",
                                "id" : "x",
                                "amount" : -1000
                            },
                            {
                                "type" : "Invoice",
                                "id" : "u",
                                "amount" : -1000
                            },
                            {
                                "type" : "CreditNote",
                                "id" : "y",
                                "amount" : 1000
                            },
                            {
                                "type" : "CreditNote",
                                "id" : "z",
                                "amount" : 1000
                            }
                        ]
                    },
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "Refund",
                                "id" : "refund-001",
                                "amount" : -1000
                            }
                        ]
                    }
                ]
            }
            {
                "id" : "refund-001",
                "totalAmount": -1000,
                "lines": [
                    {
                        "amount" : -1000,
                        "links" : [
                            {
                                "type" : "Payment",
                                "id" : "payment-001",
                                "amount" : 1000
                            }
                        ]
                    }
                ]
            }
            ```



            In this example, a payment on account is used to pay the same invoice in January and again in February.

            ```json title="January"
            {
                "id": "001",
                "totalAmount": 5000,
                "date" : "1901-01-01",
                "lines": [
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "Invoice-x",
                                "amount" : -1000
                            }
                        ]
                    },
                    {
                        "amount" : 4000,
                        "links" : [
                            {
                                "type" : "PaymentOnAccount",
                                "id" : "PaymentOnAccount-y",
                                "amount" : -4000
                            }
                        ]
                    }
                ]
            }
            ```



            ```json title="February"
            {
                "id": "001",
                "totalAmount": 5000,
                "date" : "1901-02-01",
                "lines": [
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "Invoice-x",
                                "amount" : -1000
                            }
                        ]
                    },
                    {
                        "amount" : 1000,
                        "links" : [
                            {
                                "type" : "Invoice",
                                "id" : "Invoice-y",
                                "amount" : -1000
                            }
                        ]
                    },
                    {
                        "amount" : 3000,
                        "links" : [
                            {
                                "type" : "PaymentOnAccount",
                                "id" : "PaymentOnAccount-y",
                                "amount" : -3000
                            }
                        ]
                    }
                ]
            }
            ```



            ```json title="Two credit notes and some cash pay two invoices with no allocations specified"
            {
                "totalAmount": 500,
                "lines": [
                    {
                        "amount": 500,
                        "links": [{
                                "type": "Invoice",
                                "id": "a",
                                "amount": -1000
                            }, {
                                "type": "Invoice",
                                "id": "b",
                                "amount": -1000
                            }, {
                                "type": "CreditNote",
                                "id": "y",
                                "amount": 750
                            },{
                                "type": "CreditNote",
                                "id": "z",
                                "amount": 750
                            }
                        ]
                    }
                ]
            }
            ```
          required:
            - date
          title: Payment
          type: object
        reportInfo:
          description: Report additional information, which is specific to Assess reports
          examples:
            - Example 1:
                value:
                  companyName: string
                  generatedDate: 2023-01-26T07:36:40.487Z
                  pageNumber: 0
                  pageSize: 0
                  reportName: string
                  totalResults: 0
          properties:
            companyName:
              description: The name of the company being queried.
              type: string
            generatedDate:
              description: Date the report was generated
              type: string
            pageNumber:
              description: The number of the page queried.
              type: integer
            pageSize:
              description: The number of transactions returned per page.
              type: integer
            reportName:
              description: Name of the report
              type: string
            totalResults:
              description: The total number of transactions available for a company for the period specified in the query string.
              type: integer
          title: Report information
          type: object
      description: The enhanced invoices report takes the key elements of the Invoices report verifying those marked as paid in the accounting platform have actually been paid by matching with the bank statement.
      properties:
        reportInfo:
          $ref: "#/components/schemas/EnhancedInvoicesReport/definitions/reportInfo"
        reportItems:
          items:
            properties:
              invoices:
                items:
                  $ref: "#/components/schemas/EnhancedInvoicesReport/definitions/enhancedInvoiceReportItem"
                type: array
            type: object
          type: array
      title: Enhanced invoices report
      type: object
    EnhancedReport:
      definitions:
        accountCategoryLevel:
          description: An object containing an ordered list of account category levels.
          properties:
            confidence:
              description: Confidence level of the category. This will only be populated where `status` is `Suggested`.
              type: number
            levelName:
              description: Account category name.
              type: string
          title: Account category level
          type: object
        enhancedReportAccountCategory:
          descrciption: An object containing the suggested or confirmed account categories, up to five levels.
          properties:
            levels:
              items:
                $ref: "#/components/schemas/EnhancedReport/definitions/accountCategoryLevel"
              type: array
            status:
              description: Returns a status of "Suggested" or "Confirmed". If an account has a confirmed category, it will replace any suggested category returned.
              type: string
          title: Account category
          type: object
        enhancedReportInfo:
          properties:
            companyName:
              description: Name of the company queried.
              type: string
            currency:
              $ref: "#/components/schemas/Currency"
              description: Currency of the P&L/Balance sheet.
            generatedDate:
              $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
              description: Returns the YYYY-MM-DD datetime of report generation.
            reportName:
              description: The name of the report.
              type: string
          type: object
      examples:
        - reportInfo:
            companyName: ABC LTD
            generatedDate: 2022-01-01
            reportName: EnhancedProfitAndLossAccounts
          reportItems:
            - accountCategory:
                levels:
                  - confidence: 0.95
                    levelName: Income
                  - confidence: 0.9
                    levelName: Revenue
                status: Suggested
              accountId: 13931cbf-ea06-4d6e-9538-a8457fa66011
              accountName: Sales UK
              balance: 70
              date: 2022-01-01
            - accountCategory:
                lastUpdated: 2022-01-02
                levels:
                  - confidence: 0.95
                    levelName: Income
                  - confidence: 0.9
                    levelName: Revenue
                status: Suggested
              accountId: 13931cbf-ea06-4d6e-9538-a8457fa66011
              accountName: Sales US
              balance: 30
              date: 2022-01-01
            - accountCategory:
                lastUpdated: 2022-01-02
                levels:
                  - confidence: 0.95
                    levelName: Income
                  - confidence: 0.95
                    levelName: Revenue
                  - confidence: 0.8
                    levelName: Online
                status: Suggested
              accountId: 13931cbf-ea06-4d6e-9538-a8457fa66011
              accountName: Amazon
              balance: 70
              date: 2022-01-01
      properties:
        reportInfo:
          $ref: "#/components/schemas/EnhancedReport/definitions/enhancedReportInfo"
        reportItems:
          description: An array of report items.
          items:
            properties:
              accountCategory:
                $ref: "#/components/schemas/EnhancedReport/definitions/enhancedReportAccountCategory"
              accountId:
                description: The unique account ID.
                type: string
              accountName:
                description: Name of the account.
                type: string
              balance:
                description: Balance of the account as reported on the profit and loss or Balance sheet.
                type: number
              date:
                $ref: "#/components/schemas/ExcelStatus/properties/lastGenerated"
                description: Last date of the period.
            title: Report item
            type: object
          type: array
      title: Enhanced report
      type: object
    ExcelStatus:
      examples:
        Example 1:
          value:
            errorMessage: string
            fileSize: 0
            inProgress: true
            lastGenerated: 2023-01-25T22:36:05.125Z
            lastInvocationId: 3fa85f64-5717-4562-b3fc-2c963f66afa6
            queued: 2023-01-25T22:36:05.125Z
            reportType: string
            success: true
      properties:
        errorMessage:
          type: string
        fileSize:
          type: integer
        inProgress:
          type: boolean
        lastGenerated:
          description: |-
            In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example:

            ```
            2020-10-08T22:40:50Z
            2021-01-01T00:00:00
            ```



            When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

            - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
            - Unqualified local time: `2021-11-15T01:00:00`
            - UTC time offsets: `2021-11-15T01:00:00-05:00`

            > Time zones
            > 
            > Not all dates from Codat will contain information about time zones.  
            > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
          example: 2022-10-23T00:00:00Z
          title: Date time
          type: string
        lastInvocationId:
          type: string
        queued:
          type: string
        reportType:
          type: string
        success:
          type: boolean
      title: Excel status
      type: object
    FinancialMetrics:
      definitions:
        assessErrorDetails:
          additionalProperties:
            items:
              type: string
            type: array
          description: Dictionary list outlining the missing properties or allowed values.
          examples:
            - missingData:
                - Expense.Operating.Interest
                - Expense.NonOperating.Interest
          title: Assess error details
          type: object
        financialMetric:
          description: ""
          properties:
            errors:
              items:
                properties:
                  details:
                    $ref: "#/components/schemas/FinancialMetrics/definitions/assessErrorDetails"
                  message:
                    description: Description of the error.
                    example: There are uncategorized accounts IDs, see details.
                    type: string
                  type:
                    description: Metric level error.
                    enum:
                      - UncategorizedAccounts
                      - MissingInputData
                      - InputDataError
                    type: string
                type: object
              type: array
            key:
              enum:
                - Unknown
                - EBITDA
                - DebtServiceCoverageRatio
                - CurrentRatio QuickRatio
                - GrossProfitMargin
                - FixedChargeCoverageRatio
                - WorkingCapital
                - FreeCashFlow
                - NetProfitMargin
                - ReturnOnAssetsRatio
                - ReturnOnEquityRatio
                - OperatingProfitMargin
                - DeptToEquity
                - DebtToAssets
                - InterestCoverageRatio
                - CashRatio
                - InventoryTurnoverRatio
                - AssetTurnoverRatio
                - WorkingCapitalTurnoverRatio
                - DaysSalesOutstanding
                - DaysPayablesOutstanding
              type: string
            metricUnit:
              enum:
                - Ratio
                - Money
              type: string
            name:
              description: Metric name.
              type: string
            periods:
              items:
                properties:
                  errors:
                    items:
                      properties:
                        details:
                          $ref: "#/components/schemas/FinancialMetrics/definitions/assessErrorDetails"
                        massage:
                          description: Description of the error.
                          example: Missing account data
                          type: string
                        type:
                          description: Period error type.
                          enum:
                            - MissingAccountData
                            - DatesOutOfRange
                          type: string
                      type: object
                    type: array
                  fromDate:
                    description: The date from which the report starts.
                    format: date
                    type: string
                  inputs:
                    items:
                      properties:
                        name:
                          description: The name of the metric input e.g. “Current Assets”, “Capital Expenditure”.
                          type: string
                        value:
                          description: The positive or negative number of the input value.
                          type: number
                      type: object
                    type: array
                  toDate:
                    description: The date on which the report ends (inclusive of day).
                    format: date
                    type: string
                  value:
                    description: |-
                      The top level metric value that is calculated for the specified period. 

                      If the system cannot calculate for that period, the value will be null. The system will still show the metric inputs.
                    type: number
                type: object
              type: array
          title: Financial metric
          type: object
        financialMetricError:
          properties:
            message:
              example: Account categories data has not been synced
              type: string
            type:
              enum:
                - DataNotSynced
                - DataNotSupported
                - DataSyncFailed
                - DataTypeNotEnabled
              type: string
          type: object
      properties:
        currency:
          $ref: "#/components/schemas/Currency"
        errors:
          description: If there are no errors, an empty array is returned.
          items:
            $ref: "#/components/schemas/FinancialMetrics/definitions/financialMetricError"
          type: array
        metrics:
          items:
            $ref: "#/components/schemas/FinancialMetrics/definitions/financialMetric"
          type: array
        periodUnit:
          enum:
            - Month
            - Week
            - Day
          type: string
      title: Enhanced financial metrics
      type: object
    HalRef:
      properties:
        href:
          format: uri-reference
          type: string
      title: Hypertext reference
      type: object
      x-internal: true
    Links:
      examples:
        - current:
            href: /companies/{id}/data/{dataType}?page=1&pageSize=10
          self:
            href: /companies/{id}/data/{dataType}
      properties:
        current:
          $ref: "#/components/schemas/HalRef"
        next:
          $ref: "#/components/schemas/HalRef"
        previous:
          $ref: "#/components/schemas/HalRef"
        self:
          $ref: "#/components/schemas/HalRef"
      required:
        - self
        - current
      type: object
      x-internal: true
    PagingInfo:
      examples:
        - _links:
            current:
              href: /companies/{id}/data/{dataType}?page=1&pageSize=10
            pageNumber: 1
            pageSize: 10
            self:
              href: /companies/{id}/data/{dataType}
            totalResults: 1
      properties:
        _links:
          $ref: "#/components/schemas/Links"
        pageNumber:
          type: integer
        pageSize:
          type: integer
        totalResults:
          type: integer
      required:
        - pageNumber
        - pageSize
        - totalResults
        - _links
      type: object
      x-internal: true
    Report:
      definitions:
        reportComponent:
          properties:
            components:
              items:
                $ref: "#/components/schemas/Report/definitions/reportComponent"
              type: array
            dimension:
              type: integer
            dimensionDisplayName:
              type: string
            item:
              type: integer
            itemDisplayName:
              type: string
            measures:
              items:
                $ref: "#/components/schemas/Report/definitions/reportComponentMeasure"
              type: array
          title: Report component
          type: object
        reportComponentMeasure:
          properties:
            index:
              type: integer
            measureDisplayName:
              type: string
            value:
              type: number
          type: object
        reportDimension:
          properties:
            displayName:
              type: string
            index:
              type: integer
            items:
              items:
                properties:
                  index:
                    type: integer
                type: object
              type: array
            type:
              type: string
          title: Dimension
          type: object
        reportError:
          properties:
            details:
              additionalProperties:
                items:
                  type: string
                type: array
              type: object
            message:
              type: string
            type:
              type: string
          title: Error
          type: object
        reportMeasure:
          properties:
            displayName:
              type: string
            index:
              type: integer
            type:
              type: string
            units:
              type: string
          title: Measure
          type: object
      description: |-
        Assess reports follow a consistent structure. Reports contain four sections of information:

        1. Report definition information such as:
          a. The report info (e.g. enhanced_profit_and_loss).
          b. The display name of the report (e.g. Enhanced Profit and Loss).
        2. Information about the dimension contained in the reports such as:
          a. The type of dimension (e.g. datetime, recordRef).
          b. The display name of the dimension (e.g. Period, Category type, Category sub type).
          c. The details about each item within the dimension (e.g. displayName:"Jan 2022", start:"...", end:"...", id:"...", name:"...").
        3. Information about the measures contained in the report such as:
          a. The display name of the measure (e.g. value of account, percentage change).
          b. The type of the measure (e.g. currency, percentage).
          c. The unit of the measure (e.g. %, GBP).
        4. The data for the report. When the *includeDisplayName* parameter is set to *true*, it shows the *dimensionDisplayName* and *itemDisplayName* to make the data human-readable. The default setting for *includeDisplayName* is *false*.

        Reports can be rendered as follows (ordering is implicit rather than explicit):

        ![A table showing an example of how a report can be rendered](https://files.readme.io/1fa20ca-Report1.png)

        # Data model

        ## Dimensions
      properties:
        dimensions:
          items:
            $ref: "#/components/schemas/Report/definitions/reportDimension"
          type: array
        errors:
          items:
            $ref: "#/components/schemas/Report/definitions/reportError"
          type: array
        measures:
          items:
            $ref: "#/components/schemas/Report/definitions/reportMeasure"
          type: array
        reportData:
          items:
            $ref: "#/components/schemas/Report/definitions/reportComponent"
          type: array
        reportInfo:
          additionalProperties:
            type: string
          type: object
      title: Assess report
      type: object
      x-examples:
        Example 1:
          dimensions:
            - displayName: string
              index: 0
              items:
                - index: 0
              type: string
          errors:
            - details:
                additionalProp1:
                  - string
                additionalProp2:
                  - string
                additionalProp3:
                  - string
              message: string
              type: DatesOutOfRange
          measures:
            - displayName: string
              index: 0
              type: string
              units: string
          reportData:
            - components:
                - string
              dimension: 0
              dimensionDisplayName: string
              item: 0
              itemDisplayName: string
              measures:
                - index: 0
                  measureDisplayName: string
          reportInfo:
            additionalProp1: string
            additionalProp2: string
            additionalProp3: string
    Status:
      properties:
        metadata:
          items:
            $ref: "#/components/schemas/DataIntegrityStatus"
          type: array
      type: object
      x-internal: true
    Summaries:
      properties:
        summaries:
          items:
            $ref: "#/components/schemas/DataIntegritySummary"
          type: array
      type: object
      x-internal: true
  securitySchemes:
    auth_header:
      description: The word "Basic" followed by a space and your API Key, base64 encoded, which can be found [here](https://app.codat.io/developers/api-keys)
      in: header
      name: Authorization
      type: apiKey
webhooks:
  Account categories updated:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AccountCategoriesUpdatedWebhook"
        description: Triggered anytime that Codat updates the suggested fields or a user updates the confirmed fields.
      responses:
        "200":
          description: Return a 200 status to indicate that the webhook was received successfully.
x-speakeasy-retries:
  backoff:
    exponent: 1.5
    initialInterval: 500
    maxElapsedTime: 3600000
    maxInterval: 60000
  retryConnectionErrors: true
  statusCodes:
    - 408
    - 429
    - 5XX
  strategy: backoff
x-stoplight:
  id: tno0jr6q5xi1y
