# Call partner resources

Run this integration code on the server unless the example explicitly mounts a browser button. `tokenVault`, `savePendingOAuthState`, `loadQentrahSession`, and event callbacks are application integration points, not exports supplied by the SDK. Implement them with your storage and user-session model.

## Service-App Client

Use the service client from server code after your app has a saved access token.

```ts
import { createQentrahServiceAppClient } from "@qentrah/auth-sdk/partner/service-app";

const qentrah = createQentrahServiceAppClient({
  workspaceBaseUrl: process.env.QENTRAH_WORKSPACE_BASE_URL!,
  accessToken: savedAccessToken,
});

const organization = await qentrah.me();

const clients = await qentrah.listClients({
  organizationId,
  options: {
    limit: 25,
    search: "Acme",
    status: "active",
  },
});

const createdClient = await qentrah.createClient({
  organizationId,
  input: {
    name: "Acme Buyer",
    email: "buyer@example.com",
  },
  idempotencyKey: createIdempotencyKey(),
});

await qentrah.updateClient({
  organizationId,
  clientId: createdClient.id,
  input: { name: "Acme Buyer Updated" },
});

await qentrah.deleteClient({
  organizationId,
  clientId: createdClient.id,
});
```

Read helpers include:

- `me`
- `listClients`
- `listProperties`
- `listProjects`
- `listTasks`
- `listCalendar`
- `listMedia`
- `listWebhooks`

Common options include `limit`, `cursor`, `search`, `type`, `status`, `startAt`, `endAt`, `indexStart`, and `indexEnd`. Media also supports `resourceType` and `resourceId`.

The older `read`, `write`, and `sendWebhook` helpers remain available for existing integrations.