Quickstart

This walks you through your first authenticated call to the Inklura Platform API. The API is tRPC: you call a procedure by its router.procedure name and pass a JSON input.

1. Get a session

A session is created when you sign in to manage.inklura.fr. For programmatic access, you send that session as a Bearer JWT, signed by the platform, in the Authorization header. Authentication covers every way to obtain one. For a first test, the fastest route is to copy the __Secure-authjs.session-token cookie value from a browser signed in to the console.

export INKLURA_TOKEN="<your session JWT>"
export INKLURA_BASE="https://manage.inklura.fr"

2. Verify who you are

auth.getSession returns the session attached to your token: your user, with its tenant and site. It is a good first call to confirm authentication works.

curl -s "$INKLURA_BASE/api/trpc/auth.getSession" \
  -H "Authorization: Bearer $INKLURA_TOKEN" | jq

A tRPC query with no input is a plain GET. The response is a superjson envelope:

{
  "result": {
    "data": {
      "json": {
        "user": { "id": "…", "email": "…", "tenantId": "…", "siteId": "…" },
        "expires": "…"
      }
    }
  }
}

The value you want is at result.data.json. Without a valid token, the call fails with UNAUTHORIZED (HTTP 401). auth.getSession also requires the auth:read permission: if your account lacks it, the call fails with FORBIDDEN (HTTP 403) even though the token is valid.

3. Read some data

Most reads take an input object. For a query, pass it URL-encoded as ?input={"json":<value>}. products.list takes a zero-based page and a limit:

curl -s -G "$INKLURA_BASE/api/trpc/products.list" \
  -H "Authorization: Bearer $INKLURA_TOKEN" \
  --data-urlencode 'input={"json":{"page":0,"limit":20}}' | jq '.result.data.json'

When omitted, page defaults to 0 (the first page) and limit to 10. Optional filters include search (matches name, description, reference or SKU), active and vendorId. The result holds items, total, page, limit and pages.

4. Write some data

Mutations are POST, with the input as the JSON body (wrapped in {"json": …}). clients.create requires a name; email is optional:

curl -s -X POST "$INKLURA_BASE/api/trpc/clients.create" \
  -H "Authorization: Bearer $INKLURA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"json":{"name":"Acme SARL","email":"contact@acme.fr"}}' | jq '.result.data.json'

Writing clients requires the clients:write permission on your account.

Tip

For a TypeScript client, point the official tRPC client (@trpc/client with httpBatchLink and the superjson transformer) at https://manage.inklura.fr/api/trpc and set the Authorization header. tRPC Procedures has a full example.

Next steps