Skip to documentation

Documentation

Get started

Quickstart

Verify the API, create a tRPC 11 client, and make the first authenticated request.

1. Check service health

The plain HTTP health endpoint is the fastest reachability check. It does not require a session and does not verify downstream integrations.

Terminal
curl --fail-with-body https://api.facoolta.com/health

# {"status":"ok","service":"@facoolta/api"}

2. Create a typed client

The server uses tRPC 11 at https://api.facoolta.com/trpc. Inside the facoolta workspace, import AppRouter from @facoolta/api/client so procedure inputs and outputs remain inferred from the server.

api-client.ts
import { createTRPCClient, httpLink } from '@trpc/client';
import type { AppRouter } from '@facoolta/api/client';

const API_BASE = 'https://api.facoolta.com/trpc';

export const api = createTRPCClient<AppRouter>({
  links: [
    httpLink({
      url: API_BASE,
      headers: () => {
        const token = sessionStorage.getItem('facoolta_access_token');
        return token ? { authorization: 'Bearer ' + token } : {};
      },
    }),
  ],
});

3. Authenticate

Protected procedures accept an access token as Authorization: Bearer <token>. The server also accepts an unprefixed token for compatibility, but new clients should always send the standard Bearer scheme. Do not place tokens in URLs, query input, logs, or analytics.

4. Make a request

example.ts
// Public query: no token required.
const institutions = await api.institutions.list.query();

// Protected query: a bearer token is required.
const profile = await api.auth.me.query();

For a raw HTTP query, encode the JSON input in the input query parameter. The response uses the tRPC response envelope; typed clients unwrap it automatically.

Raw HTTP query
curl --get \
  --header 'Accept: application/json' \
  --header "Authorization: Bearer $facoolta_access_token" \
  --data-urlencode 'input={"id":"00000000-0000-0000-0000-000000000000"}' \
  https://api.facoolta.com/trpc/institutions.get

Access levels

Public
No token is required. Current examples are health.check and institution lookup.
Bearer
A valid session is required. Missing or invalid credentials return UNAUTHORIZED.
Verified
A valid session plus current campus verification is required. Resource lookups may return NOT_FOUND when the caller lacks access.

Continue to the API reference for the exact procedure inventory and schema shapes.