| create_tour_bundle | Create a complete History Cake tour in one call: tour fields, stories (with locations, narration scripts, role/POI status), tags, and media imported from HTTPS URLs. Created as a draft unless status is 'published' AND the tour passes publish validation (every route stop needs narration audio, the tour needs a cover image, and non-flying tours need at least one route stop; audio is optional for points of interest) — otherwise it is saved as a draft and publishBlockers lists what's missing. A media URL that cannot be imported (rate limit, timeout, unsupported type) does not fail the call: the tour is created without it and mediaErrors lists each one (scope, storyIndex, field, url, error) so you can re-import it with import_media_url and attach it with update_tour/update_story or attach_media_to_*. Any other failure rolls the whole bundle back so nothing is saved, and it is safe to send again — do not resend a bundle that succeeded. navigationType is driving (default), walking, flying or train; walking and driving tours get a road or path route from Mapbox, while flying and train tours are drawn as straight lines between stops. This is the fastest way to turn a researched text document into a tour. |
| import_media_url | Import a single HTTPS image, audio, or video URL into the History Cake media library (downloads to S3). Returns a mediaId you can set as a tour cover, story image, or narration audio via the update tools. Only public HTTPS URLs are allowed; for a local file with no URL, use request_media_upload. For someone else's work (a Wikimedia Commons image, say), pass the credit too: creator, creatorUrl, sourceUrl, license, licenseUrl and attributionText (the credit line to show). |
| request_media_upload | Start uploading a local file (an image, a narration recording, a video) that has no public URL. Returns an uploadKey and a signed S3 upload form valid for an hour: send the file there yourself with a multipart POST (a ready-made curl command is included; S3 answers 204), then call complete_media_upload with the uploadKey to get a mediaId. The file goes straight to storage and never through this conversation. Limits: images 10 MB, video 500 MB, audio 1 GB; the extension must match the content type (for example image/jpeg with .jpg, audio/mp4 with .m4a). |
| complete_media_upload | Record a file sent with request_media_upload in your media library and return its mediaId, for use as a cover, story image, narration audio, gallery item or comparison image. Pass name, altText and, when the file is someone else's work, the credit: creator, creatorUrl, sourceUrl, license, licenseUrl and attributionText (the credit line to show). Safe to repeat: calling it again for the same uploadKey returns the same media item. |
| create_story | Add one story to a tour: route stops auto-play as travelers arrive; points of interest (role "poi") appear on the map and are played manually. Takes location, trigger radius (route stops only), text, narration script, media from URLs, and tags. New stories are appended to the tour unless orderIndex says otherwise. A media URL that cannot be imported (rate limit, timeout, unsupported type) does not fail the call: the story is created without it and mediaErrors lists each one (scope, field, galleryIndex, url, error) so you can re-import it with import_media_url and attach it with update_story or attach_media_to_story — do not resend a create_story that succeeded, or the tour gets a second copy of the story. |
| update_tour | Patch fields on a tour you own: name, descriptions, navigation type, story order mode, duration estimate, primary media (by mediaId from import_media_url), and tags (replaces all tags when provided; tags are created by name as needed). The public URL slug never changes after creation. |
| update_story | Patch fields on a story you own: text, narration script (audioScript), location, trigger radius, dates, primary media (by mediaId), and tags (replaces all tags when provided). |
| get_tour | Fetch full detail for a tour you own: all fields, tags, every story (with order, role, and whether it has audio/image/script yet), plus publishReadiness telling you exactly what still blocks publishing. |
| get_my_tours | List tours owned by the authenticated token's user (admins see all): id, slug, status, story count, and public URL. |
| get_story | Fetch one story's complete content by id: full WYSIWYG `description` text, the private `audioScript` narration, short description, exact location and trigger radius, dates, resolved primary image/video/audio URLs, gallery items, tags, and every tour it belongs to (with its per-tour order and role). Use this to read or audit a story's existing wording before editing it with update_story — list_stories and get_tour only report whether content exists, not the text itself. |
| list_stories | List every story in a tour — route stops in listening order first, then points of interest (map-shown, played manually) — with role (route/POI), location, short description, and whether each has narration audio, a primary image, or an audio script. Pass includeContent:true to also return each story's full description text and audioScript so you can audit a whole tour's writing in one call. |
| reorder_stories | Set the listening order of a tour's stories. Pass every story currently in the tour (use list_stories first) as an ordered array of storyIds. Route stops keep the relative order you pass; points of interest always seat after the route stops (they never auto-play and have no place on the walked route). |
| set_story_role | Mark a story, within one tour, as a route stop (auto-plays as travelers arrive) or an off-path point of interest (shown on the map and played manually, never auto-triggered; with a category like viewpoint/restaurant/trailhead). |
| remove_story_from_tour | Detach a story from a tour (the story itself is kept; it must remain in at least one tour). |
| attach_media_to_story | Attach an existing media item (mediaId) or import an HTTPS URL into a story's gallery, with optional caption and order. |
| add_story_comparison | Add a two-image comparison to a story, shown in the app and on the website as a slider between them: a period photograph against the same view today, a painting against the scene it shows, a building before and after. Both images are mediaIds from import_media_url or complete_media_upload; image 1 is the left/then/before side. type is then_now (the default; labels 'Then'/'Now'), before_after ('Before'/'After') or overlay (one image over the other; labels 'Image 1'/'Image 2', as in Studio); labels are at most 50 characters. A story can hold several; orderIndex sets their order. get_story lists a story's comparisons, and remove_story_comparison deletes one. |
| transfer_tour_ownership | Admins only: make another creator account (by email) the owner of a tour, for a tour built on someone's behalf. The new owner gets what ownership carries: pricing, earnings from later sales, managing contributors and deleting the tour. If they were a contributor on it, that entry is removed. The previous owner loses owner rights (an admin can still edit any tour). Media stays in the uploader's library and keeps showing in the tour. Tell the user before calling this: it changes who is paid for the tour. |
| find_rail_lines | Find OpenStreetMap rail lines for a train tour: passenger services (route type train, tram, light_rail, subway, monorail, funicular) and named stretches of track (railway). Give a tourId to search around its route stops (lines whose extent covers the most stops come first, with stopsCovered) or a bbox (south, west, north, east in degrees, up to about 3 by 2 degrees), optionally with query to filter by name, ref, operator or end station. Results come from a cache; when part of the area hasn't been searched yet the reply says pending: true and you should call again after about a minute (OpenStreetMap's search is slow). Pick a line with get_rail_line, then set_tour_rail_line. |
| get_rail_line | One rail line by railLineId (from find_rail_lines; it is the OpenStreetMap relation id): name, operator, end stations, length, and its stations in route order with coordinates, which make good stop locations for a train tour. The first call for a line starts fetching its track and returns status pending; call again after about a minute until status is ready. |
| set_tour_rail_line | Make a train tour's map follow a rail line's track (railLineId from find_rail_lines, whose status in get_rail_line must be ready), or clear it with null. The route drawn runs along the track from the tour's first route stop to its last and is redrawn as stops change. Returns the ridden distance and offLineStops: route stops more than 1 km from the track, which usually means the wrong line or a misplaced pin. Only for tours whose navigationType is train. |
| remove_story_comparison | Delete one image comparison from a story you can edit (by the comparisonId from add_story_comparison or get_story). The two media items stay in your library. |
| attach_media_to_tour | Attach an existing media item (mediaId) or import an HTTPS URL into a tour's gallery, with optional caption, role, and order. |
| list_tags | Browse existing content tags (optionally filtered by search) so you can reuse them instead of creating near-duplicates. |
| check_tour_publishable | Dry-run the publish validation for a tour. Returns ok plus the exact blocking errors (e.g. STORY_NO_AUDIO, NO_PRIMARY_IMAGE) and non-blocking warnings, without changing anything. |
| publish_tour | Validate and publish a tour you own. Fails with the list of blocking reasons if the tour isn't complete (run check_tour_publishable first). On success the tour goes live at its public URL. |
| unpublish_tour | Take a published tour you own off the public catalog by returning it to draft. Editors still see it and purchases are kept; publish_tour puts it back. |