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

# Get profit and loss report

> 
        Retrieve a Profit and Loss report for a business within a date range.

        **Important:** Both posted and draft journal entries are included in the calculations.

        **Summary metrics returned:**
        - net_revenue_cents: Sum of Revenue subtype accounts
        - total_operating_income_cents: Net revenue + Other Operating Income
        - gross_profit_cents: Total operating income - Direct Costs
        - operating_profit_cents: Gross profit - Operating Expenses
        - profit_before_tax_cents: Operating profit + Finance Income - Finance Costs
        - net_profit_cents: Profit before tax - Income Tax

        **Detail levels:**
        - `summary` (default): Returns only summary metrics
        - `detailed`: Returns summary + line item breakdown by AccountSubtype

        All values are in cents. Currency is the business's base currency.
        



## OpenAPI

````yaml GET /v1/platform/businesses/{business_id}/reports/profit-and-loss/
openapi: 3.0.3
info:
  title: Thredfi Accounting Platform API
  version: 1.0.0
  description: >-
    Comprehensive API for accounting, invoice management, open banking, and
    intelligence services.
servers: []
security: []
paths:
  /v1/platform/businesses/{business_id}/reports/profit-and-loss/:
    get:
      tags:
        - Reports
      summary: Get profit and loss report
      description: |2-

                Retrieve a Profit and Loss report for a business within a date range.

                **Important:** Both posted and draft journal entries are included in the calculations.

                **Summary metrics returned:**
                - net_revenue_cents: Sum of Revenue subtype accounts
                - total_operating_income_cents: Net revenue + Other Operating Income
                - gross_profit_cents: Total operating income - Direct Costs
                - operating_profit_cents: Gross profit - Operating Expenses
                - profit_before_tax_cents: Operating profit + Finance Income - Finance Costs
                - net_profit_cents: Profit before tax - Income Tax

                **Detail levels:**
                - `summary` (default): Returns only summary metrics
                - `detailed`: Returns summary + line item breakdown by AccountSubtype

                All values are in cents. Currency is the business's base currency.
                
      operationId: get_profit_and_loss
      parameters:
        - in: path
          name: business_id
          schema:
            type: string
            format: uuid
          description: Business UUID
          required: true
        - in: query
          name: detail_level
          schema:
            type: string
            enum:
              - detailed
              - summary
            default: summary
          description: 'Level of detail: ''summary'' or ''detailed'''
        - in: query
          name: end_date
          schema:
            type: string
            format: date
          description: Report period end date (YYYY-MM-DD)
          required: true
        - in: query
          name: start_date
          schema:
            type: string
            format: date
          description: Report period start date (YYYY-MM-DD)
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProfitAndLoss'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
          description: Validation errors in request data
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Authentication required - missing or invalid API key
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Permission denied - insufficient privileges
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Resource not found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Conflict - resource already exists or invalid state transition
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable entity - business logic validation failed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
        - PartnerJWT: []
        - BusinessScopedJWT: []
        - BasicAuth: []
        - BearerUnscoped: []
        - BearerBusinessScoped: []
components:
  schemas:
    ProfitAndLoss:
      type: object
      description: >-
        Complete P&L report response.


        Subtype group keys are AccountSubtype.value:

        - "revenue" (from Account.AccountSubtype.REVENUE.value)

        - "other_operating_income" (from
        Account.AccountSubtype.OTHER_OPERATING_INCOME.value)

        - etc.
      properties:
        business_id:
          type: string
          format: uuid
          description: Business UUID
        start_date:
          type: string
          format: date
          description: Report period start
        end_date:
          type: string
          format: date
          description: Report period end
        currency:
          type: string
          description: Business base currency
        detail_level:
          enum:
            - summary
            - detailed
          type: string
          x-spec-enum-id: 42d5883c5aa0b3a9
          description: |-
            'summary' or 'detailed'

            * `summary` - summary
            * `detailed` - detailed
        summary:
          allOf:
            - $ref: '#/components/schemas/ProfitAndLossSummary'
          description: Calculated P&L totals
        revenue:
          $ref: '#/components/schemas/SubtypeGroup'
        other_operating_income:
          $ref: '#/components/schemas/SubtypeGroup'
        direct_costs:
          $ref: '#/components/schemas/SubtypeGroup'
        operating_expenses:
          $ref: '#/components/schemas/SubtypeGroup'
        finance_income:
          $ref: '#/components/schemas/SubtypeGroup'
        finance_costs:
          $ref: '#/components/schemas/SubtypeGroup'
        income_tax:
          $ref: '#/components/schemas/SubtypeGroup'
      required:
        - business_id
        - currency
        - detail_level
        - end_date
        - start_date
        - summary
    ValidationErrorResponse:
      type: object
      description: Validation error response with field-specific errors
      properties:
        error_code:
          type: string
          description: Error code (e.g., 'validation_error')
        message:
          type: string
          nullable: true
          description: Human-readable error message
        detail:
          type: object
          additionalProperties: {}
          description: Contains field_errors and additional context
        request_id:
          type: string
          description: Request ID for tracing
      required:
        - detail
        - error_code
        - message
    ErrorResponse:
      type: object
      description: Standard error response format
      properties:
        error_code:
          type: string
          description: Error code for programmatic handling
        message:
          type: string
          nullable: true
          description: Human-readable error message
        detail:
          type: object
          additionalProperties: {}
          description: Additional error details including field_errors and debug info
        request_id:
          type: string
          description: Request ID for tracing
      required:
        - error_code
        - message
    ProfitAndLossSummary:
      type: object
      description: >-
        Calculated P&L totals.


        Each field is calculated from AccountSubtype totals:

        - net_revenue_cents = Sum of REVENUE subtype

        - total_operating_income_cents = net_revenue + OTHER_OPERATING_INCOME

        - gross_profit_cents = total_operating_income - DIRECT_COSTS

        - operating_profit_cents = gross_profit - OPERATING_EXPENSES

        - profit_before_tax_cents = operating_profit + FINANCE_INCOME -
        FINANCE_COSTS

        - net_profit_cents = profit_before_tax - INCOME_TAX
      properties:
        net_revenue_cents:
          type: integer
          description: Sum of AccountSubtype.REVENUE
        total_operating_income_cents:
          type: integer
          description: Net revenue + OTHER_OPERATING_INCOME
        gross_profit_cents:
          type: integer
          description: Total operating income - DIRECT_COSTS
        total_operating_expenses_cents:
          type: integer
          description: Sum of AccountSubtype.OPERATING_EXPENSES
        operating_profit_cents:
          type: integer
          description: Gross profit - OPERATING_EXPENSES
        profit_before_tax_cents:
          type: integer
          description: Operating profit + FINANCE_INCOME - FINANCE_COSTS
        net_profit_cents:
          type: integer
          description: Profit before tax - INCOME_TAX
      required:
        - gross_profit_cents
        - net_profit_cents
        - net_revenue_cents
        - operating_profit_cents
        - profit_before_tax_cents
        - total_operating_expenses_cents
        - total_operating_income_cents
    SubtypeGroup:
      type: object
      description: |-
        Grouped accounts by AccountSubtype.

        - display_name: From AccountSubtype.label
        - total_cents: Sum of all line items
        - line_items: Individual accounts with this subtype
      properties:
        display_name:
          type: string
          description: Display name from AccountSubtype.label
        total_cents:
          type: integer
          description: Subtotal in cents
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/LineItem'
          description: Individual accounts
      required:
        - display_name
        - total_cents
    LineItem:
      type: object
      description: |-
        Individual account line item in P&L report.

        Represents a single Account with its period balance.
      properties:
        account_id:
          type: string
          format: uuid
          description: Account UUID (from Account.id)
        account_code:
          type: string
          description: Account code (from Account.code)
        account_name:
          type: string
          description: Account name (from Account.custom_name or Account.name)
        value_cents:
          type: integer
          description: Period balance in cents
      required:
        - account_code
        - account_id
        - account_name
        - value_cents
  securitySchemes:
    PartnerJWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Partner-level JWT token (unscoped). Token payload includes `partner_id`.
        Business access is validated via partner ownership. Format: `Bearer
        <your-jwt-token>`


        **Use this for**: Multi-business operations where the business_id is
        specified in the URL and partner has access to multiple businesses.
    BusinessScopedJWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Business-scoped JWT token. Token payload includes `business_id` to
        automatically scope requests. Format: `Bearer <your-jwt-token>`


        **Use this for**: Business-specific operations where the business
        context is embedded in the token.
    BasicAuth:
      type: http
      scheme: basic
      description: >-
        Basic authentication for OAuth2 token endpoint. Use partner_uuid:api_key
        as username:password. Example: Authorization: Basic
        base64(partner_uuid:api_key)
    BearerUnscoped:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Partner (unscoped) JWT Bearer token. Obtain via POST
        /v1/platform/oauth2/token with Basic auth (partner_uuid:api_key). Use
        header: Authorization: Bearer {access_token}
    BearerBusinessScoped:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Business-scoped JWT Bearer token. Obtain via POST
        /v1/platform/{business_id}/oauth2/token/ using a partner Bearer token.
        Only valid for endpoints whose URL contains that business_id.

````