Yroun Guide

Recipes

Worked-example flows for the seven scenarios that cover most integrations. Each recipe states the problem, shows the full curl sequence, and ends with what to expect.

Set environment variables at the top of your shell so the examples stay terse:

export YROUN_KEY="yroun_key_xxxxxxxxxxxx"
export YROUN_HUB="24e1f44e04bd43cda4877f834f10c1d6"
export YROUN_BASE="https://oapi.yroun.com/hubs/$YROUN_HUB"

1. Auto-post a daily report

Your batch job runs at 09:00, gathers numbers, and you want a formatted post in #announcements every day.

# Build a Tiptap doc with a heading + paragraph + bullet list
CONTENT=$(jq -nc --arg date "$(date -u +%Y-%m-%d)" \
  --arg sales "1,284" --arg signups "67" '
  {
    type: "doc",
    content: [
      { type: "heading", attrs: { level: 2 },
        content: [{ type: "text", text: ("Daily report - " + $date) }] },
      { type: "bulletList", content: [
        { type: "listItem", content: [
          { type: "paragraph", content: [{ type: "text", text: ("Sales: " + $sales) }] } ] },
        { type: "listItem", content: [
          { type: "paragraph", content: [{ type: "text", text: ("Signups: " + $signups) }] } ] }
      ] }
    ]
  }') 

curl -X POST "$YROUN_BASE/posts" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d "$(jq -n --arg c "$CONTENT" '{topicName:"Announcements", content:$c, tags:["daily"]}')"

Response is the new post object. Run the same call every morning. There is no de-dup on the server side, so use your batch's own date guard.

2. Embed a live dashboard pointed at your own API

A dashboard is three widgets on one page: the numbers, the trend, the rows. Each reads your own API, so the whole thing is one PUT and no frontend code. Everything below runs as written once you swap the two api.example.com URLs for yours.

# 1. Blank page
PAGE=$(curl -s -X POST "$YROUN_BASE/pages" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" -d "{}" | jq -r .uid)

# 2. Build the document, then send it. content is a STRING:
#    the Tiptap doc JSON-encoded, which is what `jq -Rs` does here.
cat > /tmp/doc.json <<'DOC'
{ "type": "doc", "content": [
  { "type": "statGridBlock", "attrs": {
      "title": "Today",
      "dataSource": "api",
      "apiUrl": "https://api.example.com/v1/metrics",
      "apiMapping": { "resItems": "items" },
      "fieldMap": { "label": "name", "value": "current", "delta": "changePct" },
      "pollIntervalSec": 60 } },
  { "type": "chartBlock", "attrs": {
      "title": "Signups, last 30 days",
      "apiUrl": "https://api.example.com/v1/stats/daily-signups",
      "type": "line",
      "dataRootKey": "items",
      "dataKeyX": "date",
      "yAxisKeys": ["count"] } },
  { "type": "apiTableBlock", "attrs": {
      "title": "Recent signups",
      "apiUrl": "https://api.example.com/v1/users",
      "apiMapping": { "resItems": "content", "resTotal": "totalElements" },
      "readOnly": true,
      "columns": [
        { "key": "email", "label": "Email" },
        { "key": "plan",  "label": "Plan" },
        { "key": "createdAt", "label": "Joined", "type": "time" } ] } }
] }
DOC

jq -n --arg c "$(jq -Rs . < /tmp/doc.json | jq -r .)" \
  '{title:"Signups", content:$c, visibility:"PUBLIC"}' \
| curl -X PUT "$YROUN_BASE/pages/$PAGE" \
    -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" -d @-

Readers see live numbers the moment they open the page, and you update the dashboard by re-PUTting new content. Three details decide whether it works on the first try. The stat grid and the table both read apiMapping.resItems, which DOES walk dot paths ("data.content"). The chart does not. Its dataRootKey is one top-level key of the response, so "data.items" finds nothing there; a chart with nothing to draw now tells you which keys your response actually has. And readOnly on the table is what stops it offering New and row editing on a dashboard that only reads.

Only the stat grid refreshes on its own (pollIntervalSec). The chart and the table fetch when the page opens and when a reader changes a filter. A dashboard that must move on its own puts the moving numbers in the stat grid.

3. Sync external calendar to Schedules

You manage events in your own CMS and want them mirrored to the hub's calendar.

# Idempotent: re-upserting the same externalId updates the existing row.
curl -X PUT "$YROUN_BASE/schedules/upsert" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d '{
    "externalId": "mycms:2026-07-04:summer-sale",
    "title": "Summer Sale",
    "scheduleType": "LIFE_SALE",
    "startAt": "2026-07-04T00:00:00Z",
    "endAt":   "2026-07-10T23:59:59Z",
    "sourceUrl": "https://mycms.example.com/events/summer-sale"
  }'

Run the same call N times per event lifecycle: first time creates, every later call updates. Use a single deterministic externalId per real-world event.

4. Forward your server events into a hub chat room

Your server already publishes events (deploys, alerts, sales). Mirror them to a chat room so the team sees them in their hub.

# 1. Create a webhook for the target room
#    Response returns uid + secret. The secret is shown ONCE, store it.
HOOK=$(curl -s -X POST "$YROUN_BASE/webhooks" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d '{ "roomUid": "ROOMUID", "name": "deploy-alerts" }')
HOOK_UID=$(echo "$HOOK" | jq -r .uid)
HOOK_SECRET=$(echo "$HOOK" | jq -r .secret)

# 2. From your server: POST text with the X-Webhook-Secret header
curl -X POST "https://api.yroun.com/api/v1/webhooks/$HOOK_UID" \
  -H "X-Webhook-Secret: $HOOK_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "text": "✅ deploy v2.34.1 to prod completed" }'

The webhook secret replaces X-API-Key for the room it was minted against. Keep it in your server config. Full model + more recipes on the Webhooks page.

5. Bulk-import a series with episodes

You are moving a back catalog of serialized content (weekly newsletters, web novel chapters, podcast episodes) into a Yroun series.

# Create the series
SERIES=$(curl -s -X POST "$YROUN_BASE/series" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d '{ "title": "Weekly Digest", "format": "TEXT" }' | jq -r .uid)

# Optional one-time setup: cast, audience, bible, summary
curl -X PUT "$YROUN_BASE/series/$SERIES/cast" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d '{ "members": [{ "name": "Alice", "role": "Editor" }] }'

# Loop your episodes
for EPISODE in 1 2 3 ...; do
  curl -X POST "$YROUN_BASE/series/$SERIES/episodes" \
    -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
    -d "{ \"title\": \"Episode $EPISODE\", \"content\": \"<Tiptap JSON string>\" }"
done

# Promote the series tier once enough episodes land
curl -X PATCH "$YROUN_BASE/series/$SERIES/tier" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d '{ "tier": "MINOR" }'

6. Set up multilingual pages

You wrote a page in English; you want Korean readers to see the localized version automatically.

curl -X PUT "$YROUN_BASE/pages/$PAGE/translations/ko" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d '{ "title": "시작하기", "content": "<stringified Tiptap doc in Korean>" }'

Repeat for each language. Yroun serves the visitor's preferred translation automatically; the original (English here) is the fallback.

7. Media upload: presigned URL flow

Upload an image or attachment and reference it from a post or page.

# 1. Ask for a presigned URL
INIT=$(curl -s -X POST "$YROUN_BASE/media/upload-init" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d '{ "fileName": "hero.jpg", "contentType": "image/jpeg" }')
UPLOAD_URL=$(echo "$INIT" | jq -r .uploadUrl)
MEDIA_UID=$(echo "$INIT" | jq -r .mediaUid)

# 2. PUT the bytes directly to S3 (NOT to Yroun)
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: image/jpeg" \
  --data-binary @./hero.jpg

# 3. Tell Yroun the upload is done
curl -X POST "$YROUN_BASE/media/upload-complete" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d "{\"mediaUid\":\"$MEDIA_UID\"}"

# Now you can reference $MEDIA_UID in posts (mediaUids array) or as an image src in page content.

8. Curate a guide list onto the map

Publish a list of venues from your own hub. Each entry is a curation of a shared place, so the same restaurant on two guides stays one place with two curations.

# 1. Curate a venue you already know the uid of
curl -X PUT "$YROUN_BASE/places/upsert" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d '{ "place": { "uid": "<placeUid>" }, "label": "3 Stars", "tier": 1, "edition": "2026" }'

# 2. Or let the server create or match it from name and position
curl -X PUT "$YROUN_BASE/places/upsert" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d '{ "place": { "externalRef": "osm-node-123", "name": "Mingles",
           "lat": 37.5244, "lng": 127.0397, "placeType": "RESTAURANT",
           "countryCode": "KR" }, "label": "2 Stars", "tier": 2 }'

# 3. Read your list back
curl -s "$YROUN_BASE/places" -H "X-API-Key: $YROUN_KEY" \
  | jq '.items[] | { name: .place.name, label, tier }'

# 4. Remove one listing. The place stays; only your curation of it goes.
curl -X DELETE "$YROUN_BASE/places/<placeUid>" -H "X-API-Key: $YROUN_KEY"

Send the same externalRef again to update a listing rather than add a second one. A public hub's curations appear on www.yroun.com/maps as a curator chip in the Guides filter.

Stuck, or something here is wrong? Send us a message