# Build your own event site on https://informals.net

Your site gets the same API agents use: no keys to request, no private endpoints. Anything a person
can do on our pages, your site can do, and so can their agent.

## 1. Find things (no sign-in)

```
GET  https://informals.net/.well-known/oes.json          discovery: api, mcp, ical, signIn
GET  https://informals.net/api/tools                     every tool: input schema, output schema + example, scope
POST https://informals.net/api/tools/<tool>              JSON body = the tool's arguments
```

Public reads need no token: `get_series`, `find_series`, `find_events` (`series`, `from`, `to`),
`get_event`, `list_ticket_types`, `read_board`, `read_stream` (`latest: true` for recent activity).
Ids are URLs, e.g. a series `https://informals.net/s/<slug>` and its events `https://informals.net/s/<slug>/events/<event-slug>`.
CORS is open, so this works from a browser too. The calendar is `https://informals.net/ical?series=<series id>`.

## 2. Sign people in (OAuth 2.1, PKCE, public client)

Register your site once. No approval is needed:

```
curl -X POST https://informals.net/register -H 'content-type: application/json' -d '{
  "client_name": "Your site name",
  "redirect_uris": ["https://your.site/auth/callback"],
  "grant_types": ["authorization_code", "refresh_token"],
  "token_endpoint_auth_method": "none"
}'
```

Keep the `client_id` it returns in your config. (Or host a client metadata document at an https URL
and use that URL as the client_id.) Then:

1. Send the person to `https://informals.net/authorize` with `response_type=code`, `client_id`, `redirect_uri`,
   `scope` (space-separated, below), `state`, `code_challenge` (S256) and `code_challenge_method=S256`.
2. They sign in by email link and approve your site once. The screen names your site's domain.
   Later sign-ins with the same or fewer scopes skip that screen.
3. Your callback gets `code` and `state`. POST to `https://informals.net/token` (form-encoded):
   `grant_type=authorization_code`, `code`, `redirect_uri`, `client_id`, `code_verifier`.
4. Call tools with `Authorization: Bearer <access_token>`. Access tokens last an hour; refresh with
   `grant_type=refresh_token`, `refresh_token`, `client_id`. Keep tokens on your server, not in the page.

Scopes for a guest-facing site: `rsvp::write:self order::write:self ticket::write:self board:post:write:self`.
For hosts, ask again with more when they open your admin pages (people approve only what you ask for):
`event::write:organisers guests::read:organisers message::write:organisers ticket:token:read:checkin`
(`series::write:owner` to create series, `order::refund:organisers` to refund). Apps that send notices through
event links (`notify_linked_attendees`) or invite guests also need `message::write:organisers`.
Each tool's `scope` in `GET /api/tools` says exactly what it needs (null: any signed-in token, or none
for public tools).

## 3. The tools a site usually needs

| Page | Tools |
|---|---|
| Series home | `get_series`, `find_events` (upcoming: `from` = now; past: `to` = now) |
| Event page | `get_event` (sessions, ticket types, form.answerSchema, goingCount, spaceLeft, and with a token myGuest and myRole), `read_board`, `read_stream` |
| Register | free: `register` with `answers`; paid: `start_checkout` with `returnUrl`, then redirect to `checkoutUrl`; full: `join_waitlist`; offered a seat: `claim_offer`; `cancel_registration` |
| Account | `whoami`, `my_tickets` (ticket tokens for check-in, held orders with their checkoutUrl) |
| Hosts | `my_hosting`, `event_summary`, `list_guests`, `approve_guest`, `reject_guest`, `check_in`, `send_message`, and `create_event` / `update_event` / `add_ticket_type` / `publish_event` |

Registration forms are JSON Schema (`form.answerSchema`, per ticket type when it differs): render an
input per property and send the answers as an object.

Checkout: pass `returnUrl` on your own origin (the same origin as one of your redirect URIs) and the
person comes back to `returnUrl?order=<id>&checkout=paid` (or `cancelled`). The order shows up in
`my_tickets` and as `oes.order.placed` on the stream once paid.

## 4. Errors

A refusal is a non-2xx response with `{ "error": "<message for people>", "code": "<code>" }`:

| code | status | what to do |
|---|---|---|
| `invalid_token` | 401 | The token expired or was revoked: refresh, or sign in again |
| `sign_in_required` | 401 | Send the person through sign-in |
| `insufficient_scope` | 403 | Sign in again asking for `scope` (in the body) |
| `grant_required` | 403 | The person hasn't allowed `capability` (in the body) |
| `host_role_required` | 403 | The person isn't a host of this event |
| `not_found` / `unknown_tool` | 404 | |
| `invalid_input` | 400 | `issues` lists each field's problem |
| `rejected` | 400 | An event rule said no (full, not on sale, ...): show the message |

## 5. Live updates

Poll `read_stream` with `source` = an event or series and `after` = the last `cursor`. Each item is a
CloudEvent (`type` such as `oes.rsvp.created`, `oes.board.post.created`). Everyone sees only what
they may: pass the person's token to see their own items.

Webhooks: `create_subscription` with delivery {mode: "webhook", url} POSTs each matching CloudEvent,
signed per Standard Webhooks with the secret it returns once. MCP clients can use the MCP Events
extension instead (`events/list`, `events/subscribe`, `events/poll`). Both need the person to
have let that agent act proactively (`allow_proactive`, or the account page).

## 6. Your own layer: event links, extensions and reach

Building something unusual (events that wrap other events, side quests, mash-ups)? Keep its meaning in
your app and use three generic extension points:

- **Links.** `link_events { from, to, rel, note?, data? }` adds a typed edge from an event you host to
  any event you can see, with a rel you namespace yourself (`yourapp:wraps`). Many-to-many.
  `list_event_links { event, direction?, rel?, relPrefix? }` reads the graph (public). The linked-to
  event's hosts set `linkPolicy` (open, approval, links-only, closed) with `update_event` and use
  `moderate_link`.
- **Extensions.** `set_event_extension { event, namespace, data }` keeps up to 8 KB of your JSON on an
  event, served as `extensions.<namespace>` by `get_event`.
- **Reach.** `notify_linked_attendees { link, body, subject? }` tells the people going to the linked-to
  event about yours. We deliver it and you see only counts. People opt out per event or for everything,
  and there are rate limits (3 per link, 24 hours apart; each person gets at most 2 a day). On a Luma
  event, only people known here are reached.

The full guide: https://informals.net/.well-known/oes-event-links.md.

- **Feeds.** If your app publishes a lot, people will meet it through feeds rather than the firehose.
  Label what you generate (`set_event_labels`: test, generated, bulk, variant, or yourapp:value), keep
  A/B copies labelled `variant` or unlisted, and mind the daily publish quotas. Anyone can make a feed
  of everything your app publishes with `create_feed { rules: { clients: ["<your client id>"] } }`.
  The full guide: https://informals.net/.well-known/oes-feeds.md.

## 7. Outputs, scopes and limits

`GET https://informals.net/api/tools` gives each tool's `input` (JSON Schema), `output` (`{ schema, example, source }`) and
`scope`. `source: "declared"` schemas are written by hand; `"observed"` ones are inferred from the
platform's own test calls, so fields listed as required were always there. Fields get added, never
removed without notice. Over MCP, the same tools return the same JSON as text.

Limits, also in `oes.json` under `limits` (a refusal from one is `rejected`, with the limit in its message):

| Limit | New accounts |
|---|---|
| Series owned | 3 |
| Upcoming published events | 3 |
| Guests per event | 100 |
| Host messages a day | 5 |
| Board posts and introductions a day | 30 |
| Model tokens per agent a day (mark_fired usage) | 250,000 (trusted: 2,000,000) |
| Link notices | 3 per link, 24 hours apart; 2 a day per person from everyone |
| Extensions | 8 KB per namespace, 8 namespaces per event; link data 8 KB |
| Keywords | 20 per event, 40 characters each |
| Sign-in emails | 5 an hour per address |
| Events published a day | 10 (trusted: 500); 5,000 a day per app (OAuth client) for all its people |
| Upcoming public copies of one event | 3 (label extra ones `variant` or `test`, or make them unlisted) |
| Feeds | 10 per account; 10 items per publisher per feed a day; 20 submissions a day |

An account becomes trusted, and these lift, once it has hosted an event that has ended (with an end date) and had at least one guest checked in. A micro-event app reaches
the upcoming-events limit fastest: past events stop counting once they end, so cancel ones that won't happen, or ask for trusted.

## 8. Places and keywords

Events can carry coordinates and keywords, so any app (or agent) can find them by place and topic:

```
create_event / update_event  location: { name, address?, geo?: { latitude, longitude, precision? } }
                             keywords: ["trees", "backgammon"]
find_events                  near: { latitude, longitude }, radiusKm (default 5), keywords: [...]
```

Location stays private by default:

- The name, address and exact point are shown only to the event's hosts and its guests (going or checked in).
- Everyone else, and every stream item, gets only `location.geo` coarsened to the centre of a grid cell at
  the host's `precision`: `area` (about 1 km, the default), `street` (about 150 m) or `city` (about 8 km),
  with `uncertaintyMeters`. There is no way to publish the exact point to strangers.
- `find_events { near }` measures distance from the point the caller may see, so repeated searches can't
  narrow a cell down. Results come nearest first with `distanceKm`. The search point isn't stored.
- Coordinates are opt-in: events without `geo` never match `near`.

Keywords are lowercased, without `#`; `find_events { keywords }` matches any of them, and `text` searches
them too. The fields follow schema.org: `location.geo` is GeoCoordinates, `keywords` is keywords.

## 9. Handles and profiles

Every person has an id (a URL that never changes) and a public `handle`. New accounts get a random,
neutral one like `quiet-otter-4821`, or pick one on the sign-up form; it is never taken from the email.
`update_profile { handle?, name?, bio?, links?, fieldVisibility? }` changes them (null clears a field), and
returns the profile both as the person sees it and as strangers do (`asStrangersSeeIt`). An event's
`hosts` are person ids, and `get_person` shows strangers the handle plus only the fields marked public.
Accounts made before this change keep their old id; their handle can still be changed.

## 10. Payments and pools

`oes.json` `payments` says the processor and `mode`: `test` (Stripe test keys or the simulator, no real
money) or `live`. Selling anything paid, including donations, needs the series owner to finish Stripe
onboarding first (`connect_payments`): the platform never holds money for hosts, so there is no way to
pool money before a host is a Stripe merchant. Plan for it: have hosts connect once, ahead of their first
spontaneous event.

Every checkout pays the server's platform fee, taken from the host's payout as a Stripe application fee
(`oes.json` publishes it). On informals.net it is 3% of everything paid, tickets and donations alike, and
it applies whichever app the buyer uses. A server you run yourself sets its own (`OES_PLATFORM_FEE_BPS`,
zero by default).

**Your app's own fee.** An app can add a fee of its own on top, up to 20%, also from the host's payout:
1. Use a client metadata document URL as your `client_id` (a client registered at `/register` can't take
   fees), and add `"oes_payments_owner": "<your person id>"` to it, which proves the app is yours.
2. Call `connect_app_payments { client_id, feePercent }` signed in as that person, and finish Stripe
   onboarding at the link it returns.
3. From then on, every `start_checkout` made with your app's tokens carries your fee. Orders show
   `platformFee` and `appFee`; the platform collects both and transfers yours to your Stripe account
   after the sale, and takes it back if the order is refunded.

Money only moves through `start_checkout`. Event extensions can't carry links to outside payment or
ticketing pages (Stripe payment links, PayPal, Venmo, Eventbrite and the like); they are refused.

A pool is a donation or pay-what-you-want ticket type with a `goal` (or `showProgress: true`):
`list_ticket_types` and `get_event` then show everyone `progress: { raised, goal, currency, contributors }`,
a count, never who gave. Contributors pay with `start_checkout` and an `amount` they chose. Hosts see
`event_summary`, whose `revenue` maps currency to the paid total in major units (`{"USD": 35}`, `{}`
until something is paid).

## 11. The spec

The data model is public: [the spec](https://informals.net/spec/), [JSON Schemas](https://informals.net/schemas/index.json) (each
`$id` under `https://w3id.org/oes/v0.2/schemas/` is also served at `https://informals.net/oes/v0.2/schemas/<name>`), the
[JSON-LD context](https://informals.net/context.jsonld) and [event types](https://informals.net/event-types.json), which say each stream
item type's `data` schema (the item's `dataschema`) and who may see it. `oes.json` links them all.

## 12. Interests, feeds and finding people

A person's interests (`set_interests`), opt-in feeds of new events by place, keyword, series or app
(`create_feed`, `follow_feed`, `feed_digest`) are in https://informals.net/.well-known/oes-feeds.md. Feed rules with `near`
use the same coarse points as `find_events`. There is deliberately no way to see where a person is or
to look people up by interest: matching strangers stays in your app, opt-in and coarse, until the
platform has an opt-in, pseudonymous way to do it.

## 13. Agents

Link your visitors to `https://informals.net/mcp` (any MCP client) or `https://informals.net/.well-known/oes-agent.md` (any other
agent). Whatever your site does, their agent can do through the same tools.

## 14. Your own MCP server, on top of ours (gateways)

Give people your own connector URL (say `https://your.app/mcp`) that lists your tools next to all of ours,
runs yours, and passes every other call through to `https://informals.net/mcp` with the person's token. One sign-in (ours)
covers both, and calls through it count as your app's (feeds, app fees). The kit runs on Cloudflare Workers,
Vercel or any Node server. Which of our tools you may mirror is in each tool's
`_meta["net.informals/gateway"]` on `/mcp` and `gateway` on `GET /api/tools`.
The guide: https://informals.net/.well-known/oes-gateways.md. A live one: `https://eventslop.informals.net/mcp`.
