Skip to content

Webhooks and misc

This page rounds up the remaining Company API resources: standalone file uploads, change event feeds for keeping an external system in sync, webhook subscriptions, and the identity endpoint for the current access token.

FileAttachments ($client->fileAttachments)

Upload standalone files, for example to attach to other records later. Uploads are multipart, built from a Pennylane\Sdk\FileUpload instance.

Method HTTP Scope Description
create($file, $filename = null) POST /file_attachments file_attachments:all Upload a file attachment. filename defaults to the uploaded file's own name.

Changelogs ($client->changelogs)

Change event feeds: insert, update and delete events for a resource, useful for keeping an external system in sync without repolling full collections. One method per watched resource type, all sharing the same signature (cursor, limit, startDate).

Method HTTP Scope Description
customerInvoices($cursor = null, $limit = null, $startDate = null) GET /changelogs/customer_invoices customer_invoices:readonly Get customer invoice change events.
supplierInvoices($cursor = null, $limit = null, $startDate = null) GET /changelogs/supplier_invoices supplier_invoices:readonly Get supplier invoice change events.
customers($cursor = null, $limit = null, $startDate = null) GET /changelogs/customers customers:readonly Get customer change events.
suppliers($cursor = null, $limit = null, $startDate = null) GET /changelogs/suppliers suppliers:readonly Get supplier change events.
products($cursor = null, $limit = null, $startDate = null) GET /changelogs/products products:readonly Get product change events.
ledgerEntryLines($cursor = null, $limit = null, $startDate = null) GET /changelogs/ledger_entry_lines ledger_entries:readonly Get ledger entry line change events.
transactions($cursor = null, $limit = null, $startDate = null) GET /changelogs/transactions transactions:readonly Get transaction change events.
quotes($cursor = null, $limit = null, $startDate = null) GET /changelogs/quotes quotes:readonly Get quote change events.

startDate accepts a \DateTimeInterface or a string, and only returns events processed after that date.

WebhookSubscriptions ($client->webhookSubscriptions)

Beta: subject to change. Register a callback URL and the event types Pennylane should push to it, instead of polling the changelog endpoints above.

Method HTTP Scope Description
list($cursor = null, $limit = null) GET /webhook_subscriptions (undocumented) List webhook subscriptions. (beta)
create($callbackUrl, $events, $enabled = null) POST /webhook_subscriptions (undocumented) Create a webhook subscription. The response carries a secret used to verify the HMAC signature of deliveries; it is returned only this once, so store it right away. (beta)
get($webhookSubscriptionId) GET /webhook_subscriptions/{webhookSubscriptionId} (undocumented) Retrieve a webhook subscription by its identifier. (beta)
update($webhookSubscriptionId, $callbackUrl = null, $events = null, $enabled = null) PUT /webhook_subscriptions/{webhookSubscriptionId} (undocumented) Update a webhook subscription. (beta)
delete($webhookSubscriptionId) DELETE /webhook_subscriptions/{webhookSubscriptionId} (undocumented) Delete a webhook subscription. (beta)

See the webhooks reference page for signature verification and payload parsing with Pennylane\Sdk\Webhooks\Webhooks.

Me ($client->me)

The identity tied to the current access token.

Method HTTP Scope Description
retrieve() GET /me (undocumented) Retrieve the authenticated user, their company, and the OAuth scopes granted to the current access token.

Example

<?php

declare(strict_types=1);

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

use Pennylane\Sdk\FileUpload;
use Pennylane\Sdk\Pennylane;

$client = new Pennylane();

$attachment = $client->fileAttachments->create(
    FileUpload::fromPath('/path/to/receipt.pdf'),
);

foreach ($client->changelogs->customerInvoices(startDate: '2026-07-01') as $event) {
    echo "Customer invoice change: {$event->id}\n";
}

$subscription = $client->webhookSubscriptions->create(
    callbackUrl: 'https://example.com/webhooks/pennylane',
    events: ['customer_invoice.e_invoicing_status_updated'],
);
echo "Store this secret now: {$subscription->secret}\n";

$me = $client->me->retrieve();
echo "Connected as company {$me->company?->id}\n";