> ## Documentation Index
> Fetch the complete documentation index at: https://docs-beta.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
      properties: {}
      example: ''
      description: ''
    ProfitAndLossComparisonPeriods:
      type: object
      oneOf:
        - $ref: '#/components/schemas/Months'
        - $ref: '#/components/schemas/Years'
        - $ref: '#/components/schemas/DateRanges'
      discriminator:
        propertyName: type
        mapping:
          Comparison_Months: '#/components/schemas/Months'
          Comparison_Years: '#/components/schemas/Years'
          Comparison_DateRanges: '#/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
    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

````