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

# Retrieve earnings (P&L)

> Retrieve an account's earnings (P&L) for the requested period. Note the period supports full date-times, with timezone information.



## OpenAPI

````yaml https://api.engine.usesophic.com/openapi.json get /accounts/{account_id}/earnings
openapi: 3.1.0
info:
  title: Sophic Engine API
  version: 0.1.0
servers:
  - url: https://api.engine.usesophic.com/
security: []
paths:
  /accounts/{account_id}/earnings:
    get:
      summary: Retrieve earnings (P&L)
      description: >-
        Retrieve an account's earnings (P&L) for the requested period. Note the
        period supports full date-times, with timezone information.
      operationId: get_earnings_accounts__account_id__earnings_get
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: string
            title: Account Id
        - name: period_start
          in: query
          required: false
          schema:
            description: >-
              The period start (in [ISO
              8601](https://www.iso.org/iso-8601-date-and-time-format.html)
              format). If omitted, it defaults to the account opening date/time.
              Note that the period is interpreted as a half-open interval with
              `period_start` included and `period_end` excluded.
            examples:
              - period_start=2025-11-12T00:00:00Z
              - period_start=2025-11-12
            x-remove-null-from-type-union: true
            title: Period Start
            type: string
            format: date-time
          description: >-
            The period start (in [ISO
            8601](https://www.iso.org/iso-8601-date-and-time-format.html)
            format). If omitted, it defaults to the account opening date/time.
            Note that the period is interpreted as a half-open interval with
            `period_start` included and `period_end` excluded.
        - name: period_end
          in: query
          required: false
          schema:
            description: >-
              The period end (in [ISO
              8601](https://www.iso.org/iso-8601-date-and-time-format.html)
              format). If omitted, it defaults to the current date/time. Note
              the period is interpreted as a half-open interval with
              `period_start` included and `period_end` excluded.
            examples:
              - period_end=2025-11-12T00:00:00Z
              - period_end=2025-11-12
            x-remove-null-from-type-union: true
            title: Period End
            type: string
            format: date-time
          description: >-
            The period end (in [ISO
            8601](https://www.iso.org/iso-8601-date-and-time-format.html)
            format). If omitted, it defaults to the current date/time. Note the
            period is interpreted as a half-open interval with `period_start`
            included and `period_end` excluded.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountEarnings'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - HTTPBearer: []
components:
  schemas:
    AccountEarnings:
      properties:
        account:
          type: string
          title: Account
        gross_realized:
          type: string
          title: Gross Realized
        gross_unrealized:
          type: string
          title: Gross Unrealized
        gross_total:
          type: string
          title: Gross Total
        net_realized:
          type: string
          title: Net Realized
        net_unrealized:
          type: string
          title: Net Unrealized
        net_total:
          type: string
          title: Net Total
        fees:
          type: string
          title: Fees
        currency:
          $ref: '#/components/schemas/Currency'
        period_start:
          type: string
          format: date-time
          title: Period Start
        period_end:
          type: string
          format: date-time
          title: Period End
        position_earnings:
          items:
            $ref: '#/components/schemas/PositionEarnings'
          type: array
          title: Position Earnings
      type: object
      required:
        - account
        - gross_realized
        - gross_unrealized
        - gross_total
        - net_realized
        - net_unrealized
        - net_total
        - fees
        - currency
        - period_start
        - period_end
        - position_earnings
      title: AccountEarnings
    Error:
      properties:
        detail:
          type: string
          title: Detail
          description: A human-readable description of the error.
        code:
          type: string
          title: Code
          description: A machine-readable error code.
        docs:
          title: Docs
          description: A URL to documentation about this error code.
          x-remove-null-from-type-union: true
          type: string
        context:
          title: Context
          description: An optional object for adding extra context to the error.
          x-remove-null-from-type-union: true
          additionalProperties:
            anyOf:
              - type: string
              - type: integer
          type: object
        params:
          title: Params
          description: An optional list of params that failed validation.
          x-remove-null-from-type-union: true
          items:
            $ref: '#/components/schemas/InvalidParam'
          type: array
      type: object
      required:
        - detail
        - code
      title: Error
    Currency:
      type: string
      enum:
        - EUR
        - USD
        - GBP
      title: Currency
      properties: {}
    PositionEarnings:
      properties:
        position:
          type: string
          title: Position
        gross_realized:
          type: string
          title: Gross Realized
        gross_unrealized:
          type: string
          title: Gross Unrealized
        gross_total:
          type: string
          title: Gross Total
        gross_unrealized_percentage:
          type: string
          title: Gross Unrealized Percentage
        currency:
          $ref: '#/components/schemas/Currency'
      type: object
      required:
        - position
        - gross_realized
        - gross_unrealized
        - gross_total
        - gross_unrealized_percentage
        - currency
      title: PositionEarnings
    InvalidParam:
      properties:
        path:
          items:
            anyOf:
              - type: integer
              - type: string
          type: array
          title: Path
          description: Path to the field name (or index if a list) that errored.
        detail:
          type: string
          title: Detail
          description: Human-readable detail for error.
        code:
          type: string
          title: Code
          description: A machine-readable error code.
      type: object
      required:
        - path
        - detail
        - code
      title: InvalidParam
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````