tRPC Procedures

The Inklura Platform API is served over tRPC. Every domain is exposed as a router of procedures, reachable at /api/trpc/<router>.<procedure>. The catalog below is representative, not exhaustive.

Procedure naming

A call names a router and a procedure, joined by a dot:

<router>.<procedure>

For example products.list, orders.getOrderById, invoices.createDraft, campaigns.sendCampaign. The router groups a domain; the procedure is the operation.

Access levels

Each procedure has an access level that determines what the caller must present:

Level Requires
Public Nothing: callable without a session (login, signup, password reset, and so on).
Authenticated A valid session (Bearer JWT or session cookie).
Permission A session and the named permission(s), in resource:action form (for example products:read). Without a session, the call only succeeds if the site grants those permissions to anonymous visitors.
Tenant-scoped A session belonging to the procedure's tenant (or a platform administrator).
Role A session holding one of the required roles.

Without valid credentials, a call to a protected procedure fails with UNAUTHORIZED (401). Authenticated but missing the required permission, role or tenant, it fails with FORBIDDEN (403). See Errors & Rate Limits.

Calling conventions

Queries are GET, mutations are POST. Inputs and outputs are superjson-wrapped: inputs go in {"json":<value>}, and the result is at result.data.json. Authenticate with a Bearer JWT (see Sessions & Tokens).

Raw HTTP: query (GET)

Input is URL-encoded into ?input=:

curl -G "https://manage.inklura.fr/api/trpc/products.getById" \
  -H "Authorization: Bearer $INKLURA_TOKEN" \
  --data-urlencode 'input={"json":{"id":"<product-id>"}}'

For a procedure with no input, omit ?input=:

curl "https://manage.inklura.fr/api/trpc/auth.getSession" \
  -H "Authorization: Bearer $INKLURA_TOKEN"

Raw HTTP: mutation (POST)

Input is the JSON body, wrapped the same way:

curl -X POST "https://manage.inklura.fr/api/trpc/clients.create" \
  -H "Authorization: Bearer $INKLURA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"json":{"name":"Acme SARL","email":"contact@acme.example"}}'

Both return the payload under result.data.json:

{ "result": { "data": { "json": { "id": "…" } } } }

TypeScript client (@trpc/client)

In TypeScript, use @trpc/client (v11) with the superjson transformer and an httpBatchLink pointed at /api/trpc. Add the Authorization header via the link's headers option. The platform's router type (AppRouter) is not published as a package, so the client below is untyped (any): check each procedure's input against this documentation.

import { createTRPCClient, httpBatchLink } from "@trpc/client";
import superjson from "superjson";

const client = createTRPCClient<any>({
  links: [
    httpBatchLink({
      url: "https://manage.inklura.fr/api/trpc",
      transformer: superjson,
      headers() {
        return { Authorization: `Bearer ${process.env.INKLURA_TOKEN}` };
      },
    }),
  ],
});

const session = await client.auth.getSession.query();
const created = await client.clients.create.mutate({
  name: "Acme SARL",
  email: "contact@acme.example",
});

With the transformer set on the link, the client handles superjson wrapping for you: you pass and receive plain values.

Batching

The endpoint accepts the standard tRPC batch protocol, so httpBatchLink groups calls made in the same tick into a single HTTP request. /api/trpc accepts both GET and POST, and queries can be sent as POST (method override is enabled).

Router catalog

The routers below are examples, grouped by family. The list is not complete.

Auth & identity

Router Procedures (examples)
auth getSession, getProfile, getUserInfo, resendVerificationEmail, and the public login / register / signup / requestPasswordReset / verifyEmail

Commerce & CRM

Router Procedures (examples)
products getById, getBySlug, create, update, deleteProduct, bulkUpdate, and the public list / getProductsByIds
orders getOrders, getOrderById, createOrder, updateOrder, updateStatus, markPaid, deleteOrder, and the lifecycle, fulfillment and refund sub-routers
clients getClients, getClientById, create, updateClient, deleteClient, getClientContacts
invoices getInvoices, getInvoice, createInvoice, createDraft, updateDraft, updateInvoiceStatus, convertQuote, createCreditNote, getDashboardMetrics, and the public getPublicInvoice

Other routers in this family (names only): profile, users, tiers, vendors, inventory, stockActions, recurringInvoices, payments, stripe, shipping, taxRates, coupons, subscriptions, accounting.

POS & restaurant

Names only: posManagement, posOrders, kitchen/kds, tablePayment, posLoyalty, clickCollect, floorPlans, tableReservations, delivery.

CMS & publishing

Names only: cms, articles, posts, medias, forms, sections, slider, magazinePublications, classifiedAds, feedApiKeys.

Communication & marketing

Router Procedures (examples)
campaigns getCampaigns, getCampaignById, createCampaign, createCampaignWizard, updateCampaign, deleteCampaign, sendCampaign, pauseCampaign, resumeCampaign, duplicateCampaign, getCampaignActivity, getCampaignTags, createCampaignTag
helpdeskKb getArticles, getArticleById, createArticle, updateArticle, deleteArticle, getCategories, getCategoryById, createCategory, updateCategory, deleteCategory

Other routers in this family (names only): marketingCampaigns, emails, emailTemplates, newsletter, segments, communications, support, chat, liveChat.

Account settings

Names only: settings, permissions, onboarding, site, webhooks, workflowAutomation.

Note

The catalog changes over time: use these lists as a starting map. Procedures named in the tables can be called as shown; the "names only" routers exist, but their signatures are not documented here.

Related