curl --request GET \
    --url https://api.sandbox.teal.dev/v0/journal-entries/{journal_entry_id}?expand=line_entries.ledger \
    --header 'Authorization: Bearer <token>' \
    --header 'teal-instance-id: <teal-instance-id>'

{
    "datetime": "2024-01-01T00:00:00Z",
    "description": "Payment of legal fees",
    "id": "C4ocnUQze8kDwQ3EczkZXn",
    "line_entry_ids": [
        "CWu49stZwxhVcHe7498qVx",
        "YT7R5Nc2gZBbkHbodiuxXP"
    ],
    "line_entries": [
        {
            "amount": 382.28,
            "id": "CWu49stZwxhVcHe7498qVx",
            // ...
            "ledger": {
                "id": "7JRNsKwy2Lw66caxVU7WGC",
                "name": "Accounts Receivable",
                // ...
            },
        },
        {
            "amount": 382.28,
            "id": "YT7R5Nc2gZBbkHbodiuxXP",
            // ...
            "ledger": {
                "id": "XMDsKVuW4Wmi3LTW31Qw6E",
                "name": "Pluto Checking 4242",
                // ...
            }
        }
    ]
}

Many objects allow you to request additional information as an expanded response by using the expand parameter. For example, a Journal Entry object has an assoication to its line entries; by using the expand parameter, you can request the full Line Entry objects. Expandable fields are denoted in this documentation in their description.

To expand responses, specifiy the nested fields that you would like to expand. For example, passing line_entries on a journal entry request would give you the complete Line Entry objects for every line entry associated with the journal entry.

You can recursively expand responses up to a depth of two levels, using a dot (.) between attributes. For example requesting line_entries.ledger on a journal entry would get the ledger assoiciated with a journal entry’s corresponding line entries. Note that deep expansions, especially on lists of objects, may result in slower processing times.

Pass multiple expressions to the expand parameter to expand multiple objects at once in a single request.