# Publish a multi-day tour for your guests

> Documentation index: https://ridewithgps.com/api/v1/doc/llms.txt

This guide shows you how to put a tour on Ride with GPS as an experience: upload its routes, write the day-by-day guide, publish it, and give your guests a code to open it in the app.

**Before you start**, you need:

* An organization account with access to Experiences. Other accounts get a `403` on every experience endpoint. If your account does not have Experiences enabled, please contact [organizations@ridewithgps.com](mailto:organizations@ridewithgps.com).
* An API key and an authentication token, which you create while signed in to the organization. See [Authentication](https://ridewithgps.com/api/v1/doc/organizations/authentication.md).

Every request below uses Basic authentication with that key and token. With `curl`, pass `-u "$API_KEY:$AUTH_TOKEN"`. File uploads are sent as `multipart/form-data`: with `curl`, pass each field with `-F`, and a file as `-F file=@day1.gpx`.

## 1. Upload the routes

If the routes are already in your organization's library, skip this step and use their ids. `GET /api/v1/routes.json` lists them.

Upload one GPS file (GPX, TCX, KML or FIT) per day of the tour:

Endpoint: [Uploads a file to create routes](https://ridewithgps.com/api/v1/doc/endpoints/routes.md)

```form
// POST https://ridewithgps.com/api/v1/routes.json
file: day1.gpx
name: Day 1 - Florence to Siena
```

The file is processed in the background. The response is a task:

```json
// 202 - Accepted
{
  "task": {
    "id": 9001,
    "url": "https://ridewithgps.com/api/v1/tasks/9001.json",
    "type": "gps_file_upload",
    "status": "pending",
    "items": [],
    "errors": []
  }
}
```

Poll the task `url` every few seconds until `status` is `completed`. Then:

* If `items` lists routes, keep their `item_id`. A file with several tracks makes several routes.
* If `errors` is not empty, fix the file and upload it again.

Endpoint: [Returns the specified task](https://ridewithgps.com/api/v1/doc/endpoints/tasks.md)

```json
// GET https://ridewithgps.com/api/v1/tasks/9001.json
// 200 - OK
{
  "task": {
    "id": 9001,
    "status": "completed",
    "items": [
      { "item_type": "route", "item_id": 123, "item_url": "https://ridewithgps.com/api/v1/routes/123.json" }
    ],
    "errors": []
    // ...
  }
}
```

## 2. Create the experience

Send the route ids in the order guests should see them:

Endpoint: [Creates an experience](https://ridewithgps.com/api/v1/doc/organizations/experiences.md)

```json
// POST https://ridewithgps.com/api/v1/experiences.json
{
  "experience": {
    "name": "Tuscany in 5 days",
    "description": "Five days of gravel and wine roads between Florence and Siena.",
    "location": "Tuscany, Italy",
    "starts_on": "2027-05-24",
    "ends_on": "2027-05-28",
    "route_ids": [123, 124, 125, 126, 127],
    "tags": ["gravel", "2027"]
  }
}
```

```json
// 201 - Created
{
  "experience": {
    "id": 456,
    "url": "https://ridewithgps.com/api/v1/experiences/456.json",
    "name": "Tuscany in 5 days",
    "active": false,
    "publish_status": "unpublished",
    "unlimited": true,
    "route_ids": [123, 124, 125, 126, 127],
    "guest_code": null
    // ...
  }
}
```

Adjust the request to your tour:

* **If every guest shares one code**, keep the default `"unlimited": true`.
* **If each booking gets its own code with a fixed number of seats**, send `"unlimited": false`. You create those codes in step 5.
* **If guests should lose access some days after they join**, send `expire_after_days`. The values allowed depend on your plan; a `422` lists them.
* **If you need to know who joined**, send `require_name`, `require_email`, `require_phone`, `require_zip_code` or `require_reference_id` as `true`. Guests fill these in when they join, and you read them in step 6.
* **If you run the same tour again** (a new season, a new group), send `source_experience_id` with the id of the old experience instead of starting over. The copy keeps the settings and guide pages, but not the codes or guests. It shares the original's routes rather than duplicating them, so a fix to a route reaches every experience that includes it. Publish each of those experiences again so guests get the fix. Change what differs with `PATCH /api/v1/experiences/456.json`, then go to step 4.

To change the routes later, send the full list again in `route_ids` with `PATCH`. The order you send is the new order.

## 3. Write the guide

The guide is a list of pages, usually one per day. Each page holds `blocks` of text, photos, route cards and elevation profiles.

If a page needs photos, upload them first and keep each photo `id`:

Endpoint: [Uploads a photo](https://ridewithgps.com/api/v1/doc/endpoints/photos.md)

```form
// POST https://ridewithgps.com/api/v1/photos.json
file: siena.jpg
```

```json
// 201 - Created
{
  "photo": {
    "id": 20800253,
    "url": "https://ridewithgps.com/api/v1/photos/20800253/8275d8de285be31d7b2437bc3ae69756.jpg"
    // ...
  }
}
```

Use a photo in a page within 24 hours of uploading it. Photos that no page uses are deleted after that.

Then create the pages in the order guests should read them:

Endpoint: [Creates a guide page](https://ridewithgps.com/api/v1/doc/organizations/experiences.md)

```json
// POST https://ridewithgps.com/api/v1/experiences/456/guide_pages.json
{
  "guide_page": {
    "title": "Day 1 - Florence to Siena",
    "blocks": [
      { "type": "text", "markdown": "## Morning\nLeave the hotel at **8:30**." },
      { "type": "photo", "photo_id": 20800253, "on_tap": "enlarge" },
      { "type": "route", "route_id": 123 },
      { "type": "elevation_profile", "route_id": 123 }
    ]
  }
}
```

```json
// 201 - Created
{
  "guide_page": {
    "id": 789,
    "experience_id": 456,
    "parent_id": null,
    "position": 1,
    "title": "Day 1 - Florence to Siena",
    "blocks": [ /* ... */ ]
    // ...
  }
}
```

Adjust each page to your content:

* **If you already have a PDF for a day**, send it as `file` in a multipart request instead of `blocks`.
* **If you want to group pages under a heading**, create a page with `"header": true`, then create the pages under it with `"parent_id"` set to its id.
* **If a page must go somewhere other than the end**, send `position` (1 is first).

Each new page goes at the end of the guide. The [guide page blocks reference](https://ridewithgps.com/api/v1/doc/reference/guide_page_blocks.md) lists every block type and the Markdown that text blocks accept.

## 4. Publish

Publishing builds the package guests download in the app. Start the build:

Endpoint: [Publishes an experience](https://ridewithgps.com/api/v1/doc/organizations/experiences.md)

```json
// POST https://ridewithgps.com/api/v1/experiences/456/packages.json
// 202 - Accepted
{
  "task": {
    "id": 9002,
    "url": "https://ridewithgps.com/api/v1/tasks/9002.json",
    "type": "experience_package",
    "status": "pending",
    "items": [],
    "errors": []
  }
}
```

Poll the task `url` until `status` is `completed`, as in step 1:

* If `items` holds an `experience_package`, the tour is live, and the experience shows `"active": true` and `"publish_status": "published"`.
* If `errors` is not empty, the build failed and the experience shows `"publish_status": "failed"`. Fix what the error names and publish again.

A `409` means a build is already running, or nothing changed since the last build. Wait for the running build to finish.

Each change you make after publishing sets `publish_status` to `updates`. Publish again so guests get the new version.

## 5. Give guests a code

Guests open the tour in the Ride with GPS app with a code.

**If every guest shares one code** (`"unlimited": true`), create a guest code:

Endpoint: [Creates a code](https://ridewithgps.com/api/v1/doc/organizations/experiences.md)

```json
// POST https://ridewithgps.com/api/v1/experiences/456/codes.json
{ "code": { "kind": "guest" } }
```

```json
// 201 - Created
{
  "code": {
    "id": 31,
    "code": "K7P2Q",
    "kind": "guest",
    "active": true,
    "access_limit": null,
    "times_used": 0
    // ...
  }
}
```

We pick the code unless you send your own in `code` (4 to 20 letters or digits). Creating a new guest code replaces the current one, so the old code stops working for new guests.

**If each booking gets its own code** (`"unlimited": false`), create one limited code per booking, with the number of seats in `access_limit`:

Endpoint: [Creates a code](https://ridewithgps.com/api/v1/doc/organizations/experiences.md)

```json
// POST https://ridewithgps.com/api/v1/experiences/456/codes.json
{ "code": { "kind": "limited", "code": "SMITH2027", "access_limit": 4 } }
```

To change the seats later, send a new `access_limit` with `PATCH /api/v1/experiences/456/codes/32.json`. To stop a limited code, send `"active": false`.

**If your plan includes guide codes**, create one with `"kind": "guide"` for your ride leaders. Guide access never expires.

Send the code to your guests with their booking confirmation.

## 6. Follow your guests

List who joined, newest first:

Endpoint: [Returns an experience's guests](https://ridewithgps.com/api/v1/doc/organizations/experiences.md)

```json
// GET https://ridewithgps.com/api/v1/experiences/456/guests.json
// 200 - OK
{
  "guests": [
    {
      "id": 5501,
      "code": "SMITH2027",
      "code_kind": "limited",
      "details": { "name": "Ana Smith", "email": "ana@example.com" },
      "download_count": 2,
      "expires_at": "2027-06-19T08:12:00Z",
      "removed_by_guest": false,
      "joined_at": "2027-05-20T08:12:00Z"
      // ...
    }
  ],
  "meta": { "pagination": { /* ... */ } }
}
```

`details` holds what you asked for in step 2.

* **To extend or cut a guest's access**, send a new `expires_at` (ISO 8601) with `PATCH /api/v1/experiences/456/guests/5501.json`. Your plan may cap how far ahead it can be.
* **To send a notification to every guest** (if your plan includes messaging), post it:

Endpoint: [Sends a message](https://ridewithgps.com/api/v1/doc/organizations/experiences.md)

```json
// POST https://ridewithgps.com/api/v1/experiences/456/messages.json
{ "message": { "content": "Rain tomorrow: we start at 10:00 instead of 8:30." } }
```

## See also

* [Experiences endpoints](https://ridewithgps.com/api/v1/doc/organizations/experiences.md): every field and status code.
* [Guide page blocks](https://ridewithgps.com/api/v1/doc/reference/guide_page_blocks.md): block types and Markdown.
* [Authentication](https://ridewithgps.com/api/v1/doc/organizations/authentication.md): API keys and tokens for organization accounts.
