Skip to content

Exports

Accounting exports are asynchronous jobs: you create a job for a period, then poll it until its download URL is ready. This page covers the three export kinds available on the Company API: FEC, general ledger and analytical general ledger.

Exports ($client->exports)

This class exposes no endpoint of its own; it wires the fecs, generalLedgers and analyticalGeneralLedgers sub resources below.

FecExports ($client->exports->fecs)

Export the FEC (Fichier des Ecritures Comptables) for a given period.

Method HTTP Scope Description
create($periodStart, $periodEnd) POST /exports/fecs exports:fec Create a FEC export job for a period.
get($exportId) GET /exports/fecs/{exportId} exports:fec Retrieve a FEC export, including its download URL once ready.

GeneralLedgerExports ($client->exports->generalLedgers)

Export the general ledger for a given period.

Method HTTP Scope Description
create($periodStart, $periodEnd) POST /exports/general_ledgers exports:gl Create a general ledger export job for a period.
get($exportId) GET /exports/general_ledgers/{exportId} exports:gl Retrieve a general ledger export, including its download URL once ready.

AnalyticalGeneralLedgerExports ($client->exports->analyticalGeneralLedgers)

Export the analytical general ledger for a given period, either in line or in column mode.

Method HTTP Scope Description
create($periodStart, $periodEnd, $mode = null) POST /exports/analytical_general_ledgers exports:agl Create an analytical general ledger export job for a period. mode is in_line or in_column (API default in_line).
get($exportId) GET /exports/analytical_general_ledgers/{exportId} exports:agl Retrieve an analytical general ledger export, including its download URL once ready.

All three get() methods return the same Export DTO: id, status, fileUrl, createdAt, updatedAt. The export is generated in the background, so fileUrl is null until status becomes ready. The download URL expires 30 minutes after it is issued.

Example

<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use Pennylane\Sdk\Pennylane;

$client = new Pennylane();

$export = $client->exports->fecs->create('2026-01-01', '2026-06-30');

// The file is built asynchronously: poll until it leaves the pending state.
// Status is one of pending, ready, error.
while ($export->status === 'pending') {
    sleep(5);
    $export = $client->exports->fecs->get($export->id);
}

if ($export->status === 'ready') {
    echo "FEC ready: {$export->fileUrl}\n";
} else {
    echo "FEC export failed\n";
}

$glExport = $client->exports->generalLedgers->create('2026-01-01', '2026-06-30');
$aglExport = $client->exports->analyticalGeneralLedgers->create('2026-01-01', '2026-06-30', 'in_column');