DocumentazionePer iniziare
Guida rapida
Accedi e crea con l’SDK il tuo primo ordine d’acquisto, per qualsiasi fornitore, verificato rispetto a ciò che ricevi.
Accedi e crea il tuo primo ordine d’acquisto, a qualsiasi fornitore. La console e gli SDK chiamano la stessa API /v1, che puoi chiamare anche con una chiave API con ambiti limitati (vedi Agenti IA per generarne una). Alcune azioni richiedono sempre una persona che ha effettuato l’accesso a Pleaxy, mai una chiave API: approvare, modificare i flussi di approvazione o l’autonomia e registrare un pagamento.
import { Pleaxy } from "@pleaxy/sdk";
// The base URL is the origin only: the SDK adds /v1/workspaces/<Workspace ID>.
const pleaxy = new Pleaxy({
baseUrl: "https://api.pleaxy.ai",
apiKey: process.env.PLEAXY_API_KEY, // "<keyId>.<secret>"
workspaceId: process.env.PLEAXY_WORKSPACE_ID, // Company profile → Workspace ID
});
// A purchase order to any supplier. A supplier not on Pleaxy yet is emailed the
// order and invited at supplierContactEmail when it is sent. With three_way, its
// invoices are checked against this order, what you receive against it and any
// contract you hold with them.
const po = await pleaxy.purchaseOrders.createPurchaseOrder({
supplier: "Northgate Steel",
supplierContactEmail: "orders@northgate-steel.example",
matching: "three_way",
lineItems: [
{
scopeType: "custom",
name: "Hot-rolled steel plate, 10 mm",
ruleType: "quantity",
lineType: "goods",
unit: "t",
unitPrice: 920,
qty: 20,
nteAmount: 0,
paymentTerms: "Net 30",
validFrom: "2026-01-01",
validUntil: "2026-12-31",
},
],
});
// po.status is "pending_approval" while your approval flow runs, then
// "awaiting_fulfillment". Autonomy, if on, can approve it straight away.
// Each invoice against the order is checked against it, what was received and
// the contract (and, for a cloud or AI provider you connect, the usage it
// metered). Why one matched or is held:
const [invoice] = await pleaxy.invoices.listInvoices();
if (invoice) console.log(await pleaxy.invoices.getInvoiceReconciliation(invoice.id));Disponibile nel tuo linguaggio
Ogni SDK è generato dalla stessa specifica OpenAPI alla base del Riferimento API, così resta sempre allineato all’API: scegli uno dei sei che manteniamo direttamente, o genera un client per qualsiasi altro linguaggio.