> ## 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.

# Quickstart

> Start with your AI agent, or make your first Widgetic API call in minutes

There are two ways to start: give a prompt to your AI agent and let it set Widgetic up, or make your first API call yourself.

## Start with your AI agent

Copy a prompt into Claude Code, Cursor, Codex, VS Code or any coding agent. It installs Widgetic for you and checks that it works, so you do not install or configure anything by hand. Choose how your agent reaches Widgetic:

> [tab] MCP server
>
> The agent connects to the Widgetic MCP server. You sign in to Widgetic in the browser, so there is no API key to copy. Best for building widgets in a conversation.
>
> Installs Widgetic in your assistant by adding the Widgetic MCP server to your client, waits while you sign in in the browser (no API key), then checks the connection with `get_profile`.
>
> Install Widgetic in this assistant by connecting the Widgetic MCP server.
>
> The server is remote (Streamable HTTP) at `https://mcp.widgetic.com` and signs in with OAuth in the browser, so do not ask me for an API key.
>
> 1. Work out which client you are running in and add the server under the name `widgetic`, keeping the servers that are already configured:
>    * Claude Code: run `claude mcp add --transport http widgetic https://mcp.widgetic.com`
>    * Codex: add a `[mcp_servers.widgetic]` table with `url = "https://mcp.widgetic.com"` to `~/.codex/config.toml`, then run `codex mcp login widgetic`
>    * Cursor: add a `widgetic` entry with `"url": "https://mcp.widgetic.com"` to `mcpServers` in `.cursor/mcp.json`
>    * VS Code: add a `widgetic` entry with `"type": "http"` and `"url": "https://mcp.widgetic.com"` to `servers` in `.vscode/mcp.json`
>    * Any other client: tell me where it asks for an MCP server address, give me the address, and stop.
> 2. Tell me what to click or run to finish the sign-in (a browser window opens, I sign in to Widgetic and choose Allow), then wait until I say it is done.
> 3. Call the `get_profile` tool and tell me which account and workspace are connected. If the connection is refused because the plan does not include API access, say so and stop.
>
> To do the same by hand, see [Connect your assistant](https://docs.widgetic.com/docs/agents/connect.md).

> [tab] Command line
>
> The agent installs the `widgetic` command line. Best for scripts, CI and agents that run shell commands. It needs Node 22.12 or later and an API key from [**Settings** > **API Keys**](https://widgetic.com/workspaces?settings=api-keys) in the dashboard.
>
> Installs `@widgetic/cli`, adds a short Widgetic section to `AGENTS.md`, and checks the setup with `widgetic doctor`. The API key stays in your own terminal.
>
> Install the Widgetic command line in this project.
>
> 1. Run `node --version`. The CLI needs Node 22.12 or newer: if mine is older, tell me and stop.
> 2. Run `npm install -g @widgetic/cli`, then `widgetic --version`.
> 3. Run `widgetic docs` and read what it prints: it is the guide for AI agents, and it matches the version you just installed.
> 4. Add the note below to AGENTS.md. Create the file if it is missing, and skip this step if it already has a Widgetic section.
> 5. Run `widgetic doctor`. If its API key line is not ok, tell me to make a key under Settings > API Keys in the dashboard and run `widgetic auth login` in my own terminal (it asks for the key without showing it), or to start you with `WIDGETIC_API_KEY` set, and wait until I say it is done. Never ask me to paste the key into the chat, put it in a command argument, or write it to a file in this project.
> 6. Run `widgetic doctor` again and tell me what it reports, including the workspace.
>
> The note for AGENTS.md:
>
> ```markdown theme={"theme":"css-variables"}
> ## Widgetic
>
> - Before you run `widgetic`, run `widgetic docs` and read what it prints. `widgetic docs index` lists every command, and `widgetic schema api GROUP COMMAND` or `widgetic schema mcp COMMAND` shows the flags of one.
> - Add `--json` when you parse the output, and `--dry-run` before anything that changes the Widgetic account.
> - `widgetic mcp` builds and edits widgets and needs an API key made with full access. `widgetic api` is the REST API.
> - A build stays a draft unless you pass `--publish`. Publishing replaces what embeds show, so ask first.
> - Before you create or change anything, say which workspace `widgetic doctor` reports.
> - Never put an API key in a command argument, in this repository or in the chat: it comes from `WIDGETIC_API_KEY` or `widgetic auth login`.
> ```
>
> To do the same by hand, see [CLI getting started](https://docs.widgetic.com/docs/cli/getting-started.md).

Then ask for something real:

Saves four sample portraits in your media library, builds a gallery of four people from them as a draft, shows the preview, then publishes it and returns the embed code once you approve. Uses 1 credit.

Use Widgetic to build a gallery of four people titled "Team gallery".

1. Save these four pictures in my Widgetic media library, in a folder called "Team gallery", and keep them in this order:
   * `https://docs.widgetic.com/images/quickstart/tom-kelich.png`
   * `https://docs.widgetic.com/images/quickstart/aisha-rahman.png`
   * `https://docs.widgetic.com/images/quickstart/maya-lindgren.png`
   * `https://docs.widgetic.com/images/quickstart/lena-hartmann.png`
2. Build the gallery from those four pictures, on a white card, as a grid of two by two. Each picture is a portrait drawn in blue dots on a transparent background: show it as it is, without cropping, tinting or framing it. The dots of a portrait turn black while the mouse is over it. Clicking a portrait brings it to the front, large, with the name and the role under it and a round back button at the top left. Clicking the portrait again, or the back button, returns to the grid. The people, in the order of the pictures:
   * Tom Kelich, Product Manager
   * Aisha Rahman, Head of Design
   * Maya Lindgren, Customer Success
   * Lena Hartmann, Marketing Lead
3. Keep it as a draft and show me the preview. When I say it looks right, publish it and give me the embed code.

The prompt links to four sample portraits. Swap them for links to your own pictures (they must start with `https://`) and change the words to the widget you need. Building a widget uses 1 credit, and the agent publishes only after you say so.

Prefer to call the REST API yourself? Continue below.

## Prerequisites

Before you begin, make sure you have:

1. A Widgetic account ([sign up here](https://widgetic.com/signup))
2. A workspace on a paid plan, because an API key works only while its workspace has one (see [Keys and your workspace plan](https://docs.widgetic.com/docs/authentication.md#keys-and-your-workspace-plan))
3. A basic understanding of REST APIs

## Step 1: Get Your API Key

1. Log in to your [Widgetic dashboard](https://widgetic.com/workspaces)
2. Open [**Settings** > **API Keys**](https://widgetic.com/workspaces?settings=api-keys) in the workspace you want the key for (the link opens the one you used last, or your first)
3. Select **Create key**, name the key, and choose what it may do. **Full access** is the simplest way to start. **Content**, **Read only** and **Custom** limit a key to what its application needs: see [Choose how much a key may do](https://docs.widgetic.com/docs/api-keys.md#choose-how-much-a-key-may-do)
4. Copy your API key (it starts with `wdg_org_`: it is the key of the workspace you made it in, and works in that workspace only)

> [!WARNING]
>
> Keep your API key secure! Never expose it in client-side code or public repositories.

## Step 2: Check Your Key

Ask the API what the key is. The answer says the key is valid and which workspace it works in:

```bash cURL theme={"theme":"css-variables"}
curl -X GET "https://api.widgetic.com/v1/tokens/validate" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```javascript JavaScript theme={"theme":"css-variables"}
const response = await fetch('https://api.widgetic.com/v1/tokens/validate', {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});

console.log(await response.json());
```

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

const tokensApi = new TokensApi('YOUR_API_KEY');
const check = await tokensApi.validateToken();
console.log(check.data?.workspace);
```

```json theme={"theme":"css-variables"}
{
  "success": true,
  "data": {
    "valid": true,
    "tokenType": "api_key",
    "workspace": { "id": "5f1c1a6e-2f0c-4f3a-9d0f-6a2a3a1c9b7e", "name": "Studio" }
  }
}
```

A `401` means the key is wrong or was deleted. See [Errors](https://docs.widgetic.com/api-reference/errors.md) for what else the API can say.

## Step 3: List Your Widgets

Install the library for your language, then list the widgets your workspace owns, one page of 20. A new workspace has none yet, so the list can be empty.

```bash TypeScript theme={"theme":"css-variables"}
npm install @widgetic/api-sdk-ts
```

```bash Python theme={"theme":"css-variables"}
pip install api-sdk-py
```

```bash Go theme={"theme":"css-variables"}
go get github.com/widgetic/api-sdk-go
```

```xml Java theme={"theme":"css-variables"}
<dependency>
  <groupId>com.widgetic</groupId>
  <artifactId>api-sdk-java</artifactId>
  <version>1.11.151</version>
</dependency>

<!-- Gradle: implementation("com.widgetic:api-sdk-java:1.11.151") -->
```

```bash C# theme={"theme":"css-variables"}
dotnet add package Widgetic.ApiSdk.Cs
```

```bash Ruby theme={"theme":"css-variables"}
gem install api-sdk-rb
```

```bash PHP theme={"theme":"css-variables"}
composer require widgetic/api-sdk-php
```

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

const widgetsApi = new WidgetsApi(process.env.WIDGETIC_API_KEY!);

const result = await widgetsApi.getWidgets({
  page: 1,
  size: 20,
});
console.log(result);
```

```python Python theme={"theme":"css-variables"}
import os

import api_sdk_py

configuration = api_sdk_py.Configuration(access_token=os.environ["WIDGETIC_API_KEY"])

with api_sdk_py.ApiClient(configuration) as api_client:
    widgets_api = api_sdk_py.WidgetsApi(api_client)
    result = widgets_api.get_widgets(page=1, size=20)
    print(result)
```

```go Go theme={"theme":"css-variables"}
package main

import (
	"context"
	"fmt"
	"os"

	widgetic "github.com/widgetic/api-sdk-go"
)

func main() {
	ctx := context.WithValue(context.Background(), widgetic.ContextAccessToken, os.Getenv("WIDGETIC_API_KEY"))
	client := widgetic.NewAPIClient(widgetic.NewConfiguration())

	result, _, err := client.WidgetsAPI.GetWidgets(ctx).Page(1).Size(20).Execute()
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	fmt.Println(result)
}
```

```java Java theme={"theme":"css-variables"}
import com.widgetic.api.ApiClient;
import com.widgetic.api.ApiException;
import com.widgetic.api.Configuration;
import com.widgetic.api.api.WidgetsApi;

public class Example {
    public static void main(String[] args) throws ApiException {
        ApiClient client = Configuration.getDefaultApiClient();
        client.setBearerToken(System.getenv("WIDGETIC_API_KEY"));

        WidgetsApi widgetsApi = new WidgetsApi(client);

        var result = widgetsApi.getWidgets(1, 20, null, null, null);
        System.out.println(result);
    }
}
```

```csharp C# theme={"theme":"css-variables"}
using System;
using Widgetic.ApiSdk.Cs.Api;
using Widgetic.ApiSdk.Cs.Client;

var configuration = new Configuration
{
    AccessToken = Environment.GetEnvironmentVariable("WIDGETIC_API_KEY")!,
};
var widgetsApi = new WidgetsApi(configuration);

var result = widgetsApi.GetWidgets(page: 1, size: 20);
Console.WriteLine(result);
```

```ruby Ruby theme={"theme":"css-variables"}
require 'api-sdk-rb'

ApiSdkRb.configure do |config|
  config.access_token = ENV['WIDGETIC_API_KEY']
end

widgets_api = ApiSdkRb::WidgetsApi.new

result = widgets_api.get_widgets(page: 1, size: 20)
puts result
```

```php PHP theme={"theme":"css-variables"}
<?php

require_once __DIR__ . '/vendor/autoload.php';

use WidgeticApi\Api\WidgetsApi;
use WidgeticApi\Configuration;

$config = Configuration::getDefaultConfiguration()->setAccessToken(getenv('WIDGETIC_API_KEY'));
$widgetsApi = new WidgetsApi(new GuzzleHttp\Client(), $config);

$result = $widgetsApi->getWidgets(page: 1, size: 20);
print_r($result);
```

Put your key in `WIDGETIC_API_KEY` first, as [Get started](https://docs.widgetic.com/docs/sdks/getting-started.md#2-make-an-api-key) shows. Without a library, the same call is:

```bash theme={"theme":"css-variables"}
curl -X GET "https://api.widgetic.com/v1/widgets?page=1&size=20" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Step 4: Explore the API

Now that you're authenticated, here are some common next steps:

> [card] [Widgets](https://docs.widgetic.com/docs/api/widgets.md)
>
> Create and manage the widgets in your account

> [card] [Create a Canvas](https://docs.widgetic.com/docs/api/canvases.md)
>
> Start designing a new widget

> [card] [Get Compositions](https://docs.widgetic.com/docs/api/compositions.md)
>
> View your widget compositions

> [card] [Check Entitlements](https://docs.widgetic.com/api-reference/introduction.md)
>
> See access levels and entitlement endpoints

## Next Steps

**1. Learn Authentication**

Understand the different [authentication methods](https://docs.widgetic.com/docs/authentication.md) available.

**2. Go Further with an SDK**

Page through lists, create things once and handle errors with [the SDKs](https://docs.widgetic.com/docs/sdks/requests-and-errors.md).

**3. Choose Your Path**

* **Partners**: Start with [Partner Overview](https://docs.widgetic.com/docs/partners/overview.md)
* **Self-Serve**: Start with [API Overview](https://docs.widgetic.com/docs/api/overview.md)

**4. Explore Examples**

Check out our [code examples](https://docs.widgetic.com/resources/examples.md) for common use cases.


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