@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Assess API
@base https://api.codat.io
@version 1.0
@auth ApiKey Authorization in header
@endpoints 20
@toc data(12), companies(8)

@group data
@endpoint GET /data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/status
@returns(200) {metadata: [map]}
@errors {401, 402, 403, 404, 429, 500, 503}

@endpoint GET /data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/summaries
@optional {query: str}
@returns(200) {summaries: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/details
@optional {page: int(int32)=1, pageSize: int(int32)=100, query: str, orderBy: str}
@returns(200)
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endgroup

@group companies
@endpoint GET /companies/{companyId}/reports/enhancedProfitAndLoss/accounts
@required {reportDate: str}
@optional {numberOfPeriods: int}
@returns(200) {reportInfo: map{currency: str(ISO4217), reportName: str, companyName: str, generatedDate: str}, reportItems: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /companies/{companyId}/reports/enhancedBalanceSheet/accounts
@required {reportDate: str}
@optional {numberOfPeriods: int}
@returns(200) {reportInfo: map{currency: str(ISO4217), reportName: str, companyName: str, generatedDate: str}, reportItems: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /companies/{companyId}/reports/enhancedCashFlow/transactions
@optional {page: int(int32)=1, pageSize: int(int32)=100, query: str}
@returns(200) {reportInfo: map{pageNumber: int, pageSize: int, totalResults: int, reportName: str, companyName: str, generatedDate: str}, dataSources: [map], reportItems: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /companies/{companyId}/reports/enhancedInvoices
@optional {page: int(int32)=1, pageSize: int(int32)=100, query: str}
@returns(200) {reportInfo: map{pageNumber: int, pageSize: int, totalResults: int, reportName: str, companyName: str, generatedDate: str}, reportItems: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endgroup

@group data
@endpoint GET /data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/revenue
@required {reportDate: str, periodLength: int, numberOfPeriods: int, periodUnit: str(Day/Week/Month/Year)}
@optional {includeDisplayNames: bool}
@returns(200) {reportInfo: map, dimensions: [map], measures: [map], reportData: [map], errors: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/orders
@required {reportDate: str, periodLength: int, numberOfPeriods: int, periodUnit: str(Day/Week/Month/Year)}
@optional {includeDisplayNames: bool}
@returns(200) {reportInfo: map, dimensions: [map], measures: [map], reportData: [map], errors: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/refunds
@required {reportDate: str, periodLength: int, numberOfPeriods: int, periodUnit: str(Day/Week/Month/Year)}
@optional {includeDisplayNames: bool}
@returns(200) {reportInfo: map, dimensions: [map], measures: [map], reportData: [map], errors: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/customerRetention
@required {reportDate: str, periodLength: int, numberOfPeriods: int, periodUnit: str(Day/Week/Month/Year)}
@optional {includeDisplayNames: bool}
@returns(200) {reportInfo: map, dimensions: [map], measures: [map], reportData: [map], errors: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/lifetimeValue
@required {reportDate: str, periodLength: int, numberOfPeriods: int, periodUnit: str(Day/Week/Month/Year)}
@optional {includeDisplayNames: bool}
@returns(200) {reportInfo: map, dimensions: [map], measures: [map], reportData: [map], errors: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /data/companies/{companyId}/connections/{connectionId}/assess/accountingMetrics/marketing
@required {reportDate: str, periodLength: int, numberOfPeriods: int, periodUnit: str(Day/Week/Month/Year)}
@optional {includeDisplayNames: bool, showInputValues: bool}
@returns(200) {reportInfo: map, dimensions: [map], measures: [map], reportData: [map], errors: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint POST /data/companies/{companyId}/assess/excel
@required {reportType: str(assess/audit/enhancedFinancials/enhancedInvoices/enhancedCashFlow)}
@returns(200) {lastGenerated: str, inProgress: bool, queued: str, success: bool, errorMessage: str, lastInvocationId: str, reportType: str, fileSize: int?}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /data/companies/{companyId}/assess/excel
@required {reportType: str(assess/audit/enhancedFinancials/enhancedInvoices/enhancedCashFlow)}
@returns(200) {lastGenerated: str, inProgress: bool, queued: str, success: bool, errorMessage: str, lastInvocationId: str, reportType: str, fileSize: int?}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /data/companies/{companyId}/assess/excel/download
@required {reportType: str(assess/audit/enhancedFinancials/enhancedInvoices/enhancedCashFlow)}
@returns(200)
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endgroup

@group companies
@endpoint POST /companies/{companyId}/reports/liabilities/loans/transactions
@returns(202)
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint GET /companies/{companyId}/reports/liabilities/loans/transactions
@returns(200) {reportInfo: map{pageNumber: int, pageSize: int, totalResults: int, reportName: str, companyName: str, generatedDate: str}, reportItems: [map]}
@errors {400, 401, 402, 403, 404, 429, 500, 503}

@endpoint POST /companies/{companyId}/reports/liabilities/loans
@returns(202)
@errors {401, 402, 403, 404, 429, 500, 503}

@endpoint GET /companies/{companyId}/reports/liabilities/loans
@returns(200) {reportInfo: map{reportName: str, companyName: str, generatedDate: str}, reportItems: [map]}
@errors {401, 402, 403, 404, 429, 500, 503}

@endgroup

@end
