> ## Documentation Index
> Fetch the complete documentation index at: https://docs.widgetic.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API classes

> The classes of the Widgetic libraries, what each one covers, which key it takes, and how a call is named in each language

Every group of endpoints in the [API reference](https://docs.widgetic.com/api-reference/introduction.md) is a class in the libraries, and every endpoint is a method of its class. A class is named after its group, with `Api` at the end (`API` in Go): `WidgetsApi` holds the calls under Widgets.

## The classes

| Class | What it covers | Calls | Key |
| :- | :- | :- | :- |
| `WidgetsApi` | The reusable pieces compositions are made from. The widgets of your account are your own library. | 6 | Organisation key; 2 of its 6 calls take a partner key |
| `CompositionsApi` | A widget set up for one place: its content, design and embed settings, and what visitors sent to it. | 41 | Organisation key; 2 of its 41 calls take a partner key |
| `CanvasesApi` | The editing surface where a widget is designed and configured. A canvas holds one widget. | 5 | Organisation key |
| `WorkflowsApi` | Compositions chained together, with filters that decide which one a visitor sees next. | 21 | Organisation key; 2 of its 21 calls take a partner key |
| `ABTestingApi` | Show two to four versions of a composition to different visitors, and see which one reaches the goal you chose. | 15 | Organisation key |
| `TranslationsApi` | Copies of a composition in other languages, translated by a language model, and the views each language gets. | 9 | Organisation key |
| `UploadsApi` | The files a workspace keeps, and the limits on what it accepts. | 7 | Organisation key; 2 of its 7 calls take a partner key |
| `BrandKitApi` | The colors, fonts, icons, corner radius and style notes every widget your account makes is generated with. | 8 | Organisation key |
| `TokensApi` | Check which account and workspace an API key belongs to, and what it may do. | 1 | Organisation key |
| `UsersApi` | The adapter connections of an account. | 4 | Organisation key |
| `CreditsApi` | The credits an account holds, and the ledger of how they were spent. | 2 | Organisation key |
| `OrganizationsApi` | The websites a workspace lets its widgets appear on, the API keys of a workspace and the translations made in it. | 11 | Organisation key |
| `OperationsApi` | Follow work that carries on after the response that started it. | 1 | Organisation key |
| `PartnersApi` | Run Widgetic for your own customers: contract, billing, presets, storage, notifications, analytics and embeds. These endpoints need a partner key. | 41 | Partner key |
| `ManagedUsersApi` | The customers of a partner, with their editor sessions, limits and usage. Only partners can make and work with managed users, with an active partner API key. | 18 | Partner key |
| `InvoicesApi` | The invoices issued to a partner. | 1 | Partner key |
| `EntitlementsApi` | What a partner and its managed users are entitled to. | 2 | Partner key |
| `PublicEmbedApi` | What a published widget calls from a visitor's browser. These endpoints take no key. | 10 | No key |

### Which key a class needs

The last column says which key each class is meant for. It comes from the `x-access-level` of the endpoints, and the key is sent the same way for all of them: as the bearer token, whichever language you use (see [Get started](https://docs.widgetic.com/docs/sdks/getting-started.md#2-make-an-api-key)).

* **An organisation key** (`wdg_org_`) is made in the dashboard and acts as one workspace. Most endpoints take it.
* **A partner key** (`wgt_prt_`) is made in your partner's home workspace and is for a platform that runs Widgetic for its own customers. The partner classes need one.
* **No key**: `PublicEmbedApi` is what a published widget calls from a visitor's browser. You seldom call it from a server: the [embed script](https://docs.widgetic.com/docs/api/embedding.md) does it for you.

[API keys](https://docs.widgetic.com/docs/api-keys.md) compares the two kinds of key and says which calls of each class they can make. [Authentication](https://docs.widgetic.com/docs/authentication.md#api-key-types-and-access-levels) lists the prefixes.

## How a call is named

A method is named after the operation id of its endpoint, written the way the language writes a name: `createWidget`, `create_widget`, `CreateWidget`. What differs is how each language takes the arguments. This is the call that creates a widget, in each of them:

| Language | Class | Method | Arguments |
| :- | :- | :- | :- |
| TypeScript | `WidgetsApi` | `createWidget` | one object: `{ idempotencyKey, newWidget }` |
| Python | `WidgetsApi` | `create_widget` | keyword arguments: `idempotency_key=…, new_widget=…` |
| Go | `WidgetsAPI` | `CreateWidget` | chained setters, then `Execute()`: `.IdempotencyKey(…).CreateWidgetRequest(…)` |
| Java | `WidgetsApi` | `createWidget` | positional: `(idempotencyKey, newWidget)` |
| C# | `WidgetsApi` | `CreateWidget` | positional or named: `(idempotencyKey, newWidget)` |
| Ruby | `WidgetsApi` | `create_widget` | positional, optional ones last: `(idempotency_key, new_widget)` |
| PHP | `WidgetsApi` | `createWidget` | positional or named: `($idempotency_key, $new_widget)` |

A path or query parameter is an argument, and so is a header that the endpoint takes: `Idempotency-Key` becomes `idempotencyKey`, and a partner's `X-Managed-User-Id` becomes `xManagedUserId`, in the case of each language. The body is an argument too, under the name of its model.

To find the call for an endpoint, open it in the [API reference](https://docs.widgetic.com/api-reference/introduction.md) and pick your language in the code sample. The samples are built from the libraries' own signatures, so a name you copy from one exists.

## Public embed routes

The routes behind the embed script are at `https://api.widgetic.com/embed`, and the libraries default to an address that ends in `/v1`. Build `PublicEmbedApi` with the API address without it. The samples of those endpoints in the API reference do this for each language. In TypeScript:

```typescript theme={"theme":"css-variables"}
import { Configuration, PublicEmbedApi } from '@widgetic/api-sdk-ts';

const publicEmbedApi = new PublicEmbedApi(new Configuration({ basePath: 'https://api.widgetic.com' }));
```

## Next steps

> [card] [Requests and errors](https://docs.widgetic.com/docs/sdks/requests-and-errors.md)
>
> Page through a list, create something once, and handle an error

> [card] [Managed users](https://docs.widgetic.com/docs/partners/managed-users.md)
>
> The calls a partner makes for its customers, with a partner API key


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.