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

# Export P&L comparison as CSV

> Exports a profit and loss comparison report as a CSV file. Returns a pre-signed URL for downloading the generated CSV file.



## OpenAPI

````yaml post /v1/businesses/{businessId}/reports/profit-and-loss/exports/comparison-csv
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/reports/profit-and-loss/exports/comparison-csv:
    post:
      tags: []
      summary: Export P&L comparison as CSV
      description: >-
        Exports a profit and loss comparison report as a CSV file. Returns a
        pre-signed URL for downloading the generated CSV file.
      operationId: business.reports.profit-and-loss.exports.comparison-csv.post
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business to export the P&L comparison for.
          required: true
          schema:
            type: string
        - name: Content-Type
          in: header
          description: Content-Type must be set to application/json.
          schema:
            type: string
        - name: money_format
          in: query
          description: Format for monetary values in the export.
          schema:
            type: string
            enum:
              - DOLLAR_STRING
              - CENTS_INTEGER
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProfitAndLossComparisonRequest'
      responses:
        '200':
          description: Pre-signed URL for downloading the CSV export.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/S3PresignedUrl'
        '400':
          description: >-
            P&L not yet reconciled: one or more of the requested time periods is
            not closed or reconciled and cannot be displayed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: >-
            Business id is not found. This indicates the business id is invalid
            or the business has been archived.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      deprecated: false
components:
  schemas:
    ProfitAndLossComparisonRequest:
      type: object
      properties:
        periods:
          $ref: '#/components/schemas/ProfitAndLossComparisonPeriods'
        tag_filters:
          type: array
          items:
            $ref: '#/components/schemas/TagComparisons'
          nullable: true
        reporting_basis:
          $ref: '#/components/schemas/ReportingBasis'
          nullable: true
        structure:
          $ref: '#/components/schemas/PnlTemplates'
          nullable: true
    S3PresignedUrl:
      type: object
      properties:
        type:
          type: string
          description: Resource type. Value will be 'S3_Presigned_Url'.
          example: S3_Presigned_Url
        presignedUrl:
          type: string
          description: Pre-signed URL to download a document.
          example: >
            https://example-bucket.s3.amazonaws.com/example-object?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=FAKEAWSACCESSKEY%2F20240710%2Fus-west-1%2Fs3%2Faws4_request&X-Amz-Date=20240710T000000Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=FAKESIGNATURE1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
        fileType:
          type: string
          description: The file type of the document.
          example: csv
      description: A pre-signed URL to download a document.
    ApiError:
      type: object
      description: An error object returned in API error responses.
      properties:
        type:
          $ref: '#/components/schemas/ApiErrorType'
          description: >-
            A fixed category for the error, helpful for categorizing and
            processing errors.
        description:
          type: string
          description: A human-readable error description.
        error_enum:
          $ref: '#/components/schemas/ApiEnumErrorType'
          description: >-
            A stable, machine-readable identifier for programmatically handling
            specific error conditions. Only present for 4xx client errors—not
            included for 5xx server errors. Use this instead of parsing the
            description field, as enum values remain stable across API versions.
          nullable: true
        meta:
          type: object
          description: Optional additional information about the error.
          nullable: true
      required:
        - type
        - description
    ProfitAndLossComparisonPeriods:
      type: object
      oneOf:
        - $ref: '#/components/schemas/Months'
        - $ref: '#/components/schemas/Years'
        - $ref: '#/components/schemas/DateRanges'
      discriminator:
        propertyName: type
        mapping:
          Comparison_Months:
            $ref: '#/components/schemas/Months'
          Comparison_Years:
            $ref: '#/components/schemas/Years'
          Comparison_DateRanges:
            $ref: '#/components/schemas/DateRanges'
    TagComparisons:
      type: object
      properties:
        required_tags:
          type: array
          items:
            $ref: '#/components/schemas/TagKeyValue'
    ReportingBasis:
      type: string
      enum:
        - ACCRUAL
        - CASH
    PnlTemplates:
      type: string
      enum:
        - DEFAULT
        - TRUCKING
        - MEDSPA
        - MEDSPA_NO_LICENSING
        - CITRUS
        - CITRUS_NO_LICENSING
        - FLORIST
    ApiErrorType:
      type: string
      enum:
        - ResourceArchived
        - AuthFailure
        - Plaid
        - Stripe
        - InvalidState
        - ResourceNotFound
        - InvalidParameters
        - JsonSerialization
        - Unknown
        - BadRequest
        - PaginationCursor
        - Conflict
        - LedgerOperationFailed
    ApiEnumErrorType:
      type: string
      description: >-
        Stable enum values for programmatic error handling. Only present in 4xx
        error responses.
      enum:
        - AccessCodeInvalid
        - BalanceSheetDoesNotBalance
        - BalanceSheetMissingAccount
        - BankStatementParserError
        - BillStateError
        - BulkCategorizeFailure
        - BulkMatchFailure
        - BusinessTaskAlreadyCompleted
        - BusinessTaskDeleted
        - CalendlyOAuthError
        - CallBookingError
        - CantUpdateTransactionInCustomerPayout
        - CantUpdateTransactionInVendorPayout
        - CheckPayrollConfigNotFound
        - CheckPayrollServiceNotFound
        - ClerkUserAlreadyExists
        - ConflictingQueryParams
        - CustomAccountAlreadyExists
        - CustomTransactionCsvParsingError
        - CustomTransactionUploadFailure
        - CustomerPayoutInputFormatError
        - DoesNotMatchExistingEntity
        - EmptyBatchRequest
        - ExpenseParserError
        - ExternalAccountBalanceReconciliationError
        - ExternalIdConflict
        - InvalidCategory
        - InvalidEffectiveDate
        - InvalidLedgerOperation
        - InvalidMonthlyAverageRange
        - InvalidMultiPartRequest
        - InvalidPaginationCursor
        - InvalidPayload
        - InvoiceDeleted
        - InvoiceNotFound
        - InvoiceReferenceMismatch
        - InvoiceStateError
        - ManualRateLimit
        - MultipleTagKeyFiltersUnsupported
        - NoCognitoUserFound
        - NoOpeningBalanceFound
        - NotYetReconciled
        - OnePasswordApiError
        - OnePasswordItemNotFound
        - OnePasswordVaultNotFound
        - OpenAICategorizationError
        - PaymentLinkInvalid
        - PayrollStateError
        - PeriodIsClosed
        - PeriodNotClosed
        - PhoneNumberAlreadyRegistered
        - PlaidApiError
        - PlaidConnectionBroken
        - PlaidCreateLinkTokenError
        - PlaidCredentialsNotConfigured
        - PlaidExchangePublicTokenError
        - PlaidGetInstitutionByIdError
        - PlaidGetItemError
        - PlaidInvalidEnvironment
        - PlaidItemAlreadyExists
        - PlaidItemNotFound
        - PlaidProcessorApiError
        - PlaidUnlinkItemError
        - QueryParamFormat
        - QueryParamMissing
        - QuickbooksBrokenConnection
        - QuickbooksConnectionAlreadyExists
        - QuickbooksConnectionAlreadySyncing
        - QuickbooksConnectionMissing
        - QuickbooksConnectionNotActivated
        - QuickbooksInvalidRequest
        - QuickbooksInvalidState
        - QuickbooksNoMatchingAccount
        - QuickbooksNonPostingAccountType
        - QuickbooksNotConfigured
        - QuickbooksOAuthCallbackInvalid
        - QuickbooksOAuthError
        - QuickbooksTokenExpired
        - ResourceArchived
        - ScheduleCNotConfigured
        - SmsNotEnabled
        - SpecifiedBadRequest
        - SpecifiedIdNotFound
        - SplitTransactionError
        - StepEvaluationBadRequest
        - StripeConnectAccountIdNotFound
        - StripeCredentialsNotConfigured
        - StripeGetBalanceForConnectAccountFailure
        - StripeRedirectOrRefreshUrlNotConfigured
        - TagFilterNotFound
        - UnexpectedQueryParam
        - UnitAccountsInUse
        - WrongAnswerType
    Months:
      type: object
      properties:
        type:
          type: string
          enum:
            - Comparison_Months
        months:
          type: array
          items:
            $ref: '#/components/schemas/Month'
    Years:
      type: object
      properties:
        type:
          type: string
          enum:
            - Comparison_Years
        years:
          type: array
          items:
            $ref: '#/components/schemas/Year'
    DateRanges:
      type: object
      properties:
        type:
          type: string
          enum:
            - Comparison_Date_Ranges
        date_ranges:
          type: array
          items:
            $ref: '#/components/schemas/DateRange'
    TagKeyValue:
      type: object
      description: >-
        A TagKeyValue holds key=value data related to a tag. This is used when
        creating or updating taggable entities (transactions, invoices, etc.).
      properties:
        key:
          type: string
          description: The tag dimension key (e.g., "department", "project", "location").
          example: department
        dimension_display_name:
          type: string
          nullable: true
          description: >-
            If the TagDimension doesn't exist, providing this value specifies
            the display name upon database insertion. Otherwise, it is left as
            null on the TagDimension.
          example: Department
        value:
          type: string
          description: The tag value (e.g., "sales", "marketing", "engineering").
          example: sales
        value_display_name:
          type: string
          nullable: true
          description: >-
            If the TagValueDefinition doesn't exist, providing this value
            specifies the display name upon database insertion. Otherwise, it is
            left as null on the TagValueDefinition.
          example: Sales Department
      required:
        - key
        - value
    Month:
      type: object
      properties:
        year:
          type: integer
          format: int32
          example: 2024
        month:
          type: integer
          format: int32
          example: 12
    Year:
      type: object
      properties:
        year:
          type: integer
          format: int32
          example: 2024
    DateRange:
      type: object
      properties:
        start_date:
          type: string
          format: date-time
        end_date:
          type: string
          format: date-time
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````