# Broadcast actions on your website

Embed potentialAction JSON-LD on your pages so visiting LLMs can discover, fill, and invoke your services — the pattern this site itself uses.

> HTML version: https://staging.agentdb.com/website-actions — this file (/docs/website-actions.md) is its markdown twin.

## Anatomy of a broadcast action

Embed a Schema.org `potentialAction` in your page's JSON-LD and any LLM that
reads your markup discovers what your service can do. Three parts:

1. **The action `@type`** — the verb (`CreateAction`, `SearchAction`,
   `OrderAction`, …).
2. **`target`** — an `EntryPoint` with `urlTemplate`, `httpMethod`, and
   `contentType`: where and how to invoke it.
3. **`*-input`** — `PropertyValueSpecification` nodes declaring the required
   inputs (`valueName`, `valueRequired`), so an agent knows what to send
   before it sends it.

## Worked example — a storefront agents can order from

Demo Roasters, a coffee shop, backs its site with AgentDB and embeds this
node on its order page (this snippet is a fixture validated by this site's
CI):

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "WebPage",
  "name": "Order coffee — Demo Roasters",
  "description": "Order single-origin coffee for delivery.",
  "potentialAction": [
    {
      "@type": "CreateAction",
      "name": "Place an order",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "${API}/action",
        "httpMethod": "POST",
        "contentType": "application/ld+json"
      },
      "object-input": {
        "@type": "PropertyValueSpecification",
        "valueName": "object",
        "valueRequired": true,
        "description": "An Order node: orderedItem (Product), customer (Person with email)."
      }
    }
  ]
}
```

**The visiting-LLM read path:** an agent lands on the page, reads the
`ld+json`, sees `CreateAction` → `EntryPoint` → `object-input`, and knows to
`POST` an `Order` node to the target. This is the request it sends —
executed against a live instance in this site's CI:

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "CreateAction",
  "object": {
    "@type": "Order",
    "identifier": "site-fixture:order-1",
    "orderedItem": {
      "@type": "Product",
      "identifier": "site-fixture:coffee-ethiopia",
      "name": "Ethiopia Yirgacheffe, 250g"
    },
    "customer": {
      "@type": "Person",
      "identifier": "site-fixture:customer-1",
      "name": "Visiting Agent's Human"
    }
  }
}
```

The shop's fulfillment agent finds it later by its key:

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "FindAction",
  "identifier": "site-fixture:order-1"
}
```

## Claim your own IRIs

Entities can be addressed by your site's own URLs: send an absolute IRI as
`@id` on create and the entity is serialized by that IRI everywhere — your
product page URL becomes the database key agents cite:

```jsonld
{
  "@context": "https://schema.org/",
  "@type": "CreateAction",
  "object": {
    "@type": "Product",
    "@id": "https://demo-roasters.example/products/yirgacheffe-250",
    "name": "Ethiopia Yirgacheffe, 250g",
    "description": "Entity addressed by the shop's own product IRI."
  }
}
```

IRIs are unique per app (re-claiming one is a `409` conflict) and immutable
once set. For a stable key **without** IRI semantics, use `identifier`
instead — creates upsert on it. Details: [the contract](/start/contract).

## This site eats its own cooking

View source on any page here: the visible action blocks are projections of
the same `potentialAction` JSON-LD an agent reads. The full site model is
published at [/site.jsonld](/site.jsonld) — enough for an agent to rebuild
this site from its structured data alone.

Constrain the values agents may send with
[the vocab pack you define](/vocab).

## Actions declared on this page (JSON-LD)

```jsonld
[
  {
    "@type": "SearchAction",
    "name": "Search entities",
    "target": {
      "@type": "EntryPoint",
      "urlTemplate": "https://staging-api.agentdb.com/api/action",
      "httpMethod": "POST",
      "contentType": "application/ld+json"
    },
    "query-input": {
      "@type": "PropertyValueSpecification",
      "valueName": "query",
      "valueRequired": true
    }
  }
]
```
