# 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 with its JSON Schema
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).

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

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

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