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

# Get an account by external ID

> Returns an account by its source loan-management account identifier. Pass `organization_id` to disambiguate identifiers reused across organizations. Returns 404 if no matching account is reachable by this key and 409 when multiple visible accounts match.



## OpenAPI

````yaml /api-reference/external_api.openapi.json get /v1/accounts/by-external-id/{external_id}
openapi: 3.1.0
info:
  title: Monterey Client API
  description: >-
    Org-scoped, token-authenticated account, borrower, and payment endpoints for
    Monterey Financial clients.
  version: 1.0.0
servers:
  - url: https://api.montereyfinancial.app
    description: Production
security:
  - BearerToken: []
tags:
  - name: Authentication
    description: Exchange API keys for access tokens.
  - name: Organizations
    description: Organizations visible to the API key.
  - name: Persons
    description: Borrowers visible through in-scope accounts.
  - name: Accounts
    description: Servicing accounts and identifier lookups.
  - name: Transactions
    description: Account money-movement history.
  - name: Payment Methods
    description: Stored payment instruments.
  - name: Autopay
    description: Recurring payment schedules.
paths:
  /v1/accounts/by-external-id/{external_id}:
    get:
      tags:
        - Accounts
      summary: Get an account by external ID
      description: >-
        Returns an account by its source loan-management account identifier.
        Pass `organization_id` to disambiguate identifiers reused across
        organizations. Returns 404 if no matching account is reachable by this
        key and 409 when multiple visible accounts match.
      operationId: get_account_by_external_id_v1_accounts_by_external_id__external_id__get
      parameters:
        - name: external_id
          in: path
          required: true
          schema:
            type: string
            title: External Id
        - name: organization_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Optional organization used to disambiguate reused identifiers.
            title: Organization Id
          description: Optional organization used to disambiguate reused identifiers.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountDetailRow'
        '401':
          description: Missing or invalid access token.
        '403':
          description: >-
            Authenticated token lacks the required scope (`insufficient_scope`)
            or the supplied `organization_id` is outside the access token's
            allowlist (`organization_out_of_scope`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Resource not in scope or does not exist.
        '409':
          description: >-
            Multiple visible accounts use this identifier. Retry with
            organization_id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerToken: []
components:
  schemas:
    AccountDetailRow:
      properties:
        id:
          type: string
          title: Id
        organization_id:
          type: string
          title: Organization Id
          description: The organization the account belongs to.
        contract_id:
          type: string
          title: Contract Id
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: Source loan-management account identifier.
        external_contract_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Contract Id
          description: Client-supplied contract identifier.
        status_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Status Code
          description: Current account status code.
        current_balance_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Current Balance Cents
          description: Current outstanding balance in cents.
        past_due_amount_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Past Due Amount Cents
          description: Amount currently past due in cents.
        payoff_amount_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Payoff Amount Cents
          description: Current payoff amount in cents.
        payment_amount_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Payment Amount Cents
          description: Scheduled payment amount in cents.
        payment_frequency:
          anyOf:
            - type: string
            - type: 'null'
          title: Payment Frequency
          description: Scheduled payment cadence.
        last_payment_at:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Last Payment At
          description: Date of the most recent payment.
        next_payment_due_at:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Next Payment Due At
          description: Next scheduled payment due date.
        payments_made:
          anyOf:
            - type: integer
            - type: 'null'
          title: Payments Made
        interest_rate_bps:
          anyOf:
            - type: integer
            - type: 'null'
          title: Interest Rate Bps
          description: Annual interest rate in basis points.
        apr_bps:
          anyOf:
            - type: integer
            - type: 'null'
          title: Apr Bps
          description: Annual percentage rate in basis points.
        interest_start_at:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Interest Start At
        days_past_due_30:
          anyOf:
            - type: integer
            - type: 'null'
          title: Days Past Due 30
          description: Days in the 1-30 day delinquency bucket.
        days_past_due_60:
          anyOf:
            - type: integer
            - type: 'null'
          title: Days Past Due 60
          description: Days in the 31-60 day delinquency bucket.
        days_past_due_90:
          anyOf:
            - type: integer
            - type: 'null'
          title: Days Past Due 90
          description: Days in the 61-90 day delinquency bucket.
        nsf_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Nsf Count
          description: Number of non-sufficient-funds events.
        opened_at:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Opened At
          description: Date the account opened.
        closed_at:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Closed At
          description: Date the account closed, when applicable.
        borrowers:
          items:
            $ref: '#/components/schemas/AccountBorrowerDetail'
          type: array
          title: Borrowers
          description: Enriched borrower parties, with the primary borrower first.
        accrued_interest_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Accrued Interest Cents
          description: Accrued unbilled interest in cents.
        accrued_late_charge_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Accrued Late Charge Cents
          description: Accrued late charges in cents.
        last_payment_amount_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Last Payment Amount Cents
          description: Most recent payment amount in cents.
        first_payment_made_at:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: First Payment Made At
          description: Date the first payment was received.
        final_payment_amount_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Final Payment Amount Cents
          description: Scheduled final payment in cents.
        last_extension_at:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Last Extension At
          description: Date of the most recent term extension.
        interest_base_days:
          anyOf:
            - type: integer
            - type: 'null'
          title: Interest Base Days
          description: Interest day-count convention.
        over_short_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Over Short Cents
          description: Over/short adjustment balance in cents.
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        contract:
          $ref: '#/components/schemas/ContractSummary'
      type: object
      required:
        - id
        - organization_id
        - contract_id
        - created_at
        - updated_at
        - contract
      title: AccountDetailRow
      description: Detailed account snapshot with contract and borrower relationships.
    ErrorResponse:
      properties:
        detail:
          $ref: '#/components/schemas/ErrorBody'
      type: object
      required:
        - detail
      title: ErrorResponse
      description: Standard error envelope. Branch on `detail.error_code`.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
      description: >-
        Parameter-validation error (HTTP 422). `detail` lists each violated
        constraint with its location, message, and type.
    AccountBorrowerDetail:
      properties:
        party_id:
          type: string
          title: Party Id
          description: The borrower's unique party ID.
        display_name:
          type: string
          title: Display Name
          description: The borrower's display name.
        role:
          type: string
          title: Role
          description: >-
            Open role string. Known values include primary, borrower,
            co_borrower, and co_signer.
        is_primary:
          type: boolean
          title: Is Primary
          description: Whether this party is the account's primary borrower.
        first_name:
          anyOf:
            - type: string
            - type: 'null'
          title: First Name
          description: The borrower's first name.
        last_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Name
          description: The borrower's last name.
        date_of_birth:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Date Of Birth
          description: The borrower's date of birth.
        ssn_last_four:
          anyOf:
            - type: string
            - type: 'null'
          title: Ssn Last Four
          description: Last four SSN digits; the full hash is never exposed.
      type: object
      required:
        - party_id
        - display_name
        - role
        - is_primary
      title: AccountBorrowerDetail
      description: Borrower identity and role fields returned on account detail.
    ContractSummary:
      properties:
        id:
          type: string
          title: Id
        cash_price_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Cash Price Cents
        original_term:
          anyOf:
            - type: integer
            - type: 'null'
          title: Original Term
          description: Original number of payment periods.
        original_payment_amount_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Original Payment Amount Cents
        original_interest_rate_bps:
          anyOf:
            - type: integer
            - type: 'null'
          title: Original Interest Rate Bps
        original_apr_bps:
          anyOf:
            - type: integer
            - type: 'null'
          title: Original Apr Bps
        originated_at:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Originated At
        first_payment_due_at:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: First Payment Due At
      type: object
      required:
        - id
      title: ContractSummary
      description: Originated-loan facts. Returned nested on AccountDetailRow.
    ErrorBody:
      properties:
        error_code:
          type: string
          title: Error Code
      type: object
      required:
        - error_code
      title: ErrorBody
      description: Standard error body. Branch on `error_code`.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
      description: >-
        A single parameter-validation failure: `loc` is the path to the
        offending input, `msg` is human-readable, and `type` is the rule that
        failed.
  securitySchemes:
    BearerToken:
      type: http
      description: Short-lived access token minted by POST /v1/oauth/token.
      scheme: bearer
      bearerFormat: JWT

````