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

# Ledger History by ID

> Retrieves ledger entries matching a specific interaction ID (external correlation ID).

Fetches all ledger entries that were processed with a specific interaction ID (external correlation ID). This is useful for retrieving all transactions related to a single interaction or session.

## Request Headers

<ParamField header="X-Auth-Token" type="string" required>
  The **JWT Access Token** obtained from the `/login` or `/refresh-token` endpoint.
</ParamField>

<ParamField header="x-fapi-interaction-id" type="string" required>
  The interaction ID (external correlation ID) to search for. This should be a UUID.
</ParamField>

<ParamField header="x-fapi-auth-date" type="string" required>
  The date and time at which the request was initiated (ISO 8601 format).
</ParamField>

<ParamField header="x-fapi-customer-ip-address" type="string" required>
  The IP address of the customer making the request.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://{domain}.fincode.software/api/v6/services/ledger/account-ledger-history-interaction-id' \
  --header 'X-Auth-Token: YOUR_JWT_ACCESS_TOKEN' \
  --header 'x-fapi-interaction-id: 123e4567-e89b-12d3-a456-426614174000' \
  --header 'x-fapi-auth-date: 2024-01-15T10:30:00Z' \
  --header 'x-fapi-customer-ip-address: 192.168.1.1'
  ```

  ```javascript Node.js theme={null}
  const axios = require('axios');

  const BASE_URL = 'https://{domain}.fincode.software/api/v6/services/ledger';

  async function getLedgerHistoryByInteractionId(accessToken, interactionId) {
    try {
      const response = await axios.get(
        `${BASE_URL}/account-ledger-history-interaction-id`,
        {
          headers: {
            'X-Auth-Token': accessToken,
            'x-fapi-interaction-id': interactionId,
            'x-fapi-auth-date': new Date().toISOString(),
            'x-fapi-customer-ip-address': '192.168.1.1',
          },
        }
      );

      console.log(`Found ${response.data.data.length} transactions with interaction ID ${interactionId}:`);
      response.data.data.forEach((entry) => {
        console.log(
          `${entry.executionDate}: ${entry.ledgerType} ` +
          `${entry.transactionAmount} (Balance: ${entry.newBalance})`
        );
      });

      return response.data.data;
    } catch (error) {
      console.error(
        'Failed to fetch ledger history:',
        error.response?.data || error.message
      );
      throw error;
    }
  }

  ```
</CodeGroup>


## OpenAPI

````yaml GET /ledger/account-ledger-history-interaction-id
openapi: 3.0.0
info:
  title: FinCode API
  version: v6
servers:
  - url: https://{tenant}.fincode.software/api/v6/services
    description: API v6
    variables:
      tenant:
        default: remitjunction
        description: Enter your tenant subdomain
  - url: https://{tenant}.fincode.software/api/v1/services
    description: API v1
    variables:
      tenant:
        default: finlend
        description: Enter your tenant subdomain
  - url: https://api.stag.songhaiexchange.io
    description: Songhai Exchange API
security: []
paths:
  /ledger/account-ledger-history-interaction-id:
    get:
      summary: Ledger History by Interaction ID
      description: Retrieves ledger entries matching a specific interaction ID.
      operationId: getLedgerHistoryByInteractionId
      parameters:
        - $ref: '#/components/parameters/platformHeader'
        - $ref: '#/components/parameters/uuidHeader'
        - in: header
          name: X-Auth-Token
          schema:
            type: string
          required: true
        - in: header
          name: x-fapi-interaction-id
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Ledger entries
components:
  parameters:
    platformHeader:
      in: header
      name: platform
      schema:
        type: string
        default: fincode
      required: true
    uuidHeader:
      in: header
      name: uuid
      schema:
        type: string
        default: '200'
      required: true

````