> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer.jelliu.co/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.jelliu.co/_mcp/server.

# Create a widget

POST https://api.jelliu.co/api/widgets
Content-Type: application/json

Creates a web-chat widget bound to one of your agents and mints its widget API key. The widget is
active immediately: embed it with the script from `GET /widget-embed/{id}/embed.js`, which
identifies the widget by its id and does not need the key.

The plaintext key is returned **once**, as `plaintext_api_key` (64 hex characters). Only an
HMAC-SHA256 digest is stored, so it cannot be retrieved again and there is no rotation endpoint. You
only need it to call the public `/widget/*` endpoints from a server you control, in the
`x-widget-api-key` header.

`allowed_origins` must list at least one full origin (for example `https://www.example.com`);
runtime calls from any other page are refused. `agent_id` should be an agent of your workspace; this
endpoint does not look it up, and an id that matches no agent fails the database constraint with a
500\.

**Side effects.** Inserts the widget row and writes an audit entry.

**Idempotency.** Not idempotent. Retrying after a timeout creates a second widget with a different
id and key; list with `GET /api/widgets` first if unsure, and delete the duplicate.

**Webhook events.** `audit.log_recorded` when you subscribe to it. See [Webhooks](/webhooks).

**Access**

* **Required scope:** `write`.
* **Rate limit:** General API — 120 requests/min per workspace (200 on Growth, 300 on Business, 600 on Enterprise). See [Rate limits](/rate-limits).
* **Plan:** Available on every plan.

Reference: https://developer.jelliu.co/api-reference/widgets/post-widgets

## Authentication

- `Authorization` header (bearer token, required) — Workspace API key: `jl_` followed by 64 lowercase hex characters, created by the workspace owner in the dashboard (**Settings → API Keys**) and sent as `Authorization: Bearer jl_...`. The plaintext is shown once, at creation; Jelliu stores only a SHA-256 hash. A workspace can hold up to 25 active keys. | Scope | GET / HEAD | POST / PUT / PATCH / DELETE | Admin-only routes | | --- | --- | --- | --- | | `read` | Yes | No | No | | `write` | Yes | Yes | No | | `full` | Yes | Yes | Yes | Operations restricted to admins or owners reject keys without the `full` scope with `403`, and say so in their description. No key, whatever its scope, can mint or revoke API keys or rotate a webhook secret — that requires a signed-in owner session. A revoked key stops authenticating within about 10 seconds. See [Authentication](/authentication).

## Request

### Body (application/json)

This endpoint expects an object.

- `agent_id` (string, required) — Agent that answers visitors. Use an agent of your workspace; the id is not otherwise checked.
- `name` (string, required) — Internal name. Trimmed before validation.
- `allowed_origins` (list of string, required) — Full origins (URLs) the widget may be embedded on. At least one is required (`At least one origin is required`). Each entry must parse as a URL (`Invalid url`).
- `branding` (object, optional) — Widget look and copy. On write, `primary_color` is required whenever `branding` is sent, and the object REPLACES the stored branding (it is not merged). Widgets created without branding store `{}`, which is what `POST /widget/init` then returns.
  - `primary_color` (string, required) — Accent colour for the launcher and header, as `#RRGGBB` (error: `Must be a hex color like #FF0000`).
  - `logo_url` (string, optional) — Logo shown in the chat header.
  - `position` (enum, optional) — Corner for the launcher button. `bottom-right` puts it in the lower-right corner (the default when omitted); `bottom-left` in the lower-left corner.
    - Allowed values: `bottom-right`, `bottom-left`
  - `title` (string, optional) — Chat header title.
  - `subtitle` (string, optional) — Line under the title, such as expected reply time.
  - `quick_replies` (list of string, optional) — Up to 4 suggestion chips shown under the greeting (1 to 60 characters each).
  - `agent_names` (list of string, optional) — Display names (1 to 40 characters); the UI picks one per visitor and replies are signed with it.
  - `agent_avatars` (list of string, optional) — One picture per entry of `agent_names`, aligned by index. `https://` URLs or site-relative paths only (up to 500 characters); other values fail with `La imagen debe ser https o una ruta propia`.
  - `i18n` (map from string to object, optional) — Per-language greeting and quick replies, keyed by primary language subtag (`es`, `en`). The widget uses the block matching the visitor's language before falling back to `greeting_message`.
    - `greeting` (string, optional) — Greeting for this language.
    - `quick_replies` (list of string, optional) — Quick replies for this language.
- `voice_enabled` (boolean, optional, default: false) — Let visitors talk to the agent by voice.
- `greeting_message` (string, optional) — First message the chat shows. Trimmed; an empty string is treated as absent (stored as `null`).
- `rate_limit_rpm` (integer, optional, default: 30) — Requests per minute allowed per widget credential on the public `/widget/*` endpoints.

## Response

### 201

Widget created. The only response that ever contains `plaintext_api_key`.

- `data` (object, required) — A web-chat widget configuration. Returned by every `/api/widgets` endpoint. Field names are snake_case.
  - `plaintext_api_key` (string, required) — 64-character hex widget API key for the `x-widget-api-key` header. Shown only in this response; store it in a secret manager, never in a web page.
  - `id` (string, optional) — Widget id. Also the public credential used by the embed script (`x-widget-id` / `wid`).
  - `tenant_id` (string, optional) — Workspace that owns the widget.
  - `agent_id` (string, optional) — Agent that answers the widget's visitors (text and voice).
  - `name` (string, optional) — Internal name shown in the dashboard; visitors do not see it.
  - `allowed_origins` (list of string, optional) — Origins allowed to embed the widget. Runtime calls must send an `x-widget-parent-origin` that matches one entry: scheme and port exactly, hostname equal modulo one leading `www.`. `*` never matches.
  - `branding` (object, optional) — Widget look and copy. On write, `primary_color` is required whenever `branding` is sent, and the object REPLACES the stored branding (it is not merged). Widgets created without branding store `{}`, which is what `POST /widget/init` then returns.
    - `primary_color` (string, required) — Accent colour for the launcher and header, as `#RRGGBB` (error: `Must be a hex color like #FF0000`).
    - `logo_url` (string, optional) — Logo shown in the chat header.
    - `position` (enum, optional) — Corner for the launcher button. `bottom-right` puts it in the lower-right corner (the default when omitted); `bottom-left` in the lower-left corner.
      - Allowed values: `bottom-right`, `bottom-left`
    - `title` (string, optional) — Chat header title.
    - `subtitle` (string, optional) — Line under the title, such as expected reply time.
    - `quick_replies` (list of string, optional) — Up to 4 suggestion chips shown under the greeting (1 to 60 characters each).
    - `agent_names` (list of string, optional) — Display names (1 to 40 characters); the UI picks one per visitor and replies are signed with it.
    - `agent_avatars` (list of string, optional) — One picture per entry of `agent_names`, aligned by index. `https://` URLs or site-relative paths only (up to 500 characters); other values fail with `La imagen debe ser https o una ruta propia`.
    - `i18n` (map from string to object, optional) — Per-language greeting and quick replies, keyed by primary language subtag (`es`, `en`). The widget uses the block matching the visitor's language before falling back to `greeting_message`.
      - `greeting` (string, optional) — Greeting for this language.
      - `quick_replies` (list of string, optional) — Quick replies for this language.
  - `voice_enabled` (boolean, optional) — Whether visitors can talk to the agent by voice (`POST /widget/voice-session`).
  - `greeting_message` (string, optional, nullable) — First message the chat shows before the visitor writes; `null` when not set.
  - `rate_limit_rpm` (integer, optional) — Requests per minute allowed per widget credential on the public `/widget/*` endpoints (default 30). The widget id and the API key are counted separately.
  - `api_key` (string, optional) — HMAC-SHA256 digest (64 hex characters) of the widget API key as stored. It is NOT the key and cannot authenticate. The plaintext key is returned only once, as `plaintext_api_key`, in the `POST /api/widgets` response.
  - `is_active` (boolean, optional) — `false` once the widget is deleted. Cannot be changed through the API.
  - `created_at` (datetime, optional) — When the widget was created.
  - `updated_at` (datetime, optional) — When the widget was last updated.
  - `deleted_at` (datetime, optional, nullable) — Always `null` in API responses; deleted widgets are not returned.

## Errors

### 400 Bad Request Error

`Invalid widget input`. `details` is Zod's flattened error: `formErrors` for the body as a whole, `fieldErrors` keyed by top-level field (nested `branding` problems are reported under `branding`).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 401 Unauthorized Error

No usable credential. Either the `Authorization` header is missing or is not a well-formed `Bearer jl_…` key, or the key is unknown, revoked or expired. Do not retry with the same key. See [Authentication](/authentication#401-unauthorized).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 403 Forbidden Error

The API key lacks the `write` scope, or the workspace is suspended.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 429 Too Many Requests Error

Rate limit exceeded for the current 60-second window (`RATE_LIMIT_EXCEEDED`). Wait `Retry-After` seconds, then retry. The `message` differs per limiter; the code does not. See [Rate limits](/rate-limits).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 500 Internal Server Error

`agent_id` matches no agent (database constraint), or another unexpected failure.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

## Examples

### Widgets_postWidgets_example

**Request**

```json
undefined
```

**Response**

```json
{
  "data": {
    "plaintext_api_key": "3462145765a6b6c238f79a1e13e10361c24d1740ec30d27bea22dd4106c04284",
    "id": "84b5aa0e-f6d6-4d88-b3ad-cd7a5a2aeb9e",
    "tenant_id": "58ffb2a3-7704-4790-bf60-a7235e42d0e4",
    "agent_id": "efac2e32-c698-4018-974d-bbf4500916b5",
    "name": "Sitio web principal",
    "allowed_origins": [
      "https://www.clinicasonrisa.co"
    ],
    "branding": {
      "primary_color": "#1C1D2B",
      "position": "bottom-right",
      "title": "Habla con nosotros"
    },
    "voice_enabled": false,
    "greeting_message": "¡Hola! ¿En qué te puedo ayudar?",
    "rate_limit_rpm": 30,
    "api_key": "1dbac0de07f71908b42f2b1fb25f87f37073d231959ec319cb79296f14425645",
    "is_active": true,
    "created_at": "2026-09-15T13:05:44.902Z",
    "updated_at": "2026-09-15T13:05:44.902Z",
    "deleted_at": null
  }
}
```

**SDK Code**

```python Widgets_postWidgets_example
import requests

url = "https://api.jelliu.co/api/widgets"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Widgets_postWidgets_example
const url = 'https://api.jelliu.co/api/widgets';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Widgets_postWidgets_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.jelliu.co/api/widgets"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Widgets_postWidgets_example
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/widgets")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Widgets_postWidgets_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/widgets")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Widgets_postWidgets_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/widgets', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Widgets_postWidgets_example
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/widgets");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Widgets_postWidgets_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/widgets")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Required fields only

**Request**

```json
{
  "agent_id": "efac2e32-c698-4018-974d-bbf4500916b5",
  "name": "Sitio web principal",
  "allowed_origins": [
    "https://www.clinicasonrisa.co"
  ]
}
```

**Response**

```json
{
  "data": {
    "plaintext_api_key": "3462145765a6b6c238f79a1e13e10361c24d1740ec30d27bea22dd4106c04284",
    "id": "84b5aa0e-f6d6-4d88-b3ad-cd7a5a2aeb9e",
    "tenant_id": "58ffb2a3-7704-4790-bf60-a7235e42d0e4",
    "agent_id": "efac2e32-c698-4018-974d-bbf4500916b5",
    "name": "Sitio web principal",
    "allowed_origins": [
      "https://www.clinicasonrisa.co"
    ],
    "branding": {
      "primary_color": "#1C1D2B",
      "position": "bottom-right",
      "title": "Habla con nosotros"
    },
    "voice_enabled": false,
    "greeting_message": "¡Hola! ¿En qué te puedo ayudar?",
    "rate_limit_rpm": 30,
    "api_key": "1dbac0de07f71908b42f2b1fb25f87f37073d231959ec319cb79296f14425645",
    "is_active": true,
    "created_at": "2026-09-15T13:05:44.902Z",
    "updated_at": "2026-09-15T13:05:44.902Z",
    "deleted_at": null
  }
}
```

**SDK Code**

```python Required fields only
import requests

url = "https://api.jelliu.co/api/widgets"

payload = {
    "agent_id": "efac2e32-c698-4018-974d-bbf4500916b5",
    "name": "Sitio web principal",
    "allowed_origins": ["https://www.clinicasonrisa.co"]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Required fields only
const url = 'https://api.jelliu.co/api/widgets';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"agent_id":"efac2e32-c698-4018-974d-bbf4500916b5","name":"Sitio web principal","allowed_origins":["https://www.clinicasonrisa.co"]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Required fields only
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.jelliu.co/api/widgets"

	payload := strings.NewReader("{\n  \"agent_id\": \"efac2e32-c698-4018-974d-bbf4500916b5\",\n  \"name\": \"Sitio web principal\",\n  \"allowed_origins\": [\n    \"https://www.clinicasonrisa.co\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Required fields only
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/widgets")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"agent_id\": \"efac2e32-c698-4018-974d-bbf4500916b5\",\n  \"name\": \"Sitio web principal\",\n  \"allowed_origins\": [\n    \"https://www.clinicasonrisa.co\"\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Required fields only
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/widgets")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"agent_id\": \"efac2e32-c698-4018-974d-bbf4500916b5\",\n  \"name\": \"Sitio web principal\",\n  \"allowed_origins\": [\n    \"https://www.clinicasonrisa.co\"\n  ]\n}")
  .asString();
```

```php Required fields only
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/widgets', [
  'body' => '{
  "agent_id": "efac2e32-c698-4018-974d-bbf4500916b5",
  "name": "Sitio web principal",
  "allowed_origins": [
    "https://www.clinicasonrisa.co"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Required fields only
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/widgets");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"agent_id\": \"efac2e32-c698-4018-974d-bbf4500916b5\",\n  \"name\": \"Sitio web principal\",\n  \"allowed_origins\": [\n    \"https://www.clinicasonrisa.co\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Required fields only
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "agent_id": "efac2e32-c698-4018-974d-bbf4500916b5",
  "name": "Sitio web principal",
  "allowed_origins": ["https://www.clinicasonrisa.co"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/widgets")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Branding, voice, greeting and a custom rate limit

**Request**

```json
{
  "agent_id": "efac2e32-c698-4018-974d-bbf4500916b5",
  "name": "Sitio web principal",
  "allowed_origins": [
    "https://www.clinicasonrisa.co",
    "https://reservas.clinicasonrisa.co"
  ],
  "branding": {
    "primary_color": "#1C1D2B",
    "logo_url": "https://www.clinicasonrisa.co/logo.png",
    "position": "bottom-right",
    "title": "Habla con nosotros",
    "subtitle": "Respondemos en minutos",
    "quick_replies": [
      "Agendar una cita",
      "Ver precios",
      "Horarios"
    ],
    "agent_names": [
      "Laura",
      "Andrés"
    ],
    "agent_avatars": [
      "/img/equipo/laura.jpg",
      "/img/equipo/andres.jpg"
    ],
    "i18n": {
      "en": {
        "greeting": "Hi! How can I help you?",
        "quick_replies": [
          "Book an appointment"
        ]
      },
      "es": {
        "greeting": "¡Hola! ¿En qué te puedo ayudar?",
        "quick_replies": [
          "Agendar una cita"
        ]
      }
    }
  },
  "voice_enabled": true,
  "greeting_message": "¡Hola! Soy del equipo de Clínica Sonrisa. ¿En qué te puedo ayudar?",
  "rate_limit_rpm": 60
}
```

**Response**

```json
{
  "data": {
    "plaintext_api_key": "3462145765a6b6c238f79a1e13e10361c24d1740ec30d27bea22dd4106c04284",
    "id": "84b5aa0e-f6d6-4d88-b3ad-cd7a5a2aeb9e",
    "tenant_id": "58ffb2a3-7704-4790-bf60-a7235e42d0e4",
    "agent_id": "efac2e32-c698-4018-974d-bbf4500916b5",
    "name": "Sitio web principal",
    "allowed_origins": [
      "https://www.clinicasonrisa.co"
    ],
    "branding": {
      "primary_color": "#1C1D2B",
      "position": "bottom-right",
      "title": "Habla con nosotros"
    },
    "voice_enabled": false,
    "greeting_message": "¡Hola! ¿En qué te puedo ayudar?",
    "rate_limit_rpm": 30,
    "api_key": "1dbac0de07f71908b42f2b1fb25f87f37073d231959ec319cb79296f14425645",
    "is_active": true,
    "created_at": "2026-09-15T13:05:44.902Z",
    "updated_at": "2026-09-15T13:05:44.902Z",
    "deleted_at": null
  }
}
```

**SDK Code**

```python Branding, voice, greeting and a custom rate limit
import requests

url = "https://api.jelliu.co/api/widgets"

payload = {
    "agent_id": "efac2e32-c698-4018-974d-bbf4500916b5",
    "name": "Sitio web principal",
    "allowed_origins": ["https://www.clinicasonrisa.co", "https://reservas.clinicasonrisa.co"],
    "branding": {
        "primary_color": "#1C1D2B",
        "logo_url": "https://www.clinicasonrisa.co/logo.png",
        "position": "bottom-right",
        "title": "Habla con nosotros",
        "subtitle": "Respondemos en minutos",
        "quick_replies": ["Agendar una cita", "Ver precios", "Horarios"],
        "agent_names": ["Laura", "Andrés"],
        "agent_avatars": ["/img/equipo/laura.jpg", "/img/equipo/andres.jpg"],
        "i18n": {
            "en": {
                "greeting": "Hi! How can I help you?",
                "quick_replies": ["Book an appointment"]
            },
            "es": {
                "greeting": "¡Hola! ¿En qué te puedo ayudar?",
                "quick_replies": ["Agendar una cita"]
            }
        }
    },
    "voice_enabled": True,
    "greeting_message": "¡Hola! Soy del equipo de Clínica Sonrisa. ¿En qué te puedo ayudar?",
    "rate_limit_rpm": 60
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Branding, voice, greeting and a custom rate limit
const url = 'https://api.jelliu.co/api/widgets';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"agent_id":"efac2e32-c698-4018-974d-bbf4500916b5","name":"Sitio web principal","allowed_origins":["https://www.clinicasonrisa.co","https://reservas.clinicasonrisa.co"],"branding":{"primary_color":"#1C1D2B","logo_url":"https://www.clinicasonrisa.co/logo.png","position":"bottom-right","title":"Habla con nosotros","subtitle":"Respondemos en minutos","quick_replies":["Agendar una cita","Ver precios","Horarios"],"agent_names":["Laura","Andrés"],"agent_avatars":["/img/equipo/laura.jpg","/img/equipo/andres.jpg"],"i18n":{"en":{"greeting":"Hi! How can I help you?","quick_replies":["Book an appointment"]},"es":{"greeting":"¡Hola! ¿En qué te puedo ayudar?","quick_replies":["Agendar una cita"]}}},"voice_enabled":true,"greeting_message":"¡Hola! Soy del equipo de Clínica Sonrisa. ¿En qué te puedo ayudar?","rate_limit_rpm":60}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Branding, voice, greeting and a custom rate limit
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.jelliu.co/api/widgets"

	payload := strings.NewReader("{\n  \"agent_id\": \"efac2e32-c698-4018-974d-bbf4500916b5\",\n  \"name\": \"Sitio web principal\",\n  \"allowed_origins\": [\n    \"https://www.clinicasonrisa.co\",\n    \"https://reservas.clinicasonrisa.co\"\n  ],\n  \"branding\": {\n    \"primary_color\": \"#1C1D2B\",\n    \"logo_url\": \"https://www.clinicasonrisa.co/logo.png\",\n    \"position\": \"bottom-right\",\n    \"title\": \"Habla con nosotros\",\n    \"subtitle\": \"Respondemos en minutos\",\n    \"quick_replies\": [\n      \"Agendar una cita\",\n      \"Ver precios\",\n      \"Horarios\"\n    ],\n    \"agent_names\": [\n      \"Laura\",\n      \"Andrés\"\n    ],\n    \"agent_avatars\": [\n      \"/img/equipo/laura.jpg\",\n      \"/img/equipo/andres.jpg\"\n    ],\n    \"i18n\": {\n      \"en\": {\n        \"greeting\": \"Hi! How can I help you?\",\n        \"quick_replies\": [\n          \"Book an appointment\"\n        ]\n      },\n      \"es\": {\n        \"greeting\": \"¡Hola! ¿En qué te puedo ayudar?\",\n        \"quick_replies\": [\n          \"Agendar una cita\"\n        ]\n      }\n    }\n  },\n  \"voice_enabled\": true,\n  \"greeting_message\": \"¡Hola! Soy del equipo de Clínica Sonrisa. ¿En qué te puedo ayudar?\",\n  \"rate_limit_rpm\": 60\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Branding, voice, greeting and a custom rate limit
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/widgets")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"agent_id\": \"efac2e32-c698-4018-974d-bbf4500916b5\",\n  \"name\": \"Sitio web principal\",\n  \"allowed_origins\": [\n    \"https://www.clinicasonrisa.co\",\n    \"https://reservas.clinicasonrisa.co\"\n  ],\n  \"branding\": {\n    \"primary_color\": \"#1C1D2B\",\n    \"logo_url\": \"https://www.clinicasonrisa.co/logo.png\",\n    \"position\": \"bottom-right\",\n    \"title\": \"Habla con nosotros\",\n    \"subtitle\": \"Respondemos en minutos\",\n    \"quick_replies\": [\n      \"Agendar una cita\",\n      \"Ver precios\",\n      \"Horarios\"\n    ],\n    \"agent_names\": [\n      \"Laura\",\n      \"Andrés\"\n    ],\n    \"agent_avatars\": [\n      \"/img/equipo/laura.jpg\",\n      \"/img/equipo/andres.jpg\"\n    ],\n    \"i18n\": {\n      \"en\": {\n        \"greeting\": \"Hi! How can I help you?\",\n        \"quick_replies\": [\n          \"Book an appointment\"\n        ]\n      },\n      \"es\": {\n        \"greeting\": \"¡Hola! ¿En qué te puedo ayudar?\",\n        \"quick_replies\": [\n          \"Agendar una cita\"\n        ]\n      }\n    }\n  },\n  \"voice_enabled\": true,\n  \"greeting_message\": \"¡Hola! Soy del equipo de Clínica Sonrisa. ¿En qué te puedo ayudar?\",\n  \"rate_limit_rpm\": 60\n}"

response = http.request(request)
puts response.read_body
```

```java Branding, voice, greeting and a custom rate limit
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.jelliu.co/api/widgets")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"agent_id\": \"efac2e32-c698-4018-974d-bbf4500916b5\",\n  \"name\": \"Sitio web principal\",\n  \"allowed_origins\": [\n    \"https://www.clinicasonrisa.co\",\n    \"https://reservas.clinicasonrisa.co\"\n  ],\n  \"branding\": {\n    \"primary_color\": \"#1C1D2B\",\n    \"logo_url\": \"https://www.clinicasonrisa.co/logo.png\",\n    \"position\": \"bottom-right\",\n    \"title\": \"Habla con nosotros\",\n    \"subtitle\": \"Respondemos en minutos\",\n    \"quick_replies\": [\n      \"Agendar una cita\",\n      \"Ver precios\",\n      \"Horarios\"\n    ],\n    \"agent_names\": [\n      \"Laura\",\n      \"Andrés\"\n    ],\n    \"agent_avatars\": [\n      \"/img/equipo/laura.jpg\",\n      \"/img/equipo/andres.jpg\"\n    ],\n    \"i18n\": {\n      \"en\": {\n        \"greeting\": \"Hi! How can I help you?\",\n        \"quick_replies\": [\n          \"Book an appointment\"\n        ]\n      },\n      \"es\": {\n        \"greeting\": \"¡Hola! ¿En qué te puedo ayudar?\",\n        \"quick_replies\": [\n          \"Agendar una cita\"\n        ]\n      }\n    }\n  },\n  \"voice_enabled\": true,\n  \"greeting_message\": \"¡Hola! Soy del equipo de Clínica Sonrisa. ¿En qué te puedo ayudar?\",\n  \"rate_limit_rpm\": 60\n}")
  .asString();
```

```php Branding, voice, greeting and a custom rate limit
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.jelliu.co/api/widgets', [
  'body' => '{
  "agent_id": "efac2e32-c698-4018-974d-bbf4500916b5",
  "name": "Sitio web principal",
  "allowed_origins": [
    "https://www.clinicasonrisa.co",
    "https://reservas.clinicasonrisa.co"
  ],
  "branding": {
    "primary_color": "#1C1D2B",
    "logo_url": "https://www.clinicasonrisa.co/logo.png",
    "position": "bottom-right",
    "title": "Habla con nosotros",
    "subtitle": "Respondemos en minutos",
    "quick_replies": [
      "Agendar una cita",
      "Ver precios",
      "Horarios"
    ],
    "agent_names": [
      "Laura",
      "Andrés"
    ],
    "agent_avatars": [
      "/img/equipo/laura.jpg",
      "/img/equipo/andres.jpg"
    ],
    "i18n": {
      "en": {
        "greeting": "Hi! How can I help you?",
        "quick_replies": [
          "Book an appointment"
        ]
      },
      "es": {
        "greeting": "¡Hola! ¿En qué te puedo ayudar?",
        "quick_replies": [
          "Agendar una cita"
        ]
      }
    }
  },
  "voice_enabled": true,
  "greeting_message": "¡Hola! Soy del equipo de Clínica Sonrisa. ¿En qué te puedo ayudar?",
  "rate_limit_rpm": 60
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Branding, voice, greeting and a custom rate limit
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/widgets");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"agent_id\": \"efac2e32-c698-4018-974d-bbf4500916b5\",\n  \"name\": \"Sitio web principal\",\n  \"allowed_origins\": [\n    \"https://www.clinicasonrisa.co\",\n    \"https://reservas.clinicasonrisa.co\"\n  ],\n  \"branding\": {\n    \"primary_color\": \"#1C1D2B\",\n    \"logo_url\": \"https://www.clinicasonrisa.co/logo.png\",\n    \"position\": \"bottom-right\",\n    \"title\": \"Habla con nosotros\",\n    \"subtitle\": \"Respondemos en minutos\",\n    \"quick_replies\": [\n      \"Agendar una cita\",\n      \"Ver precios\",\n      \"Horarios\"\n    ],\n    \"agent_names\": [\n      \"Laura\",\n      \"Andrés\"\n    ],\n    \"agent_avatars\": [\n      \"/img/equipo/laura.jpg\",\n      \"/img/equipo/andres.jpg\"\n    ],\n    \"i18n\": {\n      \"en\": {\n        \"greeting\": \"Hi! How can I help you?\",\n        \"quick_replies\": [\n          \"Book an appointment\"\n        ]\n      },\n      \"es\": {\n        \"greeting\": \"¡Hola! ¿En qué te puedo ayudar?\",\n        \"quick_replies\": [\n          \"Agendar una cita\"\n        ]\n      }\n    }\n  },\n  \"voice_enabled\": true,\n  \"greeting_message\": \"¡Hola! Soy del equipo de Clínica Sonrisa. ¿En qué te puedo ayudar?\",\n  \"rate_limit_rpm\": 60\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Branding, voice, greeting and a custom rate limit
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "agent_id": "efac2e32-c698-4018-974d-bbf4500916b5",
  "name": "Sitio web principal",
  "allowed_origins": ["https://www.clinicasonrisa.co", "https://reservas.clinicasonrisa.co"],
  "branding": [
    "primary_color": "#1C1D2B",
    "logo_url": "https://www.clinicasonrisa.co/logo.png",
    "position": "bottom-right",
    "title": "Habla con nosotros",
    "subtitle": "Respondemos en minutos",
    "quick_replies": ["Agendar una cita", "Ver precios", "Horarios"],
    "agent_names": ["Laura", "Andrés"],
    "agent_avatars": ["/img/equipo/laura.jpg", "/img/equipo/andres.jpg"],
    "i18n": [
      "en": [
        "greeting": "Hi! How can I help you?",
        "quick_replies": ["Book an appointment"]
      ],
      "es": [
        "greeting": "¡Hola! ¿En qué te puedo ayudar?",
        "quick_replies": ["Agendar una cita"]
      ]
    ]
  ],
  "voice_enabled": true,
  "greeting_message": "¡Hola! Soy del equipo de Clínica Sonrisa. ¿En qué te puedo ayudar?",
  "rate_limit_rpm": 60
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/widgets")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```