# Create a widget for an agent

> POST /widgets. HeyRik API parameters and documented request and response examples.

Source: https://www.heyrik.com/docs/api-reference/widgets/post-widgets-create-a-widget-for-an-agent

POST https://server.heyrik.com/api/v1/widgets

## Headers

Authorization: Bearer $HEYRIK_API_KEY (required). Keep your key on your server.

## Parameters

- agency_id (string, required): Agent that answers.
- name (string): Label.
- allowed_origins (array): Domains allowed to embed it — lock this down.

## Notes

Set allowed_origins — a widget key with no origin lock can be embedded on any site and billed to you.

## Request example

```sh
curl -X POST https://server.heyrik.com/api/v1/widgets \
  -H "Authorization: Bearer $HEYRIK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agency_id": "agc_9f2a1c30",
    "name": "Website chat",
    "allowed_origins": ["https://acme.com"]
  }'
```
