Skip to main content

API Overview

The Ledgerline API is a RESTful JSON API that powers the Ledgerline storefront, Discord bot, and admin panel. Integrators can use the same API to build custom workflows, dashboards, or automations on top of Ledgerline.

Prerequisites

  • A running Ledgerline instance with network access.
  • A valid session (see Authentication).

Base URL

All API endpoints are served under the /api path prefix:

https://your-domain.com/api/...

Auth endpoints use /auth directly:

https://your-domain.com/auth/...

Core Resources

ResourceBase PathDescription
Auth/authAuthentication, sessions, and tenant switching.
Orders/api/data/orderOrder CRUD, status management.
Customers/api/data/customerCustomer profiles, addresses, linking.
Products/api/data/productProduct catalog and configuration.
Inventory/api/data/inventoryStock snapshots and transactions.
Discounts/api/data/discountDiscount codes and targeting rules.
Users/api/data/userPlatform user accounts and roles.
Payments/api/data/paymentPayment records and confirmation.
Webhook Events/api/data/webhook-eventInbound webhook event log.
Tenants/api/data/tenantTenant configuration.
Community Fund/api/admin/community-fundVoluntary member contributions and disbursements (admin).

Key Concepts

  • Multi-tenancy — All data is scoped to a tenant. Every request must include a tenant identifier. See Tenant Scoping.
  • Session-based auth — The API uses HTTP-only session cookies. See Authentication.
  • Deterministic pricing — Order totals are computed server-side. Clients submit line items and the server calculates subtotals, discounts, and totals.
  • Webhook-driven integrations — External payment providers notify Ledgerline via webhooks. See Webhooks.
  • Discord interactions — The Discord bot receives interactions via POST /discord/interactions: slash commands (type 2), message components (type 3), and modal submits (type 5). Responses may include content, embeds, components, or modals. See Discord API.

Request Format

  • Content type: application/json
  • Tenant header: x-tenant-id (see Tenant Scoping)
  • Auth: session cookie (ledgerline_auth)

Response Format

Successful responses return JSON with the resource object or an array of objects. Error responses follow a consistent error model described in API Conventions.