# Ride with GPS API documentation > Public JSON REST API for Ride with GPS: read and manage a user's routes, trips, photos, collections and events, sync their library, receive webhooks, and, with an organization account, manage club members, points of interest and experiences. Authentication is OAuth 2 or an API key with an authentication token. Every page below is also available as HTML without the `.md` extension. The full OpenAPI specification: https://ridewithgps.com/api/v1/openapi.yaml # Ride with GPS API Source: https://ridewithgps.com/api/v1/doc/overview.md Welcome to the Ride with GPS API documentation. Use of the public API is subject to our [API Terms of Service](https://ridewithgps.com/api/v1/doc/terms.md). Please email [developers@ridewithgps.com](mailto:developers@ridewithgps.com) with any feedback or questions. ## Where to start **If you build an app for riders**, read [Authentication](https://ridewithgps.com/api/v1/doc/authentication.md#oauth) to connect their accounts with OAuth, then use the [Routes](https://ridewithgps.com/api/v1/doc/endpoints/routes.md) and [Trips](https://ridewithgps.com/api/v1/doc/endpoints/trips.md) endpoints. **If you use an organization account**, start with the [Organizations overview](https://ridewithgps.com/api/v1/doc/organizations/overview.md). The pages in the Organizations section, such as experiences and club members, only work with an organization account. **If you work with an AI agent**, see [Use with AI agents](https://ridewithgps.com/api/v1/doc/ai_agents.md) for the instructions to give it. Every page is also available as Markdown. ## API clients and authentication You need an API client for every API request. [Manage the API clients](https://ridewithgps.com/api/api_clients) of your account. When you create an API client, it gets an API key (`api_key`). We recommend that you authenticate with **OAuth**, which you set up on your [API clients management page](https://ridewithgps.com/api/api_clients). The API also supports Basic authentication, using your `api_key` and an authentication token. You can create authentication tokens on the API clients management page. [Read more about authentication](https://ridewithgps.com/api/v1/doc/authentication.md) ## Versioning Our current (and only) API version is `v1` and is available at the `https://ridewithgps.com/api/v1` namespace. Only major, incompatible changes will trigger a version upgrade. We will add new endpoints and keys to existing responses without a version upgrade. ## Formats The API responds with JSON, and accepts JSON request bodies, except file uploads, which are sent as `multipart/form-data`. To specify JSON, you can either add a `content-type: application/json` header to your requests, or add a `.json` extension to the endpoints you call. The documentation specifies URLs with a `.json` extension. ## Webhooks You can configure your API client to send webhooks to your servers whenever one of your users creates, updates, deletes, pins or unpins a route or a trip, when their events or the RSVPs to them change, when their organization's members change, or when they disconnect your app. [Read more about webhooks](https://ridewithgps.com/api/v1/doc/webhooks.md) ## Responses and errors Every response has a root key named after the resource, lists are paginated, and errors come back as an `errors` array. [Read more about responses and errors](https://ridewithgps.com/api/v1/doc/responses.md) --- # Authentication Source: https://ridewithgps.com/api/v1/doc/authentication.md You must authenticate most requests to the API. The API supports 2 schemes: OAuth and Basic authentication. We strongly recommend that you use OAuth. Use Basic authentication if you are the only user of your application. If you use an organization account, see [Authentication for organizations](https://ridewithgps.com/api/v1/doc/organizations/authentication.md). ## OAuth authentication Ride with GPS is an OAuth provider, and we recommend that you use OAuth if you plan to authenticate users other than yourself. The workflow is secure, and does not require users to share their Ride with GPS password with you. ### Configuration On your [API clients management page](https://ridewithgps.com/api/api_clients), create or update an API client and specify one or more Redirect URIs (`redirect_uri`) pointing to endpoints you own. Your API client is then set up for OAuth, and its management page shows your OAuth client ID (`client_id`) and secret (`client_secret`). Never share them with anyone. ### Authorization flow #### 1. Authorize Your application links your user to the authorization web page hosted on the Ride with GPS website: ```html Sign in with Ride with GPS ``` Where: * `redirect_uri` must match one of the OAuth redirect URIs configured for your API client * `client_id` is the OAuth client ID of your API client Ride with GPS asks the user to sign in if needed, then shows your API client's name and asks them to authorize it to read and modify their content. When they click **Authorize**, Ride with GPS redirects them to your `redirect_uri` with an access grant: ``` {redirect_uri}?code={access_grant} ``` #### 2. Exchange the `access_grant` for an `access_token` Using the access grant that was sent to your `redirect_uri`, your application fetches the `access_token`: ```json // POST https://ridewithgps.com/oauth/token.json { "grant_type": "authorization_code", "code": "{access_grant}", "client_id": "{client_id}", "client_secret": "{client_secret}", "redirect_uri": "{redirect_uri}" } ``` > `redirect_uri` in request body must match the one used in the first step above. ```json // 200 - OK { "access_token": "Qnpa6Bif4gF9s6uU5YwjtxbaP3UzQxgfArDP7HXZj_5", "token_type": "Bearer", "scope": "user", "created_at": 946728000, "user_id": 123 } ``` * `user_id` is the Ride with GPS assigned id for the user who completed the authorization flow. * `access_token` authenticates your requests, in an `Authorization` header: ``` // header Authorization: Bearer {access_token} ``` #### 3. Make OAuth authenticated requests Your application can then make requests on the Ride with GPS API with the `Authorization` header to authenticate as your user. For example to get more details about the user who just completed the OAuth flow: Endpoint: [Returns the current user](https://ridewithgps.com/api/v1/doc/endpoints/users.md) ```json // GET https://ridewithgps.com/api/v1/users/current.json // Authorization: Bearer {access_token} ``` #### 4. Revoke an access token To revoke an OAuth access token, send this request: ```json // POST https://ridewithgps.com/oauth/revoke.json { "client_id": "{client_id}", "client_secret": "{client_secret}", "token": "{access_token}" } ``` ```json // 200 - OK {} ``` The token is then revoked, and you can no longer use it to authenticate requests. ## Basic authentication Basic authentication suits single user applications, such as a script that reads your own account. ### 1. Get an authentication token for your account #### User accounts Knowing your email and password, get an authentication token associated with your API key. This request needs only your API key, no authentication: Endpoint: [Creates an authentication token](https://ridewithgps.com/api/v1/doc/endpoints/authentication_tokens.md) ```json // POST https://ridewithgps.com/api/v1/auth_tokens.json // x-rwgps-api-key: {api_key} { "user": { "email": "{email}", "password": "{password}" } } ``` ```json // 201 - Created { "auth_token": { "auth_token": "c0cc78875f250604f9abac97712e314c", "api_key": "2704a8df", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "user": { "id": 123, "email": "alex@example.com", "name": "Alex Rider", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } } ``` #### Organization accounts If you use an organization account, you have no password, so you cannot use the endpoint above. See [Authentication for organizations](https://ridewithgps.com/api/v1/doc/organizations/authentication.md). ### 2. Make Basic authenticated requests You can then authenticate with Basic authentication, using your `api_key` and `auth_token`: ``` // header Authorization: Basic base64encode("{api_key}:{auth_token}") ``` With `curl`, pass `-u "$API_KEY:$AUTH_TOKEN"`. Alternatively, send them as headers: ``` // headers x-rwgps-api-key: {api_key} x-rwgps-auth-token: {auth_token} ``` --- # Responses and errors Source: https://ridewithgps.com/api/v1/doc/responses.md ## Responses API responses always contain a root key named after the requested resource(s): ```json // 200 - OK { "route": { "id": 123, "name": "Forest Park loop", // ... } } ``` ## Pagination Some requests (like the routes index request at `/api/v1/routes.json`) support pagination with `?page={page}&page_size={page_size}` query parameters. Page sizes must be between 20 and 200. If you do not send a page size, you get the default for that request. Pagination metadata is included in the response: Endpoint: [Returns a list of routes](https://ridewithgps.com/api/v1/doc/endpoints/routes.md) ```json // GET /api/v1/routes.json?page=1&page_size=20 // 200 - OK { "routes": [ // ... ], "meta": { "pagination": { "record_count": 207, "page_count": 11, "page_size": 20, "next_page_url": "https://ridewithgps.com/api/v1/routes.json?page=2&page_size=20" } } } ``` * A `null` value of `next_page_url` indicates that you have reached the last page of results. ## Error responses A successful request returns a `200 - OK`, `201 - Created` or `204 - No Content` status code. When reporting an error, the API responds with one of the following status codes: * `400 - Bad Request` - malformed request * `401 - Unauthorized` - authentication is required and has failed * `403 - Forbidden` - authenticated user lacks required permissions * `404 - Not Found` - the requested resource cannot be found * `422 - Unprocessable Entity` - request is unable to be processed * `500 - Internal Server Error` - an unexpected condition was encountered In case of errors, the response body includes an array of error messages: ```json // 401 - Unauthorized { "errors": ["Authentication is required and has failed"] } ``` ```json // 422 - Unprocessable Entity { "errors": ["name is required", "start_date is required"] } ``` --- # Webhooks Source: https://ridewithgps.com/api/v1/doc/webhooks.md Ride with GPS sends a `POST` request to your webhook URL when something changes for a user who authorized your API client: their routes and trips, their events and who RSVPs to them, their organization's members, or their authorization itself. ## Configuration On your API client management page, enter the URL (`webhook_url`) where you want to be notified, and check what you want to be notified about: | Setting | `item_type` | Sent when | | --- | --- | --- | | Sync routes | `route` | One of the user's routes is created, updated or deleted, or the user adds a route to or removes it from a collection | | Sync trips | `trip` | The same, for trips | | Events | `event` | One of the user's events is created, updated or deleted. Adding or removing a route counts as an update | | Event RSVPs | `event_participant` | Someone RSVPs to one of the user's events, changes their RSVP, or withdraws it | | Organization members | `club_member` | A member of the user's organization is invited, asks to join, is approved, changes role or leaves | | Revoked authorizations | `authorization` | The user disconnects your app from their Ride with GPS account | Sync routes and Sync trips also choose what the [sync endpoint](https://ridewithgps.com/api/v1/doc/endpoints/sync.md) returns. The other settings only send webhooks, starting within a minute of checking them. You are notified about a user's data only while they have authorized your API client, with OAuth or with an authentication token. Events, RSVPs and members are reported to the owner of the event or the organization: an organization that authorizes your client gets notifications about its events, their RSVPs and its members. ## Webhook request Ride with GPS sends `POST` notifications to your webhook URL, several at a time. Here is an example of a webhook request: ```json // POST {webhook_url} // content-type: application/json // user-agent: RideWithGPS // x-rwgps-api-key: {api_key} // x-rwgps-signature: {signature} // x-rwgps-datetime: {datetime} { "notifications": [ { "user_id": 1, "item_type": "route", "item_id": 101, "item_user_id": 1, "item_url": "https://ridewithgps.com/routes/101.json", "action": "deleted", "collection": null }, { "user_id": 2, "item_type": "route", "item_id": 102, "item_user_id": 1, "item_url": "https://ridewithgps.com/routes/102.json", "action": "added", "collection": { "id": 2, "type": "pinned", "url": null } }, { "user_id": 3, "item_type": "event_participant", "item_id": null, "item_user_id": 42, "item_url": null, "action": "created", "collection": null, "event": { "id": 301, "url": "https://ridewithgps.com/api/v1/events/301.json" }, "status": "participant" }, { "user_id": 42, "item_type": "authorization", "item_id": null, "item_user_id": 42, "item_url": null, "action": "deleted", "collection": null } ] } ``` > No more than 100 notifications are sent per request. For each notification in the request payload: * `user_id` is the id of the user who authorized your API client and whose data changed. Fetch `item_url` with that user's token. * `item_type` is one of the types in the table above. * `item_id` is the `id` of the item, `null` for RSVPs and authorizations, which have no id of their own in the API. * `item_user_id` is the `id` of the user the item belongs to: the owner of a route, trip or event, the rider who RSVPed, or the member. It differs from `user_id` when a user adds another user's item to a collection, and for RSVPs and members. It is `null` for a member invited by email who hasn't claimed the invitation yet. * `item_url` is where to fetch the item, `null` for RSVPs and authorizations. * `action` is one of the following: | Action | Description | | --- | --- | | `created` | The item was created | | `updated` | The item was updated | | `deleted` | The item was deleted | | `added` | The user added the item to the specified collection (routes and trips) | | `removed` | The user removed the item from the specified collection (routes and trips) | * For `added` and `removed` actions, `collection` is the target collection where the action was taken. It is currently always the collection of pinned items for the user, but we might expose actions on other collections in the future. * For RSVPs, `event` is the event the RSVP is for, with its `id` and `url`, and `status` is the RSVP's status. ### Events * `item_url` is the event in the [events endpoints](https://ridewithgps.com/api/v1/doc/endpoints/events.md). * `updated` is sent when the event's details change, or when a route is added to it or removed from it. Changes to the routes themselves come as `route` notifications, when you also check Sync routes. * Deleting an event sends one `deleted` notification for the event, none for its RSVPs. ### Event RSVPs * An RSVP is identified by `event.id` and `item_user_id` (the rider). `item_id` and `item_url` are `null`. * `status` is the RSVP's status: `participant` (going), `interested`, `declined` (not going), or `disallowed` (removed by an organizer, or expired). It is `null` on `deleted`: the RSVP is gone because the rider withdrew, an organizer removed them, or the rider deleted their account. * `event.url`, fetched with the event owner's token, lists the participants. * An RSVP that expires on its own, on events that limit how long an RSVP lasts, sends no notification. To RSVP for a user, use the [event participant endpoints](https://ridewithgps.com/api/v1/doc/endpoints/events.md) with that user's own token. ### Organization members * `item_url` is the member in the [club members endpoints](https://ridewithgps.com/api/v1/doc/organizations/club_members.md), fetched with the organization's token. * `created` is sent when someone is invited or asks to join, `updated` when they are approved, claim their invitation, or their role or details change, and `deleted` when they leave or are removed. ### Revoked authorizations * The action is `deleted`. `item_id` is `null`; `item_user_id` is the user's id. * It is sent when the user disconnects your app from their account, which revokes the OAuth tokens they gave it. Delete what you stored for them. * It is not sent when your app revokes its own token. ## Delivery Notifications are grouped: the ones raised within 30 seconds of each other are sent together. RSVPs and revoked authorizations are sent within a few seconds, along with any notifications already waiting. When the same item is created, updated or deleted more than once before a request is sent, you get one notification for it, with the most important action (`deleted`, then `created`, then `updated`) and the latest values: an RSVP made and then changed from `participant` to `interested` arrives as `created` with `status` `interested`. Adding to and removing from a collection (`added`, `removed`) are reported on their own. ## Webhook signature Webhook requests include the following headers: * `x-rwgps-api-key` lets you identify the API client responsible for the request in case you have created multiple API clients. * `x-rwgps-signature` is a HMAC-SHA256 signature of the raw request body, using your API client's API secret as the signing key (the "API secret" on your API client's page, not its OAuth secret). Compute the signature on your end to validate that the request originated from Ride with GPS. For example: ```python # Python example import hashlib import hmac signature = request_headers['x-rwgps-signature'] valid = hmac.compare_digest(signature, hmac.new(b'{api_secret}', request_raw_body, hashlib.sha256).hexdigest()) ``` ```javascript // Javascript example const { createHmac } = require('crypto') const signature = requestHeaders['x-rwgps-signature'] const valid = signature === createHmac('sha256', '{api_secret}').update(requestRawBody).digest('hex') ``` * `x-rwgps-datetime` is when the request was sent, in ISO 8601. ## Webhook request handling When requesting your webhook, Ride with GPS expects a `200` response within 1 second. We strongly recommend that you acknowledge the webhook request as quickly as possible and process its content in a separate thread. Processing a webhook request includes, for each `notification` in the `notifications` array: * Retrieve from your system the authentication `token` (OAuth or Basic authentication) associated with the `notification.user_id` * Fetch `item_url`, authenticating the request with the `token` (see [authentication documentation](https://ridewithgps.com/api/v1/doc/authentication.md)), unless the action is `deleted` or `item_url` is `null` * Update your records with the new or updated item > If you did not store the `user_id` alongside the `access_token`, you can retrieve it from [this endpoint](https://ridewithgps.com/api/v1/doc/endpoints/users.md). > **Important** > * No retry mechanism is currently implemented. If your server misses a request, the notifications in it are lost: check for changes from time to time with the [sync endpoint](https://ridewithgps.com/api/v1/doc/endpoints/sync.md) or the list endpoints. > * `3xx` redirect status codes in responses are NOT followed. --- # Use with AI agents Source: https://ridewithgps.com/api/v1/doc/ai_agents.md Every page of this documentation is available as Markdown, so you can give it to an AI agent or a chat assistant. ## Point your agent at the documentation Add this to your project's agent instructions (`AGENTS.md`, `CLAUDE.md`, Cursor rules or similar): ```markdown ## Ride with GPS API - Documentation index: https://ridewithgps.com/api/v1/doc/llms.txt. Fetch the pages you need as Markdown (`.md`). - OpenAPI specification: https://ridewithgps.com/api/v1/openapi.yaml. Use it for exact fields and types. - Authenticate with the `x-rwgps-api-key` and `x-rwgps-auth-token` headers, or with OAuth. Read keys and tokens from the environment; never write them in code. - Route and trip uploads return a task: poll its `url` until `status` is `completed`. ``` Then ask your agent for what you need, for example: > Read the Ride with GPS API documentation index at https://ridewithgps.com/api/v1/doc/llms.txt, then write a script that uploads the GPX files in `rides/` as routes and prints their URLs. ## Get the documentation as Markdown - **One page**: add `.md` to its URL, for example [authentication.md](https://ridewithgps.com/api/v1/doc/authentication.md), or use **Copy page** at the top of any page. - **One page, from a tool**: request its URL with an `Accept: text/markdown` header. - **Every page**: [llms.txt](https://ridewithgps.com/api/v1/doc/llms.txt) lists them with a short description, following the [llms.txt](https://llmstxt.org) format. [llms-full.txt](https://ridewithgps.com/api/v1/doc/llms-full.txt) holds them all in one file, for tools that load the whole documentation at once. - **Exact schemas**: the [OpenAPI specification](https://ridewithgps.com/api/v1/openapi.yaml) describes every endpoint, parameter and field. ```bash curl https://ridewithgps.com/api/v1/doc/endpoints/routes \ -H "Accept: text/markdown" ``` ## Keep your keys safe An agent that calls the API acts with your API key and authentication token: it can do anything that account can. Keep the token out of files you share, and delete it on your [API clients page](https://ridewithgps.com/api/api_clients) when you are done. --- # Routes Source: https://ridewithgps.com/api/v1/doc/endpoints/routes.md A route is a planned track. Upload a GPX, TCX, KML or FIT file to create routes: the upload runs in the background and returns a [task](https://ridewithgps.com/api/v1/doc/endpoints/tasks.md). See also: [Routes and trips](https://ridewithgps.com/api/v1/doc/reference/routes_and_trips.md), [Track points](https://ridewithgps.com/api/v1/doc/reference/track_points.md), [Points of interest](https://ridewithgps.com/api/v1/doc/reference/points_of_interest.md). OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_routes.yaml ## Returns a list of routes `GET /api/v1/routes.json` Returns a paginated list of routes for the authenticated user. Supports filtering by `name`, `visibility`, `distance_min`, `distance_max`, `elevation_gain_min`, `elevation_gain_max` and `archived` status. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `page` | integer | query | no | Page number for pagination | | `page_size` | integer | query | no | Number of items per page (20-200) | | `name` | string | query | no | Filter by name (partial match) | | `visibility` | string | query | no | Filter by visibility. One of: `public`, `followers_only`, `mutual_followers_only`, `private`. | | `distance_min` | integer | query | no | Minimum distance in meters | | `distance_max` | integer | query | no | Maximum distance in meters | | `elevation_gain_min` | integer | query | no | Minimum elevation gain in meters | | `elevation_gain_max` | integer | query | no | Maximum elevation gain in meters | | `archived` | string | query | no | Filter by archived status. One of: `true`, `false`. | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `routes` | array of objects | | | `routes[].id` | integer | | | `routes[].user_id` | integer | | | `routes[].url` | string | | | `routes[].html_url` | string | | | `routes[].visibility` | string | | | `routes[].name` | string | | | `routes[].description` | string or null | | | `routes[].locality` | string or null | | | `routes[].administrative_area` | string or null | | | `routes[].country_code` | string or null | | | `routes[].distance` | number | Distance in meters | | `routes[].elevation_gain` | number | Elevation gain in meters | | `routes[].elevation_loss` | number | Elevation loss in meters | | `routes[].first_lat` | number | | | `routes[].first_lng` | number | | | `routes[].last_lat` | number | | | `routes[].last_lng` | number | | | `routes[].sw_lat` | number | Southwest bounding box latitude | | `routes[].sw_lng` | number | Southwest bounding box longitude | | `routes[].ne_lat` | number | Northeast bounding box latitude | | `routes[].ne_lng` | number | Northeast bounding box longitude | | `routes[].track_type` | string or null | | | `routes[].terrain` | string or null | | | `routes[].difficulty` | string or null | | | `routes[].unpaved_pct` | number or null | | | `routes[].surface` | string or null | | | `routes[].archived` | boolean or null | null for non owned routes | | `routes[].created_at` | date-time | | | `routes[].updated_at` | date-time | | | `meta` | object | | | `meta.pagination` | object | | | `meta.pagination.record_count` | integer | Total number of records | | `meta.pagination.page_count` | integer | Total number of pages | | `meta.pagination.page_size` | integer | Number of records per page | | `meta.pagination.next_page_url` | string or null | URL for the next page (null if last page) | ### Errors - `401` Unauthorized ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/routes.json ``` ### Example response ```json { "routes": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/routes/123.json", "html_url": "https://ridewithgps.com/routes/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "distance": 40237, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "unpaved_pct": 12, "surface": "mostly_paved", "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "meta": { "pagination": { "record_count": 45, "page_count": 3, "page_size": 20, "next_page_url": "https://ridewithgps.com/api/v1/routes.json?page=2" } } } ``` ## Returns the specified route `GET /api/v1/routes/{id}.json` Returns detailed information about a specific route ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Route ID | | `privacy_code` | string | query | no | Privacy code for the non public asset | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `route` | object | | | `route.id` | integer | | | `route.user_id` | integer | | | `route.url` | string | | | `route.html_url` | string | | | `route.visibility` | string | | | `route.name` | string | | | `route.description` | string or null | | | `route.locality` | string or null | | | `route.administrative_area` | string or null | | | `route.country_code` | string or null | | | `route.distance` | number | Distance in meters | | `route.elevation_gain` | number | Elevation gain in meters | | `route.elevation_loss` | number | Elevation loss in meters | | `route.first_lat` | number | | | `route.first_lng` | number | | | `route.last_lat` | number | | | `route.last_lng` | number | | | `route.sw_lat` | number | Southwest bounding box latitude | | `route.sw_lng` | number | Southwest bounding box longitude | | `route.ne_lat` | number | Northeast bounding box latitude | | `route.ne_lng` | number | Northeast bounding box longitude | | `route.track_type` | string or null | | | `route.terrain` | string or null | | | `route.difficulty` | string or null | | | `route.unpaved_pct` | number or null | | | `route.surface` | string or null | | | `route.archived` | boolean or null | null for non owned routes | | `route.created_at` | date-time | | | `route.updated_at` | date-time | | | `route.tags` | array of strings | Tags. Only present on club-owned routes. | | `route.activity_types` | array of strings | Activity types for this route. See Activity Types reference. One of: `cycling:generic`, `cycling:road`, `cycling:gravel`, `cycling:mountain`, `cycling:commute`, `walking:generic`, `walking:hiking`, `running:generic`, `driving:generic`, `motorcycling:generic`, `swimming:generic`, `snow:generic`. | | `route.track_points` | array of objects | | | `route.track_points[].x` | number | Longitude | | `route.track_points[].y` | number | Latitude | | `route.track_points[].d` | number | Distance from start in meters | | `route.track_points[].e` | number | Elevation in meters | | `route.track_points[].S` | integer | Surface type | | `route.track_points[].R` | integer | Highway tag | | `route.course_points` | array of objects | | | `route.course_points[].x` | number | Longitude | | `route.course_points[].y` | number | Latitude | | `route.course_points[].d` | number | Distance from start in meters | | `route.course_points[].i` | integer | Cue track index | | `route.course_points[].t` | string | Type of cue | | `route.course_points[].n` | string | Cue text | | `route.course_points[]._e` | boolean | User edited cue | | `route.points_of_interest` | array of objects | | | `route.points_of_interest[].id` | integer | | | `route.points_of_interest[].user_id` | integer | | | `route.points_of_interest[].type` | string | | | `route.points_of_interest[].type_id` | integer | | | `route.points_of_interest[].type_name` | string | | | `route.points_of_interest[].name` | string | | | `route.points_of_interest[].description` | string or null | | | `route.points_of_interest[].url` | string | | | `route.points_of_interest[].lat` | number | | | `route.points_of_interest[].lng` | number | | | `route.points_of_interest[].distances` | array of numbers | Distances from start in meters for waypoints | | `route.points_of_interest[].tag_names` | array of strings | | | `route.photos` | array of objects | | | `route.photos[].id` | integer | | | `route.photos[].url` | string | | | `route.photos[].highlighted` | boolean | | | `route.photos[].caption` | string or null | | | `route.photos[].lat` | number or null | | | `route.photos[].lng` | number or null | | | `route.photos[].elevation` | integer or null | | | `route.photos[].location` | string or null | | | `route.photos[].locality` | string or null | | | `route.photos[].administrative_area` | string or null | | | `route.photos[].country_code` | string or null | | | `route.photos[].created_at` | date-time | | | `route.collections` | array of objects | | | `route.collections[].id` | integer | | | `route.collections[].user_id` | integer | | | `route.collections[].url` | string | | | `route.collections[].html_url` | string | | | `route.collections[].visibility` | string | | | `route.collections[].name` | string or null | | | `route.collections[].description` | string or null | | | `route.collections[].cover` | string or null | | | `route.collections[].created_at` | date-time | | | `route.collections[].updated_at` | date-time | | ### Errors - `401` Unauthorized - `403` Forbidden - Route not visible to user - `404` not Found - Route not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/routes/123.json ``` ### Example response ```json { "route": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/routes/123.json", "html_url": "https://ridewithgps.com/routes/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "distance": 40237, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "unpaved_pct": 12, "surface": "mostly_paved", "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "tags": [ "Tags" ], "activity_types": [ "cycling:generic" ], "track_points": [ { "x": -122.691804, "y": 45.521529, "d": 12487.3, "e": 153.6, "S": 1, "R": 1 } ], "course_points": [ { "x": -122.691804, "y": 45.521529, "d": 12487.3, "i": 412, "t": "Right", "n": "Turn right onto NW Thurman St", "_e": false } ], "points_of_interest": [ { "id": 123, "user_id": 123, "type": "coffee", "type_id": 123, "type_name": "Coffee", "name": "Coffee stop", "description": "Good espresso before the climb", "url": "https://ridewithgps.com/api/v1/points_of_interest/123.json", "lat": 45.521529, "lng": -122.691804, "distances": [ 12487.3 ], "tag_names": [ "Tag names" ] } ], "photos": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "highlighted": false, "caption": "View from Pittock Mansion", "lat": 45.521529, "lng": -122.691804, "elevation": 290, "location": "Pittock Mansion", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "created_at": "2000-01-01T12:00:00Z" } ], "collections": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/collections/123.json", "html_url": "https://ridewithgps.com/collections/123", "visibility": "public", "name": "Portland favorites", "description": "Our best rides around Portland", "cover": null, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } } ``` ## Returns the polyline for the specified route `GET /api/v1/routes/{id}/polyline.json` Returns a simplified polyline of the route geometry, suitable for displaying on a map. The `data` field is a Google Encoded Polyline. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Route ID | | `privacy_code` | string | query | no | Privacy code for the non public asset | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `polyline` | object | | | `polyline.parent_type` | string | Type of parent object (route or trip) | | `polyline.parent_id` | integer | ID of the parent object | | `polyline.data` | string or null | Google Encoded Polyline (precision 5, [latitude, longitude] order); simplified geometry. | ### Errors - `401` Unauthorized - `403` Forbidden - Route not visible to user - `404` Not Found - Route not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/routes/123/polyline.json ``` ### Example response ```json { "polyline": { "parent_type": "route", "parent_id": 123, "data": "en`sFbhlaSiAoDlCaBa@mAWi@sBwC" } } ``` ## Downloads the specified route as a GPS file `GET /api/v1/routes/{id}.{format}` Returns the route as a GPS file, ready to load on a GPS device or into another application. The extension picks the format: | Extension | Content type | File | |-----------|----------------------------------------|-----------------------------------------------------------------------| | `gpx` | `application/gpx+xml` | GPX 1.1 track at full resolution, without waypoints | | `tcx` | `application/tcx+xml` | TCX course with the route cues as course points | | `fit` | `application/vnd.ant.fit` | FIT course with the route cues as course points | | `kml` | `application/vnd.google-earth.kml+xml` | Google Earth track | For users whose subscription includes device navigation, the TCX and FIT cues are placed 30 meters ahead of the turn so the device warns before it. For other users the cues sit on the turn itself. The file is sent as an attachment with a filename derived from the route name. Visibility rules are the same as for the JSON record: a non public route needs a `privacy_code` unless it belongs to the authenticated user. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Route ID | | `format` | string | path | yes | File format. One of: `gpx`, `tcx`, `fit`, `kml`. | | `privacy_code` | string | query | no | Privacy code for the non public asset | ### Response `200` GPS file ### Errors - `401` Unauthorized - `403` Forbidden - Route not visible to user ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/routes/123.gpx ``` ## Uploads a file to create routes `POST /api/v1/routes.json` Creates one or more routes from an uploaded GPS file. Accepted formats are GPX, TCX, KML and FIT. **Multipart uploads**: This endpoint accepts only `Content-Type: multipart/form-data`. Send the following fields: - `file` - GPS file (binary), required - `name` - Name for the created route, otherwise taken from the file - `description` - Description for the created route Processing happens in the background. The response is a task with `status: "pending"`, and its `Location` header points at the task. Poll that url until `status` becomes `completed`, then read the `items` array for the routes that were created and the `errors` array for anything that failed. Route visibility always follows the account's default privacy setting for routes and cannot be set through this endpoint. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Request body (`multipart/form-data`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `file` | file | yes | GPS file | | `name` | string | no | Name for the created route, otherwise taken from the file | | `description` | string | no | Description for the created route | ### Response `202` | Name | Type | Description | | --- | --- | --- | | `task` | object | | | `task.id` | integer | | | `task.user_id` | integer | | | `task.url` | string | API url of the task, to poll until it completes | | `task.type` | string | What kind of work the task performs. `gps_file_upload` for uploads, `experience_package` for experience packages | | `task.status` | string | `pending` until the task has run, then `completed` | | `task.created_at` | date-time | | | `task.updated_at` | date-time | | | `task.items` | array of objects | Assets created by the task. Empty while pending, and empty if nothing was created. A file holding several tracks creates one asset per track | | `task.items[].item_type` | string | Type of the created asset: `route` or `trip` for uploads, `experience_package` for experience packages | | `task.items[].item_id` | integer | | | `task.items[].item_url` | string or null | API url of the created asset | | `task.errors` | array of objects | Anything that went wrong, one entry per track that could not be imported. Empty when the task succeeded entirely | | `task.errors[].code` | string | Machine readable reason. One of `duplicate`, `time_data_missing`, `no_tracks`, `empty_file`, `parse_failed`, `failed_to_process`, `weigh_in_failed`, `build_failed`, `error` | | `task.errors[].message` | string | Human readable description, always in English | | `task.errors[].item_type` | string or null | Set when the error refers to an existing asset, as for a duplicate | | `task.errors[].item_id` | integer or null | | | `task.errors[].item_url` | string or null | | ### Errors - `400` No file provided - `401` Unauthorized - `422` Empty file or invalid parameter ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -F file=@route.gpx \ -F name="Forest Park loop" \ -F description="Morning ride through Forest Park" \ https://ridewithgps.com/api/v1/routes.json ``` ### Example response ```json { "task": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/tasks/123.json", "type": "gps_file_upload", "status": "completed", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "items": [ { "item_type": "route", "item_id": 123, "item_url": "https://ridewithgps.com/api/v1/routes/123.json" } ], "errors": [ { "code": "duplicate", "message": "This route already exists", "item_type": "route", "item_id": 123, "item_url": "https://ridewithgps.com/api/v1/routes/123.json" } ] } } ``` ## Copies the specified route into your routes `POST /api/v1/routes/{id}/copy.json` Copies a route the authenticated user can see into their own routes, with its track, course points and points of interest. Organizations can turn copying off for their routes. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Route ID | | `privacy_code` | string | query | no | Privacy code for the non public asset | ### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `route` | object | no | | | `route.name` | string | no | Defaults to the original name. | | `route.visibility` | string | no | Defaults to `private`, or `managers_only` for an organization. User-owned: `public`, `followers_only`, `mutual_followers_only` or `private`. Organization-owned: `public`, `members_only` or `managers_only`. See Visibilities. | ### Response `201` | Name | Type | Description | | --- | --- | --- | | `route` | object | | | `route.id` | integer | | | `route.user_id` | integer | | | `route.url` | string | | | `route.html_url` | string | | | `route.visibility` | string | | | `route.name` | string | | | `route.description` | string or null | | | `route.locality` | string or null | | | `route.administrative_area` | string or null | | | `route.country_code` | string or null | | | `route.distance` | number | Distance in meters | | `route.elevation_gain` | number | Elevation gain in meters | | `route.elevation_loss` | number | Elevation loss in meters | | `route.first_lat` | number | | | `route.first_lng` | number | | | `route.last_lat` | number | | | `route.last_lng` | number | | | `route.sw_lat` | number | Southwest bounding box latitude | | `route.sw_lng` | number | Southwest bounding box longitude | | `route.ne_lat` | number | Northeast bounding box latitude | | `route.ne_lng` | number | Northeast bounding box longitude | | `route.track_type` | string or null | | | `route.terrain` | string or null | | | `route.difficulty` | string or null | | | `route.unpaved_pct` | number or null | | | `route.surface` | string or null | | | `route.archived` | boolean or null | null for non owned routes | | `route.created_at` | date-time | | | `route.updated_at` | date-time | | ### Errors - `400` Malformed body: route is not an object - `401` Unauthorized - `403` Forbidden - Route not visible to user, or its organization turned copying off - `404` Not Found - Route not found - `422` Invalid value ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -H "Content-Type: application/json" \ -d '{ "route": { "name": "Forest Park loop", "visibility": "private" } }' \ https://ridewithgps.com/api/v1/routes/123/copy.json ``` ### Example response ```json { "route": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/routes/123.json", "html_url": "https://ridewithgps.com/routes/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "distance": 40237, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "unpaved_pct": 12, "surface": "mostly_paved", "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ## Updates the specified route `PUT /api/v1/routes/{id}.json` Updates details of a route owned by the authenticated user. Only the fields sent are changed. The track cannot be changed. Any invalid value returns a 422 and nothing is saved. Values of the wrong type, such as an object for `name`, may be ignored. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Route ID | ### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `route` | object | yes | | | `route.name` | string or null | no | null or empty resets the name to its default. | | `route.description` | string or null | no | At most 16,000 characters. | | `route.visibility` | string | no | User-owned: `public`, `followers_only`, `mutual_followers_only` or `private`. Organization-owned: `public`, `members_only` or `managers_only`. See Visibilities. | | `route.activity_types` | array of strings | no | Replaces the current activity types. An empty array clears them. See Activity Types. One of: `cycling:generic`, `cycling:road`, `cycling:gravel`, `cycling:mountain`, `cycling:commute`, `walking:generic`, `walking:hiking`, `running:generic`, `driving:generic`, `motorcycling:generic`, `swimming:generic`, `snow:generic`. | | `route.archived` | boolean | no | Archives or unarchives the route. | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `route` | object | | | `route.id` | integer | | | `route.user_id` | integer | | | `route.url` | string | | | `route.html_url` | string | | | `route.visibility` | string | | | `route.name` | string | | | `route.description` | string or null | | | `route.locality` | string or null | | | `route.administrative_area` | string or null | | | `route.country_code` | string or null | | | `route.distance` | number | Distance in meters | | `route.elevation_gain` | number | Elevation gain in meters | | `route.elevation_loss` | number | Elevation loss in meters | | `route.first_lat` | number | | | `route.first_lng` | number | | | `route.last_lat` | number | | | `route.last_lng` | number | | | `route.sw_lat` | number | Southwest bounding box latitude | | `route.sw_lng` | number | Southwest bounding box longitude | | `route.ne_lat` | number | Northeast bounding box latitude | | `route.ne_lng` | number | Northeast bounding box longitude | | `route.track_type` | string or null | | | `route.terrain` | string or null | | | `route.difficulty` | string or null | | | `route.unpaved_pct` | number or null | | | `route.surface` | string or null | | | `route.archived` | boolean or null | null for non owned routes | | `route.created_at` | date-time | | | `route.updated_at` | date-time | | | `route.tags` | array of strings | Tags. Only present on club-owned routes. | | `route.activity_types` | array of strings | Activity types for this route. See Activity Types reference. One of: `cycling:generic`, `cycling:road`, `cycling:gravel`, `cycling:mountain`, `cycling:commute`, `walking:generic`, `walking:hiking`, `running:generic`, `driving:generic`, `motorcycling:generic`, `swimming:generic`, `snow:generic`. | | `route.track_points` | array of objects | | | `route.track_points[].x` | number | Longitude | | `route.track_points[].y` | number | Latitude | | `route.track_points[].d` | number | Distance from start in meters | | `route.track_points[].e` | number | Elevation in meters | | `route.track_points[].S` | integer | Surface type | | `route.track_points[].R` | integer | Highway tag | | `route.course_points` | array of objects | | | `route.course_points[].x` | number | Longitude | | `route.course_points[].y` | number | Latitude | | `route.course_points[].d` | number | Distance from start in meters | | `route.course_points[].i` | integer | Cue track index | | `route.course_points[].t` | string | Type of cue | | `route.course_points[].n` | string | Cue text | | `route.course_points[]._e` | boolean | User edited cue | | `route.points_of_interest` | array of objects | | | `route.points_of_interest[].id` | integer | | | `route.points_of_interest[].user_id` | integer | | | `route.points_of_interest[].type` | string | | | `route.points_of_interest[].type_id` | integer | | | `route.points_of_interest[].type_name` | string | | | `route.points_of_interest[].name` | string | | | `route.points_of_interest[].description` | string or null | | | `route.points_of_interest[].url` | string | | | `route.points_of_interest[].lat` | number | | | `route.points_of_interest[].lng` | number | | | `route.points_of_interest[].distances` | array of numbers | Distances from start in meters for waypoints | | `route.points_of_interest[].tag_names` | array of strings | | | `route.photos` | array of objects | | | `route.photos[].id` | integer | | | `route.photos[].url` | string | | | `route.photos[].highlighted` | boolean | | | `route.photos[].caption` | string or null | | | `route.photos[].lat` | number or null | | | `route.photos[].lng` | number or null | | | `route.photos[].elevation` | integer or null | | | `route.photos[].location` | string or null | | | `route.photos[].locality` | string or null | | | `route.photos[].administrative_area` | string or null | | | `route.photos[].country_code` | string or null | | | `route.photos[].created_at` | date-time | | | `route.collections` | array of objects | | | `route.collections[].id` | integer | | | `route.collections[].user_id` | integer | | | `route.collections[].url` | string | | | `route.collections[].html_url` | string | | | `route.collections[].visibility` | string | | | `route.collections[].name` | string or null | | | `route.collections[].description` | string or null | | | `route.collections[].cover` | string or null | | | `route.collections[].created_at` | date-time | | | `route.collections[].updated_at` | date-time | | ### Errors - `400` Empty body - `401` Unauthorized - `403` Forbidden - cannot update route owned by another user - `404` Route not found - `422` Invalid value ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X PUT \ -H "Content-Type: application/json" \ -d '{ "route": { "name": "Forest Park loop", "description": "Morning ride through Forest Park", "visibility": "public", "activity_types": [ "cycling:generic" ], "archived": false } }' \ https://ridewithgps.com/api/v1/routes/123.json ``` ### Example response ```json { "route": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/routes/123.json", "html_url": "https://ridewithgps.com/routes/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "distance": 40237, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "unpaved_pct": 12, "surface": "mostly_paved", "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "tags": [ "Tags" ], "activity_types": [ "cycling:generic" ], "track_points": [ { "x": -122.691804, "y": 45.521529, "d": 12487.3, "e": 153.6, "S": 1, "R": 1 } ], "course_points": [ { "x": -122.691804, "y": 45.521529, "d": 12487.3, "i": 412, "t": "Right", "n": "Turn right onto NW Thurman St", "_e": false } ], "points_of_interest": [ { "id": 123, "user_id": 123, "type": "coffee", "type_id": 123, "type_name": "Coffee", "name": "Coffee stop", "description": "Good espresso before the climb", "url": "https://ridewithgps.com/api/v1/points_of_interest/123.json", "lat": 45.521529, "lng": -122.691804, "distances": [ 12487.3 ], "tag_names": [ "Tag names" ] } ], "photos": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "highlighted": false, "caption": "View from Pittock Mansion", "lat": 45.521529, "lng": -122.691804, "elevation": 290, "location": "Pittock Mansion", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "created_at": "2000-01-01T12:00:00Z" } ], "collections": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/collections/123.json", "html_url": "https://ridewithgps.com/collections/123", "visibility": "public", "name": "Portland favorites", "description": "Our best rides around Portland", "cover": null, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } } ``` ## Deletes the specified route `DELETE /api/v1/routes/{id}.json` Deletes a route owned by the authenticated user ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Route ID | ### Response `204` Route deleted successfully ### Errors - `401` Unauthorized - `403` Forbidden - cannot delete route owned by another user - `404` Route not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X DELETE \ https://ridewithgps.com/api/v1/routes/123.json ``` --- # Trips Source: https://ridewithgps.com/api/v1/doc/endpoints/trips.md A trip is a recorded ride. Upload a GPX, TCX, KML or FIT file to create trips: the upload runs in the background and returns a [task](https://ridewithgps.com/api/v1/doc/endpoints/tasks.md). See also: [Routes and trips](https://ridewithgps.com/api/v1/doc/reference/routes_and_trips.md), [Track points](https://ridewithgps.com/api/v1/doc/reference/track_points.md), [Activity types](https://ridewithgps.com/api/v1/doc/reference/activity_types.md). OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_trips.yaml ## Returns a list of trips `GET /api/v1/trips.json` Returns a paginated list of trips for the authenticated user. Supports filtering by `name`, `visibility`, `distance_min`, `distance_max`, `elevation_gain_min`, `elevation_gain_max` and `stationary`. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `page` | integer | query | no | Page number for pagination | | `page_size` | integer | query | no | Number of items per page (20-200) | | `name` | string | query | no | Filter by name (partial match) | | `visibility` | string | query | no | Filter by visibility. One of: `public`, `followers_only`, `mutual_followers_only`, `private`. | | `distance_min` | integer | query | no | Minimum distance in meters | | `distance_max` | integer | query | no | Maximum distance in meters | | `elevation_gain_min` | integer | query | no | Minimum elevation gain in meters | | `elevation_gain_max` | integer | query | no | Maximum elevation gain in meters | | `stationary` | string | query | no | Filter by stationary status. One of: `true`, `false`. | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `trips` | array of objects | | | `trips[].id` | integer | | | `trips[].user_id` | integer | | | `trips[].url` | string | | | `trips[].html_url` | string | | | `trips[].visibility` | string | | | `trips[].name` | string | | | `trips[].description` | string or null | | | `trips[].departed_at` | date-time or null | | | `trips[].time_zone` | string or null | | | `trips[].locality` | string or null | | | `trips[].administrative_area` | string or null | | | `trips[].country_code` | string or null | | | `trips[].activity_type` | string or null | | | `trips[].fit_sport` | integer or null | | | `trips[].fit_sub_sport` | integer or null | | | `trips[].stationary` | boolean | | | `trips[].distance` | number | Distance in meters | | `trips[].duration` | number | Duration in seconds | | `trips[].moving_time` | number | Moving time in seconds | | `trips[].elevation_gain` | number | Elevation gain in meters | | `trips[].elevation_loss` | number | Elevation loss in meters | | `trips[].first_lat` | number or null | | | `trips[].first_lng` | number or null | | | `trips[].last_lat` | number or null | | | `trips[].last_lng` | number or null | | | `trips[].sw_lat` | number or null | | | `trips[].sw_lng` | number or null | | | `trips[].ne_lat` | number or null | | | `trips[].ne_lng` | number or null | | | `trips[].track_type` | string or null | | | `trips[].terrain` | string or null | | | `trips[].difficulty` | string or null | | | `trips[].avg_speed` | number or null | Average speed in kilometers per hour | | `trips[].max_speed` | number or null | Maximum speed in kilometers per hour | | `trips[].avg_cad` | number or null | Average cadence in rounds per minute | | `trips[].min_cad` | number or null | Minimum cadence in rounds per minute | | `trips[].max_cad` | number or null | Maximum cadence in rounds per minute | | `trips[].avg_hr` | number or null | Average heart rate in beats per minute | | `trips[].min_hr` | number or null | Minimum heart rate in beats per minute | | `trips[].max_hr` | number or null | Maximum heart rate in beats per minute | | `trips[].avg_watts` | number or null | Average power in watts | | `trips[].min_watts` | number or null | Minimum power in watts | | `trips[].max_watts` | number or null | Maximum power in watts | | `trips[].calories` | number or null | Calories burned | | `trips[].device` | string or null | | | `trips[].created_at` | date-time | | | `trips[].updated_at` | date-time | | | `meta` | object | | | `meta.pagination` | object | | | `meta.pagination.record_count` | integer | Total number of records | | `meta.pagination.page_count` | integer | Total number of pages | | `meta.pagination.page_size` | integer | Number of records per page | | `meta.pagination.next_page_url` | string or null | URL for the next page (null if last page) | ### Errors - `401` Unauthorized ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/trips.json ``` ### Example response ```json { "trips": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/trips/123.json", "html_url": "https://ridewithgps.com/trips/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "departed_at": "2000-01-01T08:00:00-08:00", "time_zone": "America/Los_Angeles", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "activity_type": "cycling:road", "fit_sport": 2, "fit_sub_sport": 7, "stationary": false, "distance": 40237, "duration": 7856, "moving_time": 7204, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "avg_speed": 20.1, "max_speed": 52.3, "avg_cad": 87, "min_cad": 0, "max_cad": 119, "avg_hr": 143, "min_hr": 87, "max_hr": 177, "avg_watts": 183, "min_watts": 0, "max_watts": 627, "calories": 1318, "device": "Garmin Edge 840", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "meta": { "pagination": { "record_count": 45, "page_count": 3, "page_size": 20, "next_page_url": "https://ridewithgps.com/api/v1/trips.json?page=2" } } } ``` ## Returns the specified trip `GET /api/v1/trips/{id}.json` Returns detailed information about a specific trip ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Trip ID | | `privacy_code` | string | query | no | Privacy code for the non public asset | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `trip` | object | | | `trip.id` | integer | | | `trip.user_id` | integer | | | `trip.url` | string | | | `trip.html_url` | string | | | `trip.visibility` | string | | | `trip.name` | string | | | `trip.description` | string or null | | | `trip.departed_at` | date-time or null | | | `trip.time_zone` | string or null | | | `trip.locality` | string or null | | | `trip.administrative_area` | string or null | | | `trip.country_code` | string or null | | | `trip.activity_type` | string or null | | | `trip.fit_sport` | integer or null | | | `trip.fit_sub_sport` | integer or null | | | `trip.stationary` | boolean | | | `trip.distance` | number | Distance in meters | | `trip.duration` | number | Duration in seconds | | `trip.moving_time` | number | Moving time in seconds | | `trip.elevation_gain` | number | Elevation gain in meters | | `trip.elevation_loss` | number | Elevation loss in meters | | `trip.first_lat` | number or null | | | `trip.first_lng` | number or null | | | `trip.last_lat` | number or null | | | `trip.last_lng` | number or null | | | `trip.sw_lat` | number or null | | | `trip.sw_lng` | number or null | | | `trip.ne_lat` | number or null | | | `trip.ne_lng` | number or null | | | `trip.track_type` | string or null | | | `trip.terrain` | string or null | | | `trip.difficulty` | string or null | | | `trip.avg_speed` | number or null | Average speed in kilometers per hour | | `trip.max_speed` | number or null | Maximum speed in kilometers per hour | | `trip.avg_cad` | number or null | Average cadence in rounds per minute | | `trip.min_cad` | number or null | Minimum cadence in rounds per minute | | `trip.max_cad` | number or null | Maximum cadence in rounds per minute | | `trip.avg_hr` | number or null | Average heart rate in beats per minute | | `trip.min_hr` | number or null | Minimum heart rate in beats per minute | | `trip.max_hr` | number or null | Maximum heart rate in beats per minute | | `trip.avg_watts` | number or null | Average power in watts | | `trip.min_watts` | number or null | Minimum power in watts | | `trip.max_watts` | number or null | Maximum power in watts | | `trip.calories` | number or null | Calories burned | | `trip.device` | string or null | | | `trip.created_at` | date-time | | | `trip.updated_at` | date-time | | | `trip.track_points` | array of objects | | | `trip.track_points[].x` | number | Longitude | | `trip.track_points[].y` | number | Latitude | | `trip.track_points[].d` | number | Distance from start in meters | | `trip.track_points[].e` | integer | Elevation in meters | | `trip.track_points[].t` | integer | Unix epoch time in seconds | | `trip.track_points[].s` | number | Speed in kilometers per hour | | `trip.track_points[].T` | integer | Temperature in degrees celsius | | `trip.track_points[].h` | integer | Heart rate in beats per minute | | `trip.track_points[].c` | integer | Cadence in rounds per minute | | `trip.track_points[].p` | integer | Power output in watts | | `trip.track_points[].pb` | integer | Power balance percent L/R | | `trip.track_points[].lap` | boolean | Start of lap | | `trip.track_points[].k` | boolean | Exclude from metrics | | `trip.track_points[].m` | boolean | User modified | | `trip.gear` | object | | | `trip.gear.id` | integer | | | `trip.gear.make` | string or null | | | `trip.gear.model` | string or null | | | `trip.gear.description` | string or null | | | `trip.gear.exclude_from_totals` | boolean | | | `trip.gear.created_at` | date-time | | | `trip.photos` | array of objects | | | `trip.photos[].id` | integer | | | `trip.photos[].url` | string | | | `trip.photos[].highlighted` | boolean | | | `trip.photos[].caption` | string or null | | | `trip.photos[].lat` | number or null | | | `trip.photos[].lng` | number or null | | | `trip.photos[].elevation` | integer or null | | | `trip.photos[].location` | string or null | | | `trip.photos[].locality` | string or null | | | `trip.photos[].administrative_area` | string or null | | | `trip.photos[].country_code` | string or null | | | `trip.photos[].created_at` | date-time | | | `trip.collections` | array of objects | | | `trip.collections[].id` | integer | | | `trip.collections[].user_id` | integer | | | `trip.collections[].url` | string | | | `trip.collections[].html_url` | string | | | `trip.collections[].visibility` | string | | | `trip.collections[].name` | string or null | | | `trip.collections[].description` | string or null | | | `trip.collections[].cover` | string or null | | | `trip.collections[].created_at` | date-time | | | `trip.collections[].updated_at` | date-time | | ### Errors - `401` Unauthorized - `403` Forbidden - Trip not visible to user - `404` Not Found - Trip not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/trips/123.json ``` ### Example response ```json { "trip": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/trips/123.json", "html_url": "https://ridewithgps.com/trips/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "departed_at": "2000-01-01T08:00:00-08:00", "time_zone": "America/Los_Angeles", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "activity_type": "cycling:road", "fit_sport": 2, "fit_sub_sport": 7, "stationary": false, "distance": 40237, "duration": 7856, "moving_time": 7204, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "avg_speed": 20.1, "max_speed": 52.3, "avg_cad": 87, "min_cad": 0, "max_cad": 119, "avg_hr": 143, "min_hr": 87, "max_hr": 177, "avg_watts": 183, "min_watts": 0, "max_watts": 627, "calories": 1318, "device": "Garmin Edge 840", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "track_points": [ { "x": -122.691804, "y": 45.521529, "d": 12487.3, "e": 154, "t": 946744650, "s": 24.6, "T": 8, "h": 145, "c": 88, "p": 195, "pb": 51, "lap": false, "k": false, "m": false } ], "gear": { "id": 123, "make": "Specialized", "model": "Diverge", "description": "Gravel bike", "exclude_from_totals": false, "created_at": "2000-01-01T12:00:00Z" }, "photos": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "highlighted": false, "caption": "View from Pittock Mansion", "lat": 45.521529, "lng": -122.691804, "elevation": 290, "location": "Pittock Mansion", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "created_at": "2000-01-01T12:00:00Z" } ], "collections": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/collections/123.json", "html_url": "https://ridewithgps.com/collections/123", "visibility": "public", "name": "Portland favorites", "description": "Our best rides around Portland", "cover": null, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } } ``` ## Returns the polyline for the specified trip `GET /api/v1/trips/{id}/polyline.json` Returns a simplified polyline of the trip geometry, suitable for displaying on a map. The `data` field is a Google Encoded Polyline. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Trip ID | | `privacy_code` | string | query | no | Privacy code for the non public asset | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `polyline` | object | | | `polyline.parent_type` | string | Type of parent object (route or trip) | | `polyline.parent_id` | integer | ID of the parent object | | `polyline.data` | string or null | Google Encoded Polyline (precision 5, [latitude, longitude] order); simplified geometry. | ### Errors - `401` Unauthorized - `403` Forbidden - Trip not visible to user - `404` Not Found - Trip not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/trips/123/polyline.json ``` ### Example response ```json { "polyline": { "parent_type": "route", "parent_id": 123, "data": "en`sFbhlaSiAoDlCaBa@mAWi@sBwC" } } ``` ## Downloads the specified trip as a GPS file `GET /api/v1/trips/{id}.{format}` Returns the trip as a GPS file, ready to load on a GPS device or into another application. The extension picks the format: | Extension | Content type | File | |-----------|----------------------------------------|-----------------------------------------------------------------------| | `gpx` | `application/gpx+xml` | GPX 1.1 track at full resolution | | `tcx` | `application/tcx+xml` | TCX activity history with heart rate, cadence and power when recorded | | `fit` | `application/vnd.ant.fit` | FIT activity | | `kml` | `application/vnd.google-earth.kml+xml` | Google Earth track | When the trip was uploaded as a FIT file and has not been edited since, the FIT download returns the original file as recorded by the device. Track points are exported as the authenticated user is allowed to see them: points inside a privacy zone are only present for the trip owner, or when a valid `privacy_code` is given. The file is sent as an attachment with a filename derived from the trip name. Visibility rules are the same as for the JSON record: a non public trip needs a `privacy_code` unless it belongs to the authenticated user. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Trip ID | | `format` | string | path | yes | File format. One of: `gpx`, `tcx`, `fit`, `kml`. | | `privacy_code` | string | query | no | Privacy code for the non public asset | ### Response `200` GPS file ### Errors - `401` Unauthorized - `403` Forbidden - Trip not visible to user ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/trips/123.gpx ``` ## Uploads a file to create trips `POST /api/v1/trips.json` Creates one or more trips from an uploaded GPS file. Accepted formats are GPX, TCX, KML and FIT. **Multipart uploads**: This endpoint accepts only `Content-Type: multipart/form-data`. Send the following fields: - `file` - GPS file (binary), required - `name` - Name for the created trip, otherwise taken from the file - `description` - Description for the created trip - `gear_id` - Gear to assign, must belong to the authenticated user Processing happens in the background. The response is a task with `status: "pending"`, and its `Location` header points at the task. Poll that url until `status` becomes `completed`, then read the `items` array for the trips that were created and the `errors` array for anything that failed. A trip needs timestamps on its track points. A file without them, such as a planned route, cannot be imported here and is reported with the `time_data_missing` error code. Re-uploading a ride that already exists is reported with the `duplicate` error code, and the error carries a reference to the existing trip. Trip visibility always follows the account's default privacy setting for trips and cannot be set through this endpoint. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Request body (`multipart/form-data`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `file` | file | yes | GPS file | | `name` | string | no | Name for the created trip, otherwise taken from the file | | `description` | string | no | Description for the created trip | | `gear_id` | integer | no | Gear to assign, must belong to the authenticated user | ### Response `202` | Name | Type | Description | | --- | --- | --- | | `task` | object | | | `task.id` | integer | | | `task.user_id` | integer | | | `task.url` | string | API url of the task, to poll until it completes | | `task.type` | string | What kind of work the task performs. `gps_file_upload` for uploads, `experience_package` for experience packages | | `task.status` | string | `pending` until the task has run, then `completed` | | `task.created_at` | date-time | | | `task.updated_at` | date-time | | | `task.items` | array of objects | Assets created by the task. Empty while pending, and empty if nothing was created. A file holding several tracks creates one asset per track | | `task.items[].item_type` | string | Type of the created asset: `route` or `trip` for uploads, `experience_package` for experience packages | | `task.items[].item_id` | integer | | | `task.items[].item_url` | string or null | API url of the created asset | | `task.errors` | array of objects | Anything that went wrong, one entry per track that could not be imported. Empty when the task succeeded entirely | | `task.errors[].code` | string | Machine readable reason. One of `duplicate`, `time_data_missing`, `no_tracks`, `empty_file`, `parse_failed`, `failed_to_process`, `weigh_in_failed`, `build_failed`, `error` | | `task.errors[].message` | string | Human readable description, always in English | | `task.errors[].item_type` | string or null | Set when the error refers to an existing asset, as for a duplicate | | `task.errors[].item_id` | integer or null | | | `task.errors[].item_url` | string or null | | ### Errors - `400` No file provided - `401` Unauthorized - `422` Empty file or invalid parameter ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -F file=@route.gpx \ -F name="Forest Park loop" \ -F description="Morning ride through Forest Park" \ -F gear_id="123" \ https://ridewithgps.com/api/v1/trips.json ``` ### Example response ```json { "task": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/tasks/123.json", "type": "gps_file_upload", "status": "completed", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "items": [ { "item_type": "route", "item_id": 123, "item_url": "https://ridewithgps.com/api/v1/routes/123.json" } ], "errors": [ { "code": "duplicate", "message": "This route already exists", "item_type": "route", "item_id": 123, "item_url": "https://ridewithgps.com/api/v1/routes/123.json" } ] } } ``` ## Copies the specified trip into your routes `POST /api/v1/trips/{id}/copy.json` Makes a route from a trip the authenticated user can see, in their own routes. The route follows the trip's track, without its privacy zones, timestamps or sensor data. Organizations can turn copying off for their trips. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Trip ID | | `privacy_code` | string | query | no | Privacy code for the non public asset | ### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `route` | object | no | | | `route.name` | string | no | Defaults to the original name. | | `route.visibility` | string | no | Defaults to `private`, or `managers_only` for an organization. User-owned: `public`, `followers_only`, `mutual_followers_only` or `private`. Organization-owned: `public`, `members_only` or `managers_only`. See Visibilities. | ### Response `201` | Name | Type | Description | | --- | --- | --- | | `route` | object | | | `route.id` | integer | | | `route.user_id` | integer | | | `route.url` | string | | | `route.html_url` | string | | | `route.visibility` | string | | | `route.name` | string | | | `route.description` | string or null | | | `route.locality` | string or null | | | `route.administrative_area` | string or null | | | `route.country_code` | string or null | | | `route.distance` | number | Distance in meters | | `route.elevation_gain` | number | Elevation gain in meters | | `route.elevation_loss` | number | Elevation loss in meters | | `route.first_lat` | number | | | `route.first_lng` | number | | | `route.last_lat` | number | | | `route.last_lng` | number | | | `route.sw_lat` | number | Southwest bounding box latitude | | `route.sw_lng` | number | Southwest bounding box longitude | | `route.ne_lat` | number | Northeast bounding box latitude | | `route.ne_lng` | number | Northeast bounding box longitude | | `route.track_type` | string or null | | | `route.terrain` | string or null | | | `route.difficulty` | string or null | | | `route.unpaved_pct` | number or null | | | `route.surface` | string or null | | | `route.archived` | boolean or null | null for non owned routes | | `route.created_at` | date-time | | | `route.updated_at` | date-time | | ### Errors - `400` Malformed body: route is not an object - `401` Unauthorized - `403` Forbidden - Trip not visible to user, or its organization turned copying off - `404` Not Found - Trip not found - `422` Invalid value ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -H "Content-Type: application/json" \ -d '{ "route": { "name": "Forest Park loop", "visibility": "private" } }' \ https://ridewithgps.com/api/v1/trips/123/copy.json ``` ### Example response ```json { "route": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/routes/123.json", "html_url": "https://ridewithgps.com/routes/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "distance": 40237, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "unpaved_pct": 12, "surface": "mostly_paved", "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ## Updates the specified trip `PUT /api/v1/trips/{id}.json` Updates details of a trip owned by the authenticated user. Only the fields sent are changed. The track cannot be changed. Any invalid value returns a 422 and nothing is saved. Values of the wrong type, such as an object for `name`, may be ignored. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Trip ID | ### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `trip` | object | yes | | | `trip.name` | string or null | no | null or empty resets the name to its default. | | `trip.description` | string or null | no | At most 16,000 characters. | | `trip.visibility` | string | no | User-owned: `public`, `followers_only`, `mutual_followers_only` or `private`. Organization-owned: `public`, `members_only` or `managers_only`. See Visibilities. | | `trip.activity_type` | string | no | See Activity Types. One of: `other:generic`, `cycling:generic`, `cycling:road`, `cycling:gravel`, `cycling:cyclocross`, `cycling:mountain`, `cycling:recumbent`, `cycling:hand_cycling`, `cycling:commute`, `cycling:indoor`, `cycling:virtual`, `e_biking:generic`, `e_biking:road`, `e_biking:mountain`, `running:generic`, `running:road`, `running:trail`, `running:indoor`, `walking:generic`, `walking:hiking`, `walking:indoor`, `walking:speed`, `swimming:generic`, `swimming:lap`, `swimming:open_water`, `snow:generic`, `snow:alpine_skiing`, `snow:cross_country_skiing`, `snow:snowboarding`, `snow:snowshoeing`, `driving:generic`, `motorcycling:generic`, `motorcycling:atv`, `motorcycling:motocross`, `training:generic`, `training:strength`, `training:cardio`, `training:breathing`, `training:yoga`, `training:hiit`. | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `trip` | object | | | `trip.id` | integer | | | `trip.user_id` | integer | | | `trip.url` | string | | | `trip.html_url` | string | | | `trip.visibility` | string | | | `trip.name` | string | | | `trip.description` | string or null | | | `trip.departed_at` | date-time or null | | | `trip.time_zone` | string or null | | | `trip.locality` | string or null | | | `trip.administrative_area` | string or null | | | `trip.country_code` | string or null | | | `trip.activity_type` | string or null | | | `trip.fit_sport` | integer or null | | | `trip.fit_sub_sport` | integer or null | | | `trip.stationary` | boolean | | | `trip.distance` | number | Distance in meters | | `trip.duration` | number | Duration in seconds | | `trip.moving_time` | number | Moving time in seconds | | `trip.elevation_gain` | number | Elevation gain in meters | | `trip.elevation_loss` | number | Elevation loss in meters | | `trip.first_lat` | number or null | | | `trip.first_lng` | number or null | | | `trip.last_lat` | number or null | | | `trip.last_lng` | number or null | | | `trip.sw_lat` | number or null | | | `trip.sw_lng` | number or null | | | `trip.ne_lat` | number or null | | | `trip.ne_lng` | number or null | | | `trip.track_type` | string or null | | | `trip.terrain` | string or null | | | `trip.difficulty` | string or null | | | `trip.avg_speed` | number or null | Average speed in kilometers per hour | | `trip.max_speed` | number or null | Maximum speed in kilometers per hour | | `trip.avg_cad` | number or null | Average cadence in rounds per minute | | `trip.min_cad` | number or null | Minimum cadence in rounds per minute | | `trip.max_cad` | number or null | Maximum cadence in rounds per minute | | `trip.avg_hr` | number or null | Average heart rate in beats per minute | | `trip.min_hr` | number or null | Minimum heart rate in beats per minute | | `trip.max_hr` | number or null | Maximum heart rate in beats per minute | | `trip.avg_watts` | number or null | Average power in watts | | `trip.min_watts` | number or null | Minimum power in watts | | `trip.max_watts` | number or null | Maximum power in watts | | `trip.calories` | number or null | Calories burned | | `trip.device` | string or null | | | `trip.created_at` | date-time | | | `trip.updated_at` | date-time | | | `trip.track_points` | array of objects | | | `trip.track_points[].x` | number | Longitude | | `trip.track_points[].y` | number | Latitude | | `trip.track_points[].d` | number | Distance from start in meters | | `trip.track_points[].e` | integer | Elevation in meters | | `trip.track_points[].t` | integer | Unix epoch time in seconds | | `trip.track_points[].s` | number | Speed in kilometers per hour | | `trip.track_points[].T` | integer | Temperature in degrees celsius | | `trip.track_points[].h` | integer | Heart rate in beats per minute | | `trip.track_points[].c` | integer | Cadence in rounds per minute | | `trip.track_points[].p` | integer | Power output in watts | | `trip.track_points[].pb` | integer | Power balance percent L/R | | `trip.track_points[].lap` | boolean | Start of lap | | `trip.track_points[].k` | boolean | Exclude from metrics | | `trip.track_points[].m` | boolean | User modified | | `trip.gear` | object | | | `trip.gear.id` | integer | | | `trip.gear.make` | string or null | | | `trip.gear.model` | string or null | | | `trip.gear.description` | string or null | | | `trip.gear.exclude_from_totals` | boolean | | | `trip.gear.created_at` | date-time | | | `trip.photos` | array of objects | | | `trip.photos[].id` | integer | | | `trip.photos[].url` | string | | | `trip.photos[].highlighted` | boolean | | | `trip.photos[].caption` | string or null | | | `trip.photos[].lat` | number or null | | | `trip.photos[].lng` | number or null | | | `trip.photos[].elevation` | integer or null | | | `trip.photos[].location` | string or null | | | `trip.photos[].locality` | string or null | | | `trip.photos[].administrative_area` | string or null | | | `trip.photos[].country_code` | string or null | | | `trip.photos[].created_at` | date-time | | | `trip.collections` | array of objects | | | `trip.collections[].id` | integer | | | `trip.collections[].user_id` | integer | | | `trip.collections[].url` | string | | | `trip.collections[].html_url` | string | | | `trip.collections[].visibility` | string | | | `trip.collections[].name` | string or null | | | `trip.collections[].description` | string or null | | | `trip.collections[].cover` | string or null | | | `trip.collections[].created_at` | date-time | | | `trip.collections[].updated_at` | date-time | | ### Errors - `400` Empty body - `401` Unauthorized - `403` Forbidden - cannot update trip owned by another user - `404` Trip not found - `422` Invalid value ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X PUT \ -H "Content-Type: application/json" \ -d '{ "trip": { "name": "Forest Park loop", "description": "Morning ride through Forest Park", "visibility": "public", "activity_type": "cycling:road" } }' \ https://ridewithgps.com/api/v1/trips/123.json ``` ### Example response ```json { "trip": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/trips/123.json", "html_url": "https://ridewithgps.com/trips/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "departed_at": "2000-01-01T08:00:00-08:00", "time_zone": "America/Los_Angeles", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "activity_type": "cycling:road", "fit_sport": 2, "fit_sub_sport": 7, "stationary": false, "distance": 40237, "duration": 7856, "moving_time": 7204, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "avg_speed": 20.1, "max_speed": 52.3, "avg_cad": 87, "min_cad": 0, "max_cad": 119, "avg_hr": 143, "min_hr": 87, "max_hr": 177, "avg_watts": 183, "min_watts": 0, "max_watts": 627, "calories": 1318, "device": "Garmin Edge 840", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "track_points": [ { "x": -122.691804, "y": 45.521529, "d": 12487.3, "e": 154, "t": 946744650, "s": 24.6, "T": 8, "h": 145, "c": 88, "p": 195, "pb": 51, "lap": false, "k": false, "m": false } ], "gear": { "id": 123, "make": "Specialized", "model": "Diverge", "description": "Gravel bike", "exclude_from_totals": false, "created_at": "2000-01-01T12:00:00Z" }, "photos": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "highlighted": false, "caption": "View from Pittock Mansion", "lat": 45.521529, "lng": -122.691804, "elevation": 290, "location": "Pittock Mansion", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "created_at": "2000-01-01T12:00:00Z" } ], "collections": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/collections/123.json", "html_url": "https://ridewithgps.com/collections/123", "visibility": "public", "name": "Portland favorites", "description": "Our best rides around Portland", "cover": null, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } } ``` ## Deletes the specified trip `DELETE /api/v1/trips/{id}.json` Deletes a trip owned by the authenticated user ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Trip ID | ### Response `204` Trip deleted successfully ### Errors - `401` Unauthorized - `403` Forbidden - cannot delete trip owned by another user - `404` Trip not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X DELETE \ https://ridewithgps.com/api/v1/trips/123.json ``` --- # Photos Source: https://ridewithgps.com/api/v1/doc/endpoints/photos.md Upload a photo to use it in an [experience guide page](https://ridewithgps.com/api/v1/doc/reference/guide_page_blocks.md). See also: [Publish a multi-day tour](https://ridewithgps.com/api/v1/doc/organizations/publish_tours.md). OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_photos.yaml ## Uploads a photo `POST /api/v1/photos.json` Uploads an image and returns the new photo. Use its `id` wherever a photo id is expected. **Multipart uploads**: This endpoint accepts only `Content-Type: multipart/form-data`. Send the image in the `file` field. The photo has no parent and belongs to the authenticated user. A photo that is not used anywhere is deleted 24 hours after upload. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Request body (`multipart/form-data`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `file` | file | yes | Image file | ### Response `201` | Name | Type | Description | | --- | --- | --- | | `photo` | object | | | `photo.id` | integer | | | `photo.url` | string | | | `photo.highlighted` | boolean | | | `photo.caption` | string or null | | | `photo.lat` | number or null | | | `photo.lng` | number or null | | | `photo.elevation` | integer or null | | | `photo.location` | string or null | | | `photo.locality` | string or null | | | `photo.administrative_area` | string or null | | | `photo.country_code` | string or null | | | `photo.created_at` | date-time | | ### Errors - `400` Not an image - `401` Unauthorized ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -F file=@route.gpx \ https://ridewithgps.com/api/v1/photos.json ``` ### Example response ```json { "photo": { "id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "highlighted": false, "caption": "View from Pittock Mansion", "lat": 45.521529, "lng": -122.691804, "elevation": 290, "location": "Pittock Mansion", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "created_at": "2000-01-01T12:00:00Z" } } ``` --- # Collections Source: https://ridewithgps.com/api/v1/doc/endpoints/collections.md OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_collections.yaml ## Returns a list of collections `GET /api/v1/collections.json` Returns a paginated list of collections for the authenticated user. Supports filtering by `name` and `visibility`. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `page` | integer | query | no | Page number for pagination | | `page_size` | integer | query | no | Number of items per page (20-200) | | `name` | string | query | no | Filter by name (partial match) | | `visibility` | string | query | no | Filter by visibility. One of: `public`, `followers_only`, `mutual_followers_only`, `private`. | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `collections` | array of objects | | | `collections[].id` | integer | | | `collections[].user_id` | integer | | | `collections[].url` | string | | | `collections[].html_url` | string | | | `collections[].visibility` | string | | | `collections[].name` | string or null | | | `collections[].description` | string or null | | | `collections[].cover` | string or null | | | `collections[].created_at` | date-time | | | `collections[].updated_at` | date-time | | ### Errors - `401` Unauthorized ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/collections.json ``` ### Example response ```json { "collections": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/collections/123.json", "html_url": "https://ridewithgps.com/collections/123", "visibility": "public", "name": "Portland favorites", "description": "Our best rides around Portland", "cover": null, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } ``` ## Returns the specified collection `GET /api/v1/collections/{id}.json` Returns detailed information about a specific collection ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Collection ID | | `privacy_code` | string | query | no | Privacy code for the non public asset | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `collection` | object | | | `collection.id` | integer | | | `collection.user_id` | integer | | | `collection.url` | string | | | `collection.html_url` | string | | | `collection.visibility` | string | | | `collection.name` | string or null | | | `collection.description` | string or null | | | `collection.cover` | string or null | | | `collection.created_at` | date-time | | | `collection.updated_at` | date-time | | | `collection.routes` | array of objects | | | `collection.routes[].id` | integer | | | `collection.routes[].user_id` | integer | | | `collection.routes[].url` | string | | | `collection.routes[].html_url` | string | | | `collection.routes[].visibility` | string | | | `collection.routes[].name` | string | | | `collection.routes[].description` | string or null | | | `collection.routes[].locality` | string or null | | | `collection.routes[].administrative_area` | string or null | | | `collection.routes[].country_code` | string or null | | | `collection.routes[].distance` | number | Distance in meters | | `collection.routes[].elevation_gain` | number | Elevation gain in meters | | `collection.routes[].elevation_loss` | number | Elevation loss in meters | | `collection.routes[].first_lat` | number | | | `collection.routes[].first_lng` | number | | | `collection.routes[].last_lat` | number | | | `collection.routes[].last_lng` | number | | | `collection.routes[].sw_lat` | number | Southwest bounding box latitude | | `collection.routes[].sw_lng` | number | Southwest bounding box longitude | | `collection.routes[].ne_lat` | number | Northeast bounding box latitude | | `collection.routes[].ne_lng` | number | Northeast bounding box longitude | | `collection.routes[].track_type` | string or null | | | `collection.routes[].terrain` | string or null | | | `collection.routes[].difficulty` | string or null | | | `collection.routes[].unpaved_pct` | number or null | | | `collection.routes[].surface` | string or null | | | `collection.routes[].archived` | boolean or null | null for non owned routes | | `collection.routes[].created_at` | date-time | | | `collection.routes[].updated_at` | date-time | | | `collection.trips` | array of objects | | | `collection.trips[].id` | integer | | | `collection.trips[].user_id` | integer | | | `collection.trips[].url` | string | | | `collection.trips[].html_url` | string | | | `collection.trips[].visibility` | string | | | `collection.trips[].name` | string | | | `collection.trips[].description` | string or null | | | `collection.trips[].departed_at` | date-time or null | | | `collection.trips[].time_zone` | string or null | | | `collection.trips[].locality` | string or null | | | `collection.trips[].administrative_area` | string or null | | | `collection.trips[].country_code` | string or null | | | `collection.trips[].activity_type` | string or null | | | `collection.trips[].fit_sport` | integer or null | | | `collection.trips[].fit_sub_sport` | integer or null | | | `collection.trips[].stationary` | boolean | | | `collection.trips[].distance` | number | Distance in meters | | `collection.trips[].duration` | number | Duration in seconds | | `collection.trips[].moving_time` | number | Moving time in seconds | | `collection.trips[].elevation_gain` | number | Elevation gain in meters | | `collection.trips[].elevation_loss` | number | Elevation loss in meters | | `collection.trips[].first_lat` | number or null | | | `collection.trips[].first_lng` | number or null | | | `collection.trips[].last_lat` | number or null | | | `collection.trips[].last_lng` | number or null | | | `collection.trips[].sw_lat` | number or null | | | `collection.trips[].sw_lng` | number or null | | | `collection.trips[].ne_lat` | number or null | | | `collection.trips[].ne_lng` | number or null | | | `collection.trips[].track_type` | string or null | | | `collection.trips[].terrain` | string or null | | | `collection.trips[].difficulty` | string or null | | | `collection.trips[].avg_speed` | number or null | Average speed in kilometers per hour | | `collection.trips[].max_speed` | number or null | Maximum speed in kilometers per hour | | `collection.trips[].avg_cad` | number or null | Average cadence in rounds per minute | | `collection.trips[].min_cad` | number or null | Minimum cadence in rounds per minute | | `collection.trips[].max_cad` | number or null | Maximum cadence in rounds per minute | | `collection.trips[].avg_hr` | number or null | Average heart rate in beats per minute | | `collection.trips[].min_hr` | number or null | Minimum heart rate in beats per minute | | `collection.trips[].max_hr` | number or null | Maximum heart rate in beats per minute | | `collection.trips[].avg_watts` | number or null | Average power in watts | | `collection.trips[].min_watts` | number or null | Minimum power in watts | | `collection.trips[].max_watts` | number or null | Maximum power in watts | | `collection.trips[].calories` | number or null | Calories burned | | `collection.trips[].device` | string or null | | | `collection.trips[].created_at` | date-time | | | `collection.trips[].updated_at` | date-time | | ### Errors - `401` Unauthorized - `403` Forbidden - Collection not visible to user - `404` Not Found - Collection not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/collections/123.json ``` ### Example response ```json { "collection": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/collections/123.json", "html_url": "https://ridewithgps.com/collections/123", "visibility": "public", "name": "Portland favorites", "description": "Our best rides around Portland", "cover": null, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "routes": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/routes/123.json", "html_url": "https://ridewithgps.com/routes/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "distance": 40237, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "unpaved_pct": 12, "surface": "mostly_paved", "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "trips": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/trips/123.json", "html_url": "https://ridewithgps.com/trips/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "departed_at": "2000-01-01T08:00:00-08:00", "time_zone": "America/Los_Angeles", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "activity_type": "cycling:road", "fit_sport": 2, "fit_sub_sport": 7, "stationary": false, "distance": 40237, "duration": 7856, "moving_time": 7204, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "avg_speed": 20.1, "max_speed": 52.3, "avg_cad": 87, "min_cad": 0, "max_cad": 119, "avg_hr": 143, "min_hr": 87, "max_hr": 177, "avg_watts": 183, "min_watts": 0, "max_watts": 627, "calories": 1318, "device": "Garmin Edge 840", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } } ``` ## Returns the user's pinned collection `GET /api/v1/collections/pinned.json` Returns the authenticated user's pinned collection ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `collection` | object | | | `collection.id` | integer | | | `collection.user_id` | integer | | | `collection.url` | string | | | `collection.html_url` | string | | | `collection.visibility` | string | | | `collection.name` | string or null | | | `collection.description` | string or null | | | `collection.cover` | string or null | | | `collection.created_at` | date-time | | | `collection.updated_at` | date-time | | | `collection.routes` | array of objects | | | `collection.routes[].id` | integer | | | `collection.routes[].user_id` | integer | | | `collection.routes[].url` | string | | | `collection.routes[].html_url` | string | | | `collection.routes[].visibility` | string | | | `collection.routes[].name` | string | | | `collection.routes[].description` | string or null | | | `collection.routes[].locality` | string or null | | | `collection.routes[].administrative_area` | string or null | | | `collection.routes[].country_code` | string or null | | | `collection.routes[].distance` | number | Distance in meters | | `collection.routes[].elevation_gain` | number | Elevation gain in meters | | `collection.routes[].elevation_loss` | number | Elevation loss in meters | | `collection.routes[].first_lat` | number | | | `collection.routes[].first_lng` | number | | | `collection.routes[].last_lat` | number | | | `collection.routes[].last_lng` | number | | | `collection.routes[].sw_lat` | number | Southwest bounding box latitude | | `collection.routes[].sw_lng` | number | Southwest bounding box longitude | | `collection.routes[].ne_lat` | number | Northeast bounding box latitude | | `collection.routes[].ne_lng` | number | Northeast bounding box longitude | | `collection.routes[].track_type` | string or null | | | `collection.routes[].terrain` | string or null | | | `collection.routes[].difficulty` | string or null | | | `collection.routes[].unpaved_pct` | number or null | | | `collection.routes[].surface` | string or null | | | `collection.routes[].archived` | boolean or null | null for non owned routes | | `collection.routes[].created_at` | date-time | | | `collection.routes[].updated_at` | date-time | | | `collection.trips` | array of objects | | | `collection.trips[].id` | integer | | | `collection.trips[].user_id` | integer | | | `collection.trips[].url` | string | | | `collection.trips[].html_url` | string | | | `collection.trips[].visibility` | string | | | `collection.trips[].name` | string | | | `collection.trips[].description` | string or null | | | `collection.trips[].departed_at` | date-time or null | | | `collection.trips[].time_zone` | string or null | | | `collection.trips[].locality` | string or null | | | `collection.trips[].administrative_area` | string or null | | | `collection.trips[].country_code` | string or null | | | `collection.trips[].activity_type` | string or null | | | `collection.trips[].fit_sport` | integer or null | | | `collection.trips[].fit_sub_sport` | integer or null | | | `collection.trips[].stationary` | boolean | | | `collection.trips[].distance` | number | Distance in meters | | `collection.trips[].duration` | number | Duration in seconds | | `collection.trips[].moving_time` | number | Moving time in seconds | | `collection.trips[].elevation_gain` | number | Elevation gain in meters | | `collection.trips[].elevation_loss` | number | Elevation loss in meters | | `collection.trips[].first_lat` | number or null | | | `collection.trips[].first_lng` | number or null | | | `collection.trips[].last_lat` | number or null | | | `collection.trips[].last_lng` | number or null | | | `collection.trips[].sw_lat` | number or null | | | `collection.trips[].sw_lng` | number or null | | | `collection.trips[].ne_lat` | number or null | | | `collection.trips[].ne_lng` | number or null | | | `collection.trips[].track_type` | string or null | | | `collection.trips[].terrain` | string or null | | | `collection.trips[].difficulty` | string or null | | | `collection.trips[].avg_speed` | number or null | Average speed in kilometers per hour | | `collection.trips[].max_speed` | number or null | Maximum speed in kilometers per hour | | `collection.trips[].avg_cad` | number or null | Average cadence in rounds per minute | | `collection.trips[].min_cad` | number or null | Minimum cadence in rounds per minute | | `collection.trips[].max_cad` | number or null | Maximum cadence in rounds per minute | | `collection.trips[].avg_hr` | number or null | Average heart rate in beats per minute | | `collection.trips[].min_hr` | number or null | Minimum heart rate in beats per minute | | `collection.trips[].max_hr` | number or null | Maximum heart rate in beats per minute | | `collection.trips[].avg_watts` | number or null | Average power in watts | | `collection.trips[].min_watts` | number or null | Minimum power in watts | | `collection.trips[].max_watts` | number or null | Maximum power in watts | | `collection.trips[].calories` | number or null | Calories burned | | `collection.trips[].device` | string or null | | | `collection.trips[].created_at` | date-time | | | `collection.trips[].updated_at` | date-time | | ### Errors - `404` Pinned collection not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/collections/pinned.json ``` ### Example response ```json { "collection": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/collections/123.json", "html_url": "https://ridewithgps.com/collections/123", "visibility": "public", "name": "Portland favorites", "description": "Our best rides around Portland", "cover": null, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "routes": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/routes/123.json", "html_url": "https://ridewithgps.com/routes/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "distance": 40237, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "unpaved_pct": 12, "surface": "mostly_paved", "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "trips": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/trips/123.json", "html_url": "https://ridewithgps.com/trips/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "departed_at": "2000-01-01T08:00:00-08:00", "time_zone": "America/Los_Angeles", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "activity_type": "cycling:road", "fit_sport": 2, "fit_sub_sport": 7, "stationary": false, "distance": 40237, "duration": 7856, "moving_time": 7204, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "avg_speed": 20.1, "max_speed": 52.3, "avg_cad": 87, "min_cad": 0, "max_cad": 119, "avg_hr": 143, "min_hr": 87, "max_hr": 177, "avg_watts": 183, "min_watts": 0, "max_watts": 627, "calories": 1318, "device": "Garmin Edge 840", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } } ``` --- # Events Source: https://ridewithgps.com/api/v1/doc/endpoints/events.md An event is an organized ride, with its routes and the riders who RSVP to it. The participant endpoints read and set the authenticated user's own RSVP. An app RSVPs for a rider with that rider's own token: organization accounts can't RSVP for their members. Get notified of RSVPs with [webhooks](https://ridewithgps.com/api/v1/doc/webhooks.md). OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_events.yaml ## Events ### Returns a list of events `GET /api/v1/events.json` Returns a paginated list of events accessible to the authenticated user. Supports filtering by `name`, `visibility` and `archived` status. Archived events are left out unless `archived=true` is passed, which returns them on their own. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `page` | integer | query | no | Page number for pagination | | `page_size` | integer | query | no | Number of items per page (20-200) | | `name` | string | query | no | Filter by name (partial match) | | `visibility` | string | query | no | Filter by visibility. One of: `public`, `followers_only`, `mutual_followers_only`, `private`. | | `archived` | string | query | no | Filter by archived status. One of: `true`, `false`. | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `events` | array of objects | | | `events[].id` | integer | | | `events[].user_id` | integer | | | `events[].url` | string | | | `events[].html_url` | string | | | `events[].visibility` | string | | | `events[].name` | string | | | `events[].description` | string or null | | | `events[].logo_url` | string or null | | | `events[].banner_url` | string or null | | | `events[].location` | string or null | | | `events[].lat` | number or null | Latitude | | `events[].lng` | number or null | Longitude | | `events[].time_zone` | string | | | `events[].start_date` | string | | | `events[].start_time` | string | | | `events[].end_date` | string | | | `events[].end_time` | string | | | `events[].all_day` | boolean | | | `events[].archived` | boolean | | | `events[].created_at` | date-time | | | `events[].updated_at` | date-time | | | `meta` | object | | | `meta.pagination` | object | | | `meta.pagination.record_count` | integer | Total number of records | | `meta.pagination.page_count` | integer | Total number of pages | | `meta.pagination.page_size` | integer | Number of records per page | | `meta.pagination.next_page_url` | string or null | URL for the next page (null if last page) | #### Errors - `401` Unauthorized #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/events.json ``` #### Example response ```json { "events": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/events/123.json", "html_url": "https://ridewithgps.com/events/123", "visibility": "public", "name": "Portland Century", "description": "A 100 mile ride around Portland", "logo_url": "https://ridewithgps.com/files/logo.jpg", "banner_url": "https://ridewithgps.com/files/banner.jpg", "location": "Portland, OR", "lat": 45.521529, "lng": -122.691804, "time_zone": "America/Los_Angeles", "start_date": "2000-01-01", "start_time": "09:00", "end_date": "2000-01-01", "end_time": "15:00", "all_day": false, "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "meta": { "pagination": { "record_count": 45, "page_count": 3, "page_size": 20, "next_page_url": "https://ridewithgps.com/api/v1/events.json?page=2" } } } ``` ### Returns the specified event `GET /api/v1/events/{id}.json` Returns detailed information about a specific event. The `participants` array is included only when the authenticated user is the event owner. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | | | `privacy_code` | string | query | no | Privacy code for the non public asset | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `event` | object | | | `event.id` | integer | | | `event.user_id` | integer | | | `event.url` | string | | | `event.html_url` | string | | | `event.visibility` | string | | | `event.name` | string | | | `event.description` | string or null | | | `event.logo_url` | string or null | | | `event.banner_url` | string or null | | | `event.location` | string or null | | | `event.lat` | number or null | Latitude | | `event.lng` | number or null | Longitude | | `event.time_zone` | string | | | `event.start_date` | string | | | `event.start_time` | string | | | `event.end_date` | string | | | `event.end_time` | string | | | `event.all_day` | boolean | | | `event.archived` | boolean | | | `event.created_at` | date-time | | | `event.updated_at` | date-time | | | `event.tags` | array of strings | Tags. Only present on club-owned events. | | `event.organizers` | array of objects | Event organizers. Only present on organization-owned events, and limited to organizers who are still active members of the organization. | | `event.organizers[].id` | integer | | | `event.organizers[].name` | string | | | `event.organizers[].created_at` | date-time | | | `event.organizers[].updated_at` | date-time | | | `event.routes` | array of objects | | | `event.routes[].id` | integer | | | `event.routes[].user_id` | integer | | | `event.routes[].url` | string | | | `event.routes[].html_url` | string | | | `event.routes[].visibility` | string | | | `event.routes[].name` | string | | | `event.routes[].description` | string or null | | | `event.routes[].locality` | string or null | | | `event.routes[].administrative_area` | string or null | | | `event.routes[].country_code` | string or null | | | `event.routes[].distance` | number | Distance in meters | | `event.routes[].elevation_gain` | number | Elevation gain in meters | | `event.routes[].elevation_loss` | number | Elevation loss in meters | | `event.routes[].first_lat` | number | | | `event.routes[].first_lng` | number | | | `event.routes[].last_lat` | number | | | `event.routes[].last_lng` | number | | | `event.routes[].sw_lat` | number | Southwest bounding box latitude | | `event.routes[].sw_lng` | number | Southwest bounding box longitude | | `event.routes[].ne_lat` | number | Northeast bounding box latitude | | `event.routes[].ne_lng` | number | Northeast bounding box longitude | | `event.routes[].track_type` | string or null | | | `event.routes[].terrain` | string or null | | | `event.routes[].difficulty` | string or null | | | `event.routes[].unpaved_pct` | number or null | | | `event.routes[].surface` | string or null | | | `event.routes[].archived` | boolean or null | null for non owned routes | | `event.routes[].created_at` | date-time | | | `event.routes[].updated_at` | date-time | | | `event.photos` | array of objects | | | `event.photos[].id` | integer | | | `event.photos[].url` | string | | | `event.photos[].highlighted` | boolean | | | `event.photos[].caption` | string or null | | | `event.photos[].lat` | number or null | | | `event.photos[].lng` | number or null | | | `event.photos[].elevation` | integer or null | | | `event.photos[].location` | string or null | | | `event.photos[].locality` | string or null | | | `event.photos[].administrative_area` | string or null | | | `event.photos[].country_code` | string or null | | | `event.photos[].created_at` | date-time | | | `event.participants` | array of objects | Event participants. Only included for the event owner. | | `event.participants[].user` | object | | | `event.participants[].user.id` | integer | | | `event.participants[].user.name` | string | | | `event.participants[].user.email` | string or null | Null for accounts without a real email address. | | `event.participants[].user.created_at` | date-time | | | `event.participants[].user.updated_at` | date-time | | | `event.participants[].status` | string | `participant` (going), `interested`, `declined` (not going), or `disallowed` (removed by an organizer, or expired). A `disallowed` rider can neither RSVP again nor withdraw. One of: `participant`, `interested`, `declined`, `disallowed`. | | `event.participants[].created_at` | date-time | | | `event.participants[].updated_at` | date-time | | #### Errors - `401` Unauthorized - `403` Forbidden - Event not visible to user - `404` Not Found - Event not found #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/events/123.json ``` #### Example response ```json { "event": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/events/123.json", "html_url": "https://ridewithgps.com/events/123", "visibility": "public", "name": "Portland Century", "description": "A 100 mile ride around Portland", "logo_url": "https://ridewithgps.com/files/logo.jpg", "banner_url": "https://ridewithgps.com/files/banner.jpg", "location": "Portland, OR", "lat": 45.521529, "lng": -122.691804, "time_zone": "America/Los_Angeles", "start_date": "2000-01-01", "start_time": "09:00", "end_date": "2000-01-01", "end_time": "15:00", "all_day": false, "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "tags": [ "Tags" ], "organizers": [ { "id": 123, "name": "Alex Rider", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "routes": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/routes/123.json", "html_url": "https://ridewithgps.com/routes/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "distance": 40237, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "unpaved_pct": 12, "surface": "mostly_paved", "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "photos": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "highlighted": false, "caption": "View from Pittock Mansion", "lat": 45.521529, "lng": -122.691804, "elevation": 290, "location": "Pittock Mansion", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "created_at": "2000-01-01T12:00:00Z" } ], "participants": [ { "user": { "id": 123, "name": "Alex Rider", "email": "alex@example.com", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" }, "status": "participant", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } } ``` ### Creates an event `POST /api/v1/events.json` Creates a new event for the authenticated user. **Note**: The `organizer_ids`, `logo`, and `banner` fields are supported only for organization-owned events. They are not supported for user-owned events. **Multipart uploads**: To upload logo and banner images, send a request with `Content-Type: multipart/form-data` using the following fields: - `event[name]` - Event name - `event[description]` - Event description - `event[logo]` - Logo image (binary) - `event[banner]` - Banner image (binary) - etc. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `event` | object | yes | | | `event.name` | string | no | | | `event.description` | string or null | no | | | `event.visibility` | string | no | | | `event.location` | string | no | | | `event.lat` | number | no | Latitude | | `event.lng` | number | no | Longitude | | `event.time_zone` | string or null | no | | | `event.start_date` | string | no | | | `event.start_time` | string | no | | | `event.end_date` | string | no | | | `event.end_time` | string | no | | | `event.logo` | file or null | no | | | `event.banner` | file or null | no | | | `event.archived` | boolean | no | Archives or unarchives the event. Archived events are left out of `GET /api/v1/events.json` unless it is called with `archived=true`, but they stay reachable by id. Archiving does not remove the event from public event search on ridewithgps.com. Archiving an already archived event leaves its original archive date untouched. | | `event.route_ids` | array of integers | no | Routes attached to the event, in display order. This replaces the current set: routes already on the event but missing from the array are detached, and an empty array detaches all of them. Omit the field to leave the event's routes untouched. Only routes owned by the event owner can be attached. For organization-owned events the owner is the organization account, not the manager making the request. Ids that fail this check are ignored without an error. On a personal (not organization-owned) ride planned in the Ride with GPS mobile app, whose routes can belong to other riders, a new id that fails it, or the id of a deleted route, instead leaves all of the event's routes unchanged, still without an error. | | `event.organizer_ids` | array of integers | no | User ids of the event organizers. Organization-owned events only: the field is accepted and stored for user-owned events, but those events never return an `organizers` array, so it has no visible effect. This replaces the current set: ids already on the event but missing from the array are dropped, and an empty array clears all of them. Omit the field to leave the event's organizers untouched. The `organizers` array in the response is filtered to users who are active members of the organization, so an id that does not match one is stored but never returned. Unlike `route_ids`, this array carries no display order. | #### Response `201` | Name | Type | Description | | --- | --- | --- | | `event` | object | | | `event.id` | integer | | | `event.user_id` | integer | | | `event.url` | string | | | `event.html_url` | string | | | `event.visibility` | string | | | `event.name` | string | | | `event.description` | string or null | | | `event.logo_url` | string or null | | | `event.banner_url` | string or null | | | `event.location` | string or null | | | `event.lat` | number or null | Latitude | | `event.lng` | number or null | Longitude | | `event.time_zone` | string | | | `event.start_date` | string | | | `event.start_time` | string | | | `event.end_date` | string | | | `event.end_time` | string | | | `event.all_day` | boolean | | | `event.archived` | boolean | | | `event.created_at` | date-time | | | `event.updated_at` | date-time | | | `event.tags` | array of strings | Tags. Only present on club-owned events. | | `event.organizers` | array of objects | Event organizers. Only present on organization-owned events, and limited to organizers who are still active members of the organization. | | `event.organizers[].id` | integer | | | `event.organizers[].name` | string | | | `event.organizers[].created_at` | date-time | | | `event.organizers[].updated_at` | date-time | | | `event.routes` | array of objects | | | `event.routes[].id` | integer | | | `event.routes[].user_id` | integer | | | `event.routes[].url` | string | | | `event.routes[].html_url` | string | | | `event.routes[].visibility` | string | | | `event.routes[].name` | string | | | `event.routes[].description` | string or null | | | `event.routes[].locality` | string or null | | | `event.routes[].administrative_area` | string or null | | | `event.routes[].country_code` | string or null | | | `event.routes[].distance` | number | Distance in meters | | `event.routes[].elevation_gain` | number | Elevation gain in meters | | `event.routes[].elevation_loss` | number | Elevation loss in meters | | `event.routes[].first_lat` | number | | | `event.routes[].first_lng` | number | | | `event.routes[].last_lat` | number | | | `event.routes[].last_lng` | number | | | `event.routes[].sw_lat` | number | Southwest bounding box latitude | | `event.routes[].sw_lng` | number | Southwest bounding box longitude | | `event.routes[].ne_lat` | number | Northeast bounding box latitude | | `event.routes[].ne_lng` | number | Northeast bounding box longitude | | `event.routes[].track_type` | string or null | | | `event.routes[].terrain` | string or null | | | `event.routes[].difficulty` | string or null | | | `event.routes[].unpaved_pct` | number or null | | | `event.routes[].surface` | string or null | | | `event.routes[].archived` | boolean or null | null for non owned routes | | `event.routes[].created_at` | date-time | | | `event.routes[].updated_at` | date-time | | | `event.photos` | array of objects | | | `event.photos[].id` | integer | | | `event.photos[].url` | string | | | `event.photos[].highlighted` | boolean | | | `event.photos[].caption` | string or null | | | `event.photos[].lat` | number or null | | | `event.photos[].lng` | number or null | | | `event.photos[].elevation` | integer or null | | | `event.photos[].location` | string or null | | | `event.photos[].locality` | string or null | | | `event.photos[].administrative_area` | string or null | | | `event.photos[].country_code` | string or null | | | `event.photos[].created_at` | date-time | | | `event.participants` | array of objects | Event participants. Only included for the event owner. | | `event.participants[].user` | object | | | `event.participants[].user.id` | integer | | | `event.participants[].user.name` | string | | | `event.participants[].user.email` | string or null | Null for accounts without a real email address. | | `event.participants[].user.created_at` | date-time | | | `event.participants[].user.updated_at` | date-time | | | `event.participants[].status` | string | `participant` (going), `interested`, `declined` (not going), or `disallowed` (removed by an organizer, or expired). A `disallowed` rider can neither RSVP again nor withdraw. One of: `participant`, `interested`, `declined`, `disallowed`. | | `event.participants[].created_at` | date-time | | | `event.participants[].updated_at` | date-time | | #### Errors - `401` Unauthorized - `422` Validation error #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -H "Content-Type: application/json" \ -d '{ "event": { "name": "Portland Century", "description": "A 100 mile ride around Portland", "visibility": "public", "location": "Portland, OR", "lat": 45.521529, "lng": -122.691804, "time_zone": "America/Los_Angeles", "start_date": "2000-01-01", "start_time": "09:00", "end_date": "2000-01-01", "end_time": "15:00", "archived": false, "route_ids": [ 1 ], "organizer_ids": [ 1 ] } }' \ https://ridewithgps.com/api/v1/events.json ``` #### Example response ```json { "event": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/events/123.json", "html_url": "https://ridewithgps.com/events/123", "visibility": "public", "name": "Portland Century", "description": "A 100 mile ride around Portland", "logo_url": "https://ridewithgps.com/files/logo.jpg", "banner_url": "https://ridewithgps.com/files/banner.jpg", "location": "Portland, OR", "lat": 45.521529, "lng": -122.691804, "time_zone": "America/Los_Angeles", "start_date": "2000-01-01", "start_time": "09:00", "end_date": "2000-01-01", "end_time": "15:00", "all_day": false, "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "tags": [ "Tags" ], "organizers": [ { "id": 123, "name": "Alex Rider", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "routes": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/routes/123.json", "html_url": "https://ridewithgps.com/routes/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "distance": 40237, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "unpaved_pct": 12, "surface": "mostly_paved", "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "photos": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "highlighted": false, "caption": "View from Pittock Mansion", "lat": 45.521529, "lng": -122.691804, "elevation": 290, "location": "Pittock Mansion", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "created_at": "2000-01-01T12:00:00Z" } ], "participants": [ { "user": { "id": 123, "name": "Alex Rider", "email": "alex@example.com", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" }, "status": "participant", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } } ``` ### Updates the specified event `PUT /api/v1/events/{id}.json` Updates an existing event owned by the authenticated user. **Note**: The `organizer_ids`, `logo`, and `banner` fields are supported only for organization-owned events. They are not supported for user-owned events. **Multipart uploads**: To upload logo and banner images, send a request with `Content-Type: multipart/form-data` using the following fields: - `event[name]` - Event name - `event[description]` - Event description - `event[logo]` - Logo image (binary) - `event[banner]` - Banner image (binary) - etc. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | | #### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `event` | object | yes | | | `event.name` | string | no | | | `event.description` | string or null | no | | | `event.visibility` | string | no | | | `event.location` | string | no | | | `event.lat` | number | no | Latitude | | `event.lng` | number | no | Longitude | | `event.time_zone` | string or null | no | | | `event.start_date` | string | no | | | `event.start_time` | string | no | | | `event.end_date` | string | no | | | `event.end_time` | string | no | | | `event.logo` | file or null | no | | | `event.banner` | file or null | no | | | `event.archived` | boolean | no | Archives or unarchives the event. Archived events are left out of `GET /api/v1/events.json` unless it is called with `archived=true`, but they stay reachable by id. Archiving does not remove the event from public event search on ridewithgps.com. Archiving an already archived event leaves its original archive date untouched. | | `event.route_ids` | array of integers | no | Routes attached to the event, in display order. This replaces the current set: routes already on the event but missing from the array are detached, and an empty array detaches all of them. Omit the field to leave the event's routes untouched. Only routes owned by the event owner can be attached. For organization-owned events the owner is the organization account, not the manager making the request. Ids that fail this check are ignored without an error. On a personal (not organization-owned) ride planned in the Ride with GPS mobile app, whose routes can belong to other riders, a new id that fails it, or the id of a deleted route, instead leaves all of the event's routes unchanged, still without an error. | | `event.organizer_ids` | array of integers | no | User ids of the event organizers. Organization-owned events only: the field is accepted and stored for user-owned events, but those events never return an `organizers` array, so it has no visible effect. This replaces the current set: ids already on the event but missing from the array are dropped, and an empty array clears all of them. Omit the field to leave the event's organizers untouched. The `organizers` array in the response is filtered to users who are active members of the organization, so an id that does not match one is stored but never returned. Unlike `route_ids`, this array carries no display order. | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `event` | object | | | `event.id` | integer | | | `event.user_id` | integer | | | `event.url` | string | | | `event.html_url` | string | | | `event.visibility` | string | | | `event.name` | string | | | `event.description` | string or null | | | `event.logo_url` | string or null | | | `event.banner_url` | string or null | | | `event.location` | string or null | | | `event.lat` | number or null | Latitude | | `event.lng` | number or null | Longitude | | `event.time_zone` | string | | | `event.start_date` | string | | | `event.start_time` | string | | | `event.end_date` | string | | | `event.end_time` | string | | | `event.all_day` | boolean | | | `event.archived` | boolean | | | `event.created_at` | date-time | | | `event.updated_at` | date-time | | | `event.tags` | array of strings | Tags. Only present on club-owned events. | | `event.organizers` | array of objects | Event organizers. Only present on organization-owned events, and limited to organizers who are still active members of the organization. | | `event.organizers[].id` | integer | | | `event.organizers[].name` | string | | | `event.organizers[].created_at` | date-time | | | `event.organizers[].updated_at` | date-time | | | `event.routes` | array of objects | | | `event.routes[].id` | integer | | | `event.routes[].user_id` | integer | | | `event.routes[].url` | string | | | `event.routes[].html_url` | string | | | `event.routes[].visibility` | string | | | `event.routes[].name` | string | | | `event.routes[].description` | string or null | | | `event.routes[].locality` | string or null | | | `event.routes[].administrative_area` | string or null | | | `event.routes[].country_code` | string or null | | | `event.routes[].distance` | number | Distance in meters | | `event.routes[].elevation_gain` | number | Elevation gain in meters | | `event.routes[].elevation_loss` | number | Elevation loss in meters | | `event.routes[].first_lat` | number | | | `event.routes[].first_lng` | number | | | `event.routes[].last_lat` | number | | | `event.routes[].last_lng` | number | | | `event.routes[].sw_lat` | number | Southwest bounding box latitude | | `event.routes[].sw_lng` | number | Southwest bounding box longitude | | `event.routes[].ne_lat` | number | Northeast bounding box latitude | | `event.routes[].ne_lng` | number | Northeast bounding box longitude | | `event.routes[].track_type` | string or null | | | `event.routes[].terrain` | string or null | | | `event.routes[].difficulty` | string or null | | | `event.routes[].unpaved_pct` | number or null | | | `event.routes[].surface` | string or null | | | `event.routes[].archived` | boolean or null | null for non owned routes | | `event.routes[].created_at` | date-time | | | `event.routes[].updated_at` | date-time | | | `event.photos` | array of objects | | | `event.photos[].id` | integer | | | `event.photos[].url` | string | | | `event.photos[].highlighted` | boolean | | | `event.photos[].caption` | string or null | | | `event.photos[].lat` | number or null | | | `event.photos[].lng` | number or null | | | `event.photos[].elevation` | integer or null | | | `event.photos[].location` | string or null | | | `event.photos[].locality` | string or null | | | `event.photos[].administrative_area` | string or null | | | `event.photos[].country_code` | string or null | | | `event.photos[].created_at` | date-time | | | `event.participants` | array of objects | Event participants. Only included for the event owner. | | `event.participants[].user` | object | | | `event.participants[].user.id` | integer | | | `event.participants[].user.name` | string | | | `event.participants[].user.email` | string or null | Null for accounts without a real email address. | | `event.participants[].user.created_at` | date-time | | | `event.participants[].user.updated_at` | date-time | | | `event.participants[].status` | string | `participant` (going), `interested`, `declined` (not going), or `disallowed` (removed by an organizer, or expired). A `disallowed` rider can neither RSVP again nor withdraw. One of: `participant`, `interested`, `declined`, `disallowed`. | | `event.participants[].created_at` | date-time | | | `event.participants[].updated_at` | date-time | | #### Errors - `401` Unauthorized - `404` Event not found #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X PUT \ -H "Content-Type: application/json" \ -d '{ "event": { "name": "Portland Century", "description": "A 100 mile ride around Portland", "visibility": "public", "location": "Portland, OR", "lat": 45.521529, "lng": -122.691804, "time_zone": "America/Los_Angeles", "start_date": "2000-01-01", "start_time": "09:00", "end_date": "2000-01-01", "end_time": "15:00", "archived": false, "route_ids": [ 1 ], "organizer_ids": [ 1 ] } }' \ https://ridewithgps.com/api/v1/events/123.json ``` #### Example response ```json { "event": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/events/123.json", "html_url": "https://ridewithgps.com/events/123", "visibility": "public", "name": "Portland Century", "description": "A 100 mile ride around Portland", "logo_url": "https://ridewithgps.com/files/logo.jpg", "banner_url": "https://ridewithgps.com/files/banner.jpg", "location": "Portland, OR", "lat": 45.521529, "lng": -122.691804, "time_zone": "America/Los_Angeles", "start_date": "2000-01-01", "start_time": "09:00", "end_date": "2000-01-01", "end_time": "15:00", "all_day": false, "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "tags": [ "Tags" ], "organizers": [ { "id": 123, "name": "Alex Rider", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "routes": [ { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/routes/123.json", "html_url": "https://ridewithgps.com/routes/123", "visibility": "public", "name": "Forest Park loop", "description": "Morning ride through Forest Park", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "distance": 40237, "elevation_gain": 457, "elevation_loss": 461, "first_lat": 45.521529, "first_lng": -122.691804, "last_lat": 45.521529, "last_lng": -122.691804, "sw_lat": 45.432536, "sw_lng": -122.836749, "ne_lat": 45.652881, "ne_lng": -122.471777, "track_type": "loop", "terrain": "rolling", "difficulty": "moderate", "unpaved_pct": 12, "surface": "mostly_paved", "archived": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "photos": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "highlighted": false, "caption": "View from Pittock Mansion", "lat": 45.521529, "lng": -122.691804, "elevation": 290, "location": "Pittock Mansion", "locality": "Portland", "administrative_area": "OR", "country_code": "US", "created_at": "2000-01-01T12:00:00Z" } ], "participants": [ { "user": { "id": 123, "name": "Alex Rider", "email": "alex@example.com", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" }, "status": "participant", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } } ``` ### Deletes the specified event `DELETE /api/v1/events/{id}.json` Deletes an event owned by the authenticated user #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | | #### Response `204` Event deleted successfully #### Errors - `401` Unauthorized - `404` Event not found #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X DELETE \ https://ridewithgps.com/api/v1/events/123.json ``` ## Event Participants ### Returns the authenticated user's RSVP to the event `GET /api/v1/events/{event_id}/participant.json` Returns the authenticated user's RSVP, or `null` for `participant` when they have none. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `event_id` | integer | path | yes | Event ID | | `privacy_code` | string | query | no | Privacy code for the non public asset | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `participant` | object | | | `participant.user` | object | | | `participant.user.id` | integer | | | `participant.user.name` | string | | | `participant.user.email` | string or null | Null for accounts without a real email address. | | `participant.user.created_at` | date-time | | | `participant.user.updated_at` | date-time | | | `participant.status` | string | `participant` (going), `interested`, `declined` (not going), or `disallowed` (removed by an organizer, or expired). A `disallowed` rider can neither RSVP again nor withdraw. One of: `participant`, `interested`, `declined`, `disallowed`. | | `participant.created_at` | date-time | | | `participant.updated_at` | date-time | | #### Errors - `401` Unauthorized - `403` Forbidden - Event not visible to user, or an organization account - `404` Not Found - Event not found #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/events/123/participant.json ``` #### Example response ```json { "participant": { "user": { "id": 123, "name": "Alex Rider", "email": "alex@example.com", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" }, "status": "participant", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ### Sets the authenticated user's RSVP to the event `POST /api/v1/events/{event_id}/participant.json` RSVPs to the event as the authenticated user, with `participant.status`: `participant` (going, the default), `interested`, or `declined` (not going). Sending the same status again changes nothing. Organization accounts can't RSVP, so an integration acting for a rider uses that rider's own token. An event whose organization requires its own waiver answers `participant` with a 422 and a `waiver_url` until the rider has signed it. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `event_id` | integer | path | yes | Event ID | | `privacy_code` | string | query | no | Privacy code for the non public asset | #### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `participant` | object | no | | | `participant.status` | string | no | One of: `participant`, `interested`, `declined`. | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `participant` | object | | | `participant.user` | object | | | `participant.user.id` | integer | | | `participant.user.name` | string | | | `participant.user.email` | string or null | Null for accounts without a real email address. | | `participant.user.created_at` | date-time | | | `participant.user.updated_at` | date-time | | | `participant.status` | string | `participant` (going), `interested`, `declined` (not going), or `disallowed` (removed by an organizer, or expired). A `disallowed` rider can neither RSVP again nor withdraw. One of: `participant`, `interested`, `declined`, `disallowed`. | | `participant.created_at` | date-time | | | `participant.updated_at` | date-time | | #### Errors - `400` Malformed body: participant is not an object, or status is not a string - `401` Unauthorized - `403` Forbidden - Event not visible to user, an organization account, an RSVP removed by the organizer or expired, or a planned ride that refuses the rider - `404` Not Found - Event not found - `422` Invalid status, or a waiver to sign first #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -H "Content-Type: application/json" \ -d '{ "participant": { "status": "participant" } }' \ https://ridewithgps.com/api/v1/events/123/participant.json ``` #### Example response ```json { "participant": { "user": { "id": 123, "name": "Alex Rider", "email": "alex@example.com", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" }, "status": "participant", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ### Withdraws the authenticated user's RSVP to the event `DELETE /api/v1/events/{event_id}/participant.json` Removes the authenticated user from the event's participants, so they can RSVP again later. It works even if the user can no longer see the event, but not for an RSVP the organizer removed or that expired (`disallowed`, 403). #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `event_id` | integer | path | yes | Event ID | #### Response `204` RSVP withdrawn #### Errors - `401` Unauthorized - `403` Forbidden - An RSVP removed by the organizer or expired, or an organization account - `404` Not Found - Event not found #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X DELETE \ https://ridewithgps.com/api/v1/events/123/participant.json ``` --- # Sync Source: https://ridewithgps.com/api/v1/doc/endpoints/sync.md OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_sync.yaml ## Returns items for sync `GET /api/v1/sync.json` Returns a list of items (routes and/or trips) that the user has interacted with since the given datetime. The sync endpoint is convenient to maintain a remote copy of a user's library of trips and/or routes. ### Actions Items can have the following actions: * `created` - The user created the item * `updated` - The user updated the item * `deleted` - The user deleted the item * `added` - The user added the item to the specified collection (e.g., pinned) * `removed` - The user removed the item from the specified collection For `added` and `removed` actions, `collection` is the target collection where the action was taken. It is currently always the collection of pinned items for the authenticated user, but we might expose other collections in the future. ### Sync Workflow This endpoint is optimized for performance (we use a similar setup for syncing our own mobile apps), and can return the entire library for the user by using a `since` value well in the past (for example `1970-01-01`). The following workflow is suitable to maintain your copy of a user's library: 1. When the user finalizes the OAuth workflow, get the current content of their library at `GET https://ridewithgps.com/api/v1/sync.json?since=1970-01-01` 2. Download and integrate in your system every item in the response and store the value of the `meta.rwgps_datetime` key in the response 3. Upon reception of a webhook for the user, get and integrate the items that have changed from a new sync request at `GET https://ridewithgps.com/api/v1/sync.json?since=[rwgps_datetime]`. Store the new value of `meta.rwgps_datetime` for the next sync request. Doing a sync request on webhook reception instead of processing the items in the body of the webhook leads to the same result and provides a recovery mechanism for previous webhooks that might have failed because of network or systems availability issues. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `since` | string | query | yes | ISO 8601 datetime string for last sync. Use 1970-01-01 for initial sync to get entire library. | | `assets` | string | query | no | Comma-separated list of asset types to return (routes, trips). Defaults to your API client setting. One of: `routes`, `trips`, `routes,trips`. | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `items` | array of objects | Array of sync items representing changes since the specified datetime | | `items[].item_type` | string | Type of item. One of: `route`, `trip`. | | `items[].item_id` | integer | ID of the item | | `items[].item_user_id` | integer | ID of the user who owns the item. It will be the ID of the authenticated user for created, updated and deleted actions. It might point to another user for added and removed actions, when the authenticated user pins an item from another user. | | `items[].item_url` | string | API URL for the item | | `items[].action` | string | Action performed on the item. One of: `created`, `updated`, `deleted`, `added`, `removed`. | | `items[].datetime` | string | When the action occurred | | `items[].collection` | object or null | Collection context for added/removed actions (null for other actions) | | `items[].collection.id` | integer | | | `items[].collection.type` | string | | | `items[].collection.name` | string | | | `items[].collection.url` | string | | | `meta` | object | | | `meta.rwgps_datetime` | string | Current server timestamp - use this value for the next sync request | | `meta.next_sync_url` | string | Pre-formatted URL for the next sync request with proper datetime | ### Errors - `401` Unauthorized ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/sync.json ``` ### Example response ```json { "items": [ { "item_type": "route", "item_id": 123, "item_user_id": 123, "item_url": "https://ridewithgps.com/api/v1/routes/123.json", "action": "created", "datetime": "2000-01-01T11:45:00+00:00", "collection": { "id": 123, "type": "pinned", "name": "Pinned", "url": "https://ridewithgps.com/api/v1/collections/123.json" } } ], "meta": { "rwgps_datetime": "2000-01-01T12:00:00+00:00", "next_sync_url": "https://ridewithgps.com/api/v1/sync.json?assets=routes%2Ctrips&since=2000-01-01T12%3A00%3A00%2B00%3A00" } } ``` --- # Users Source: https://ridewithgps.com/api/v1/doc/endpoints/users.md OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_users.yaml ## Returns the current user `GET /api/v1/users/current.json` Returns information about the currently authenticated user ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `user` | object | | | `user.id` | integer | | | `user.name` | string | | | `user.created_at` | date-time | | | `user.updated_at` | date-time | | ### Errors - `401` Unauthorized ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/users/current.json ``` ### Example response ```json { "user": { "id": 123, "name": "Alex Rider", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` --- # Authentication tokens Source: https://ridewithgps.com/api/v1/doc/endpoints/authentication_tokens.md See [Authentication](https://ridewithgps.com/api/v1/doc/authentication.md) for when to use tokens. If you use an organization account, see [Authentication for organizations](https://ridewithgps.com/api/v1/doc/organizations/authentication.md) instead. OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_authentication_tokens.yaml ## Creates an authentication token `POST /api/v1/auth_tokens.json` Creates a new authentication token for API access using user credentials. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | ### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `user` | object | yes | | | `user.email` | string | yes | User email address | | `user.password` | string | yes | User password | ### Response `201` | Name | Type | Description | | --- | --- | --- | | `auth_token` | object | | | `auth_token.auth_token` | string | | | `auth_token.api_key` | string | | | `auth_token.created_at` | date-time | | | `auth_token.updated_at` | date-time | | | `auth_token.user` | object | | | `auth_token.user.id` | integer | | | `auth_token.user.first_name` | string | | | `auth_token.user.last_name` | string | | | `auth_token.user.display_name` | string | | | `auth_token.user.email` | string | | | `auth_token.user.created_at` | date-time | | | `auth_token.user.updated_at` | date-time | | ### Errors - `400` Bad request - invalid parameters - `401` Unauthorized - invalid credentials or API key ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -X POST \ -H "Content-Type: application/json" \ -d '{ "user": { "email": "alex@example.com", "password": "{password}" } }' \ https://ridewithgps.com/api/v1/auth_tokens.json ``` ### Example response ```json { "auth_token": { "auth_token": "c0cc78875f250604f9abac97712e314c", "api_key": "2704a8df", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "user": { "id": 123, "first_name": "Alex", "last_name": "Rider", "display_name": "Alex Rider", "email": "alex@example.com", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } } ``` --- # Tasks Source: https://ridewithgps.com/api/v1/doc/endpoints/tasks.md Route and trip uploads, and experience publishing, run in the background. They return a task: poll its `url` until `status` is `completed`, then read its `items` and `errors`. OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_tasks.yaml ## Returns the specified task `GET /api/v1/tasks/{id}.json` Returns the current state of an asynchronous task owned by the authenticated user. Uploads are processed in the background. The upload endpoints return a task, and its `id` is polled here until `status` becomes `completed`. A completed task reports its outcome through two arrays: - `items` lists the assets that were created, each with an `item_type`, `item_id` and `item_url` - `errors` lists anything that went wrong, each with a machine readable `code` Both arrays are always present. An upload that succeeded entirely has an empty `errors` array, and one that created nothing has an empty `items` array. When an archive is uploaded, entries are processed independently, so a task can report both created assets and errors for the entries that failed. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Task ID | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `task` | object | | | `task.id` | integer | | | `task.user_id` | integer | | | `task.url` | string | API url of the task, to poll until it completes | | `task.type` | string | What kind of work the task performs. `gps_file_upload` for uploads, `experience_package` for experience packages | | `task.status` | string | `pending` until the task has run, then `completed` | | `task.created_at` | date-time | | | `task.updated_at` | date-time | | | `task.items` | array of objects | Assets created by the task. Empty while pending, and empty if nothing was created. A file holding several tracks creates one asset per track | | `task.items[].item_type` | string | Type of the created asset: `route` or `trip` for uploads, `experience_package` for experience packages | | `task.items[].item_id` | integer | | | `task.items[].item_url` | string or null | API url of the created asset | | `task.errors` | array of objects | Anything that went wrong, one entry per track that could not be imported. Empty when the task succeeded entirely | | `task.errors[].code` | string | Machine readable reason. One of `duplicate`, `time_data_missing`, `no_tracks`, `empty_file`, `parse_failed`, `failed_to_process`, `weigh_in_failed`, `build_failed`, `error` | | `task.errors[].message` | string | Human readable description, always in English | | `task.errors[].item_type` | string or null | Set when the error refers to an existing asset, as for a duplicate | | `task.errors[].item_id` | integer or null | | | `task.errors[].item_url` | string or null | | ### Errors - `401` Unauthorized - `404` Task not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/tasks/123.json ``` ### Example response ```json { "task": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/tasks/123.json", "type": "gps_file_upload", "status": "completed", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "items": [ { "item_type": "route", "item_id": 123, "item_url": "https://ridewithgps.com/api/v1/routes/123.json" } ], "errors": [ { "code": "duplicate", "message": "This route already exists", "item_type": "route", "item_id": 123, "item_url": "https://ridewithgps.com/api/v1/routes/123.json" } ] } } ``` --- # Organizations Source: https://ridewithgps.com/api/v1/doc/organizations/overview.md You need an organization account to use the pages in this section. Other accounts get a `403`. ## Where to start 1. Read [Authentication](https://ridewithgps.com/api/v1/doc/organizations/authentication.md) to create an API key and a token for your organization. 2. Follow [Publish a multi-day tour](https://ridewithgps.com/api/v1/doc/organizations/publish_tours.md) to put a tour on Ride with GPS for your guests. ## What only organizations can do * [Experiences](https://ridewithgps.com/api/v1/doc/organizations/experiences.md): publish tours and guides, with their routes, day-by-day pages, codes for guests and messages. Your organization needs access to Experiences. * [Points of interest](https://ridewithgps.com/api/v1/doc/organizations/points_of_interest.md): manage your organization's points of interest and attach them to its routes. * [Club members](https://ridewithgps.com/api/v1/doc/organizations/club_members.md): list, invite, update and remove your organization's members. ## What works for all accounts Your organization's routes, trips, photos, collections, events and sync work the same as for any account: * [Routes](https://ridewithgps.com/api/v1/doc/endpoints/routes.md), [Trips](https://ridewithgps.com/api/v1/doc/endpoints/trips.md), [Photos](https://ridewithgps.com/api/v1/doc/endpoints/photos.md), [Collections](https://ridewithgps.com/api/v1/doc/endpoints/collections.md), [Events](https://ridewithgps.com/api/v1/doc/endpoints/events.md), [Sync](https://ridewithgps.com/api/v1/doc/endpoints/sync.md). * [Responses and errors](https://ridewithgps.com/api/v1/doc/responses.md): response format, pagination and errors. * [Webhooks](https://ridewithgps.com/api/v1/doc/webhooks.md): get notified when your routes, trips, events, their RSVPs or your members change. * Reference: [Visibilities](https://ridewithgps.com/api/v1/doc/reference/visibilities.md), [Activity types](https://ridewithgps.com/api/v1/doc/reference/activity_types.md), [Time zones](https://ridewithgps.com/api/v1/doc/reference/time_zones.md). --- # Authentication for organizations Source: https://ridewithgps.com/api/v1/doc/organizations/authentication.md You authenticate with Basic authentication, using an API key and an authentication token. Your organization's account has no password, so you sign in to it and create the token on the API clients page. You cannot use the [authentication tokens endpoint](https://ridewithgps.com/api/v1/doc/endpoints/authentication_tokens.md): it needs a password. ## 1. Create an API key and a token You need to be an **administrator** of the organization. 1. Sign in to the organization. 2. Go to the [API clients management page](https://ridewithgps.com/api/api_clients). 3. Create a new API client if you do not have one. Its page shows its API key (`api_key`). 4. Edit the API client and click the "Create new Auth Token" button. The page then shows your authentication token (`auth_token`). Keep it secret: it gives full access to your organization's account. ## 2. Make authenticated requests Send the API key and the token with Basic authentication: ``` // header Authorization: Basic base64encode("{api_key}:{auth_token}") ``` With `curl`, pass `-u "$API_KEY:$AUTH_TOKEN"`. Alternatively, send them as headers: ``` // headers x-rwgps-api-key: {api_key} x-rwgps-auth-token: {auth_token} ``` If your credentials are missing or wrong, you get a `401`. See [Responses and errors](https://ridewithgps.com/api/v1/doc/responses.md). --- # Club members Source: https://ridewithgps.com/api/v1/doc/organizations/club_members.md **Organizations only.** List, invite, update and remove your organization's members. If your organization collects membership dues through Ride with GPS, a membership decides who has access: an update that would give access to a member no membership covers is rejected with a `422` and `"error_code": "membership_required"`. Other changes, roles included, still go through. OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_club_members.yaml ## Returns a list of club members `GET /api/v1/members.json` Returns a paginated list of members for the authenticated organization account. This endpoint is only available to organization accounts. Supports filtering by `name` and `email`. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `page` | integer | query | no | Page number for pagination | | `page_size` | integer | query | no | Number of items per page (20-200) | | `name` | string | query | no | Filter by name (partial match) | | `email` | string | query | no | Filter by email (partial match) | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `members` | array of objects | | | `members[].id` | integer | | | `members[].url` | string | | | `members[].active` | boolean | | | `members[].admin` | boolean | | | `members[].manages_routes` | boolean | | | `members[].manages_members` | boolean | | | `members[].manages_billing` | boolean | | | `members[].approved_at` | date-time or null | | | `members[].created_at` | date-time | | | `members[].updated_at` | date-time | | | `members[].invited` | boolean | True while the member has been invited by email but has not yet claimed the invitation. Invited members have no `user`. | | `members[].first_name` | string or null | The organization's own record of the member's first name, set when the member was invited. The `user` object is authoritative once the invitation is claimed. | | `members[].last_name` | string or null | | | `members[].email` | string or null | The organization's record of the address, falling back to the account's own when it has none. | | `members[].invitation` | object or null | Present only for invited members. | | `members[].invitation.invite_url` | string | Claim link. Send this to the invitee if you deliver the invitation yourself. | | `members[].invitation.last_sent_at` | date-time or null | | | `members[].invitation.send_count` | integer | | | `members[].user` | object | | | `members[].user.id` | integer | | | `members[].user.first_name` | string | | | `members[].user.last_name` | string | | | `members[].user.display_name` | string | | | `members[].user.email` | string | | | `members[].user.created_at` | date-time | | | `members[].user.updated_at` | date-time | | | `meta` | object | | | `meta.pagination` | object | | | `meta.pagination.record_count` | integer | Total number of records | | `meta.pagination.page_count` | integer | Total number of pages | | `meta.pagination.page_size` | integer | Number of records per page | | `meta.pagination.next_page_url` | string or null | URL for the next page (null if last page) | ### Errors - `401` Unauthorized - `403` Forbidden - Not an organization account ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/members.json ``` ### Example response ```json { "members": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/members/123.json", "active": false, "admin": false, "manages_routes": false, "manages_members": false, "manages_billing": false, "approved_at": "2000-01-01T12:00:00Z", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "invited": false, "first_name": "Alex", "last_name": "Rider", "email": "alex@example.com", "invitation": { "invite_url": "https://ridewithgps.com/auto_approve/Club/123?invite=8f3c2a9d", "last_sent_at": "2000-01-01T12:00:00Z", "send_count": 1 }, "user": { "id": 123, "first_name": "Alex", "last_name": "Rider", "display_name": "Alex Rider", "email": "alex@example.com", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ], "meta": { "pagination": { "record_count": 45, "page_count": 3, "page_size": 20, "next_page_url": "https://ridewithgps.com/api/v1/members.json?page=2" } } } ``` ## Returns the specified club member `GET /api/v1/members/{id}.json` Returns detailed information about a specific club member ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Club Member ID | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `member` | object | | | `member.id` | integer | | | `member.url` | string | | | `member.active` | boolean | | | `member.admin` | boolean | | | `member.manages_routes` | boolean | | | `member.manages_members` | boolean | | | `member.manages_billing` | boolean | | | `member.approved_at` | date-time or null | | | `member.created_at` | date-time | | | `member.updated_at` | date-time | | | `member.invited` | boolean | True while the member has been invited by email but has not yet claimed the invitation. Invited members have no `user`. | | `member.first_name` | string or null | The organization's own record of the member's first name, set when the member was invited. The `user` object is authoritative once the invitation is claimed. | | `member.last_name` | string or null | | | `member.email` | string or null | The organization's record of the address, falling back to the account's own when it has none. | | `member.invitation` | object or null | Present only for invited members. | | `member.invitation.invite_url` | string | Claim link. Send this to the invitee if you deliver the invitation yourself. | | `member.invitation.last_sent_at` | date-time or null | | | `member.invitation.send_count` | integer | | | `member.user` | object | | | `member.user.id` | integer | | | `member.user.first_name` | string | | | `member.user.last_name` | string | | | `member.user.display_name` | string | | | `member.user.email` | string | | | `member.user.created_at` | date-time | | | `member.user.updated_at` | date-time | | ### Errors - `401` Unauthorized - `404` Member not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/members/123.json ``` ### Example response ```json { "member": { "id": 123, "url": "https://ridewithgps.com/api/v1/members/123.json", "active": false, "admin": false, "manages_routes": false, "manages_members": false, "manages_billing": false, "approved_at": "2000-01-01T12:00:00Z", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "invited": false, "first_name": "Alex", "last_name": "Rider", "email": "alex@example.com", "invitation": { "invite_url": "https://ridewithgps.com/auto_approve/Club/123?invite=8f3c2a9d", "last_sent_at": "2000-01-01T12:00:00Z", "send_count": 1 }, "user": { "id": 123, "first_name": "Alex", "last_name": "Rider", "display_name": "Alex Rider", "email": "alex@example.com", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } } ``` ## Invites a new member to the organization `POST /api/v1/members.json` Invites someone to the organization by email. This creates a member record with no associated user account and an invitation token. The invitee becomes a full member only once they follow the invitation link and claim it with a Ride with GPS account — an organization cannot attach someone else's account to itself. Set the top-level `send_invite` to true to have us email the invitation. It sits alongside `member` rather than inside it, being a request option rather than a member attribute. Otherwise no mail is sent and you can deliver `invitation.invite_url` yourself. Manager permissions may be granted up front, but `admin` may not — an unclaimed invitation cannot hold admin. Grant it with `PUT` once claimed. This endpoint is only available to organization accounts. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `member` | object | yes | | | `member.email` | string | yes | Email address to invite | | `member.first_name` | string | no | | | `member.last_name` | string | no | | | `member.manages_routes` | boolean | no | | | `member.manages_members` | boolean | no | | | `member.manages_billing` | boolean | no | | | `send_invite` | boolean | no | Email the invitation to the address above. Not a member attribute, so it sits alongside `member` rather than inside it. | ### Response `201` | Name | Type | Description | | --- | --- | --- | | `member` | object | | | `member.id` | integer | | | `member.url` | string | | | `member.active` | boolean | | | `member.admin` | boolean | | | `member.manages_routes` | boolean | | | `member.manages_members` | boolean | | | `member.manages_billing` | boolean | | | `member.approved_at` | date-time or null | | | `member.created_at` | date-time | | | `member.updated_at` | date-time | | | `member.invited` | boolean | True while the member has been invited by email but has not yet claimed the invitation. Invited members have no `user`. | | `member.first_name` | string or null | The organization's own record of the member's first name, set when the member was invited. The `user` object is authoritative once the invitation is claimed. | | `member.last_name` | string or null | | | `member.email` | string or null | The organization's record of the address, falling back to the account's own when it has none. | | `member.invitation` | object or null | Present only for invited members. | | `member.invitation.invite_url` | string | Claim link. Send this to the invitee if you deliver the invitation yourself. | | `member.invitation.last_sent_at` | date-time or null | | | `member.invitation.send_count` | integer | | | `member.user` | object | | | `member.user.id` | integer | | | `member.user.first_name` | string | | | `member.user.last_name` | string | | | `member.user.display_name` | string | | | `member.user.email` | string | | | `member.user.created_at` | date-time | | | `member.user.updated_at` | date-time | | ### Errors - `401` Unauthorized - `403` Forbidden - Not an organization account - `422` Invalid or duplicate email ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -H "Content-Type: application/json" \ -d '{ "member": { "email": "alex@example.com", "first_name": "Alex", "last_name": "Rider", "manages_routes": false, "manages_members": false, "manages_billing": false }, "send_invite": false }' \ https://ridewithgps.com/api/v1/members.json ``` ### Example response ```json { "member": { "id": 123, "url": "https://ridewithgps.com/api/v1/members/123.json", "active": false, "admin": false, "manages_routes": false, "manages_members": false, "manages_billing": false, "approved_at": "2000-01-01T12:00:00Z", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "invited": false, "first_name": "Alex", "last_name": "Rider", "email": "alex@example.com", "invitation": { "invite_url": "https://ridewithgps.com/auto_approve/Club/123?invite=8f3c2a9d", "last_sent_at": "2000-01-01T12:00:00Z", "send_count": 1 }, "user": { "id": 123, "first_name": "Alex", "last_name": "Rider", "display_name": "Alex Rider", "email": "alex@example.com", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } } ``` ## Updates the specified club member `PUT /api/v1/members/{id}.json` Updates a club member's details, permissions and status. Available attributes: - `first_name`, `last_name`, `email`: the organization's own record of the person. On a member who has not yet claimed their invitation, changing `email` moves the pending invitation to the new address. - `active`: Whether the member is active - `admin`: Whether the member is an admin (grants all permissions). Rejected for a member who has not claimed their invitation, and an organization must keep at least one admin, so demoting its last one is rejected too. - `manages_routes`: Permission to manage routes - `manages_members`: Permission to manage members - `manages_billing`: Permission to manage billing On an organization that collects membership dues through Ride with GPS, a membership decides who has access. A request that would give access to a member no membership covers (making them active, approving them or making them an admin) is rejected with a `422` and `"error_code": "membership_required"`. Every other attribute, roles included, can still be changed. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Club Member ID | ### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `member` | object | no | | | `member.first_name` | string | no | | | `member.last_name` | string | no | | | `member.email` | string | no | | | `member.active` | boolean | no | | | `member.admin` | boolean | no | | | `member.manages_routes` | boolean | no | | | `member.manages_members` | boolean | no | | | `member.manages_billing` | boolean | no | | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `member` | object | | | `member.id` | integer | | | `member.url` | string | | | `member.active` | boolean | | | `member.admin` | boolean | | | `member.manages_routes` | boolean | | | `member.manages_members` | boolean | | | `member.manages_billing` | boolean | | | `member.approved_at` | date-time or null | | | `member.created_at` | date-time | | | `member.updated_at` | date-time | | | `member.invited` | boolean | True while the member has been invited by email but has not yet claimed the invitation. Invited members have no `user`. | | `member.first_name` | string or null | The organization's own record of the member's first name, set when the member was invited. The `user` object is authoritative once the invitation is claimed. | | `member.last_name` | string or null | | | `member.email` | string or null | The organization's record of the address, falling back to the account's own when it has none. | | `member.invitation` | object or null | Present only for invited members. | | `member.invitation.invite_url` | string | Claim link. Send this to the invitee if you deliver the invitation yourself. | | `member.invitation.last_sent_at` | date-time or null | | | `member.invitation.send_count` | integer | | | `member.user` | object | | | `member.user.id` | integer | | | `member.user.first_name` | string | | | `member.user.last_name` | string | | | `member.user.display_name` | string | | | `member.user.email` | string | | | `member.user.created_at` | date-time | | | `member.user.updated_at` | date-time | | ### Errors - `401` Unauthorized - `404` Member not found - `422` Validation error, or access no membership covers ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X PUT \ -H "Content-Type: application/json" \ -d '{ "member": { "first_name": "Alex", "last_name": "Rider", "email": "alex@example.com", "active": false, "admin": false, "manages_routes": false, "manages_members": false, "manages_billing": false } }' \ https://ridewithgps.com/api/v1/members/123.json ``` ### Example response ```json { "member": { "id": 123, "url": "https://ridewithgps.com/api/v1/members/123.json", "active": false, "admin": false, "manages_routes": false, "manages_members": false, "manages_billing": false, "approved_at": "2000-01-01T12:00:00Z", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "invited": false, "first_name": "Alex", "last_name": "Rider", "email": "alex@example.com", "invitation": { "invite_url": "https://ridewithgps.com/auto_approve/Club/123?invite=8f3c2a9d", "last_sent_at": "2000-01-01T12:00:00Z", "send_count": 1 }, "user": { "id": 123, "first_name": "Alex", "last_name": "Rider", "display_name": "Alex Rider", "email": "alex@example.com", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } } ``` ## Removes the specified member from the organization `DELETE /api/v1/members/{id}.json` Permanently removes the member from the organization, along with their member tags and any unclaimed invitation. This does not delete the person's Ride with GPS account, and they may rejoin. To suspend a member instead while keeping their record, `PUT` the member with `active: false`. An organization must keep at least one admin, so removing its last admin is rejected. This endpoint is only available to organization accounts. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | Club Member ID | ### Response `204` Member removed ### Errors - `401` Unauthorized - `404` Member not found - `422` Cannot remove the last admin ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X DELETE \ https://ridewithgps.com/api/v1/members/123.json ``` --- # Points of interest Source: https://ridewithgps.com/api/v1/doc/organizations/points_of_interest.md **Organizations only.** Manage your organization's points of interest and attach them to its routes. See also: [Points of interest](https://ridewithgps.com/api/v1/doc/reference/points_of_interest.md). OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_points_of_interest.yaml ## Returns a list of points of interest `GET /api/v1/points_of_interest.json` Returns a paginated list of points of interest for the authenticated organization. **Note**: This endpoint is available for organizations only. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `page` | integer | query | no | Page number for pagination | | `page_size` | integer | query | no | Number of items per page (20-200) | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `points_of_interest` | array of objects | | | `points_of_interest[].id` | integer | | | `points_of_interest[].user_id` | integer | | | `points_of_interest[].type` | string | | | `points_of_interest[].type_id` | integer | | | `points_of_interest[].type_name` | string | | | `points_of_interest[].name` | string | | | `points_of_interest[].description` | string or null | | | `points_of_interest[].url` | string | | | `points_of_interest[].lat` | number | | | `points_of_interest[].lng` | number | | | `meta` | object | | | `meta.pagination` | object | | | `meta.pagination.record_count` | integer | Total number of records | | `meta.pagination.page_count` | integer | Total number of pages | | `meta.pagination.page_size` | integer | Number of records per page | | `meta.pagination.next_page_url` | string or null | URL for the next page (null if last page) | ### Errors - `401` Unauthorized ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/points_of_interest.json ``` ### Example response ```json { "points_of_interest": [ { "id": 123, "user_id": 123, "type": "coffee", "type_id": 123, "type_name": "Coffee", "name": "Coffee stop", "description": "Good espresso before the climb", "url": "https://ridewithgps.com/api/v1/points_of_interest/123.json", "lat": 45.521529, "lng": -122.691804 } ], "meta": { "pagination": { "record_count": 45, "page_count": 3, "page_size": 20, "next_page_url": "https://ridewithgps.com/api/v1/points_of_interest.json?page=2" } } } ``` ## Returns the specified point of interest `GET /api/v1/points_of_interest/{id}.json` Returns detailed information about a specific point of interest. **Note**: This endpoint is available for organizations only. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `point_of_interest` | object | | | `point_of_interest.id` | integer | | | `point_of_interest.user_id` | integer | | | `point_of_interest.type` | string | | | `point_of_interest.type_id` | integer | | | `point_of_interest.type_name` | string | | | `point_of_interest.name` | string | | | `point_of_interest.description` | string or null | | | `point_of_interest.url` | string | | | `point_of_interest.lat` | number | | | `point_of_interest.lng` | number | | | `point_of_interest.distances` | array of numbers | Distances from start in meters for waypoints | | `point_of_interest.tag_names` | array of strings | | ### Errors - `401` Unauthorized - `404` Point of interest not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/points_of_interest/123.json ``` ### Example response ```json { "point_of_interest": { "id": 123, "user_id": 123, "type": "coffee", "type_id": 123, "type_name": "Coffee", "name": "Coffee stop", "description": "Good espresso before the climb", "url": "https://ridewithgps.com/api/v1/points_of_interest/123.json", "lat": 45.521529, "lng": -122.691804, "distances": [ 12487.3 ], "tag_names": [ "Tag names" ] } } ``` ## Creates a point of interest `POST /api/v1/points_of_interest.json` Create a new point of interest in the authenticated organization's library. **Note**: This endpoint is available for organizations only. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `point_of_interest` | object | yes | | | `point_of_interest.name` | string | no | | | `point_of_interest.description` | string or null | no | | | `point_of_interest.poi_type` | string | no | | | `point_of_interest.url` | string or null | no | | | `point_of_interest.lat` | number | no | Latitude | | `point_of_interest.lng` | number | no | Longitude | | `point_of_interest.tag_names` | array of strings | no | Replaces all tags. Send an empty array to remove them. | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `point_of_interest` | object | | | `point_of_interest.id` | integer | | | `point_of_interest.user_id` | integer | | | `point_of_interest.type` | string | | | `point_of_interest.type_id` | integer | | | `point_of_interest.type_name` | string | | | `point_of_interest.name` | string | | | `point_of_interest.description` | string or null | | | `point_of_interest.url` | string | | | `point_of_interest.lat` | number | | | `point_of_interest.lng` | number | | ### Errors - `401` Unauthorized ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -H "Content-Type: application/json" \ -d '{ "point_of_interest": { "name": "Coffee stop", "description": "Good espresso before the climb", "poi_type": "coffee", "url": "https://example.com", "lat": 45.521529, "lng": -122.691804, "tag_names": [ "Tag names" ] } }' \ https://ridewithgps.com/api/v1/points_of_interest.json ``` ### Example response ```json { "point_of_interest": { "id": 123, "user_id": 123, "type": "coffee", "type_id": 123, "type_name": "Coffee", "name": "Coffee stop", "description": "Good espresso before the climb", "url": "https://ridewithgps.com/api/v1/points_of_interest/123.json", "lat": 45.521529, "lng": -122.691804 } } ``` ## Associates a point of interest with a route `POST /api/v1/points_of_interest/{id}/routes/{route_id}.json` Associates a point of interest with a specific route **Note**: This endpoint is available for organizations only. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | | | `route_id` | integer | path | yes | | ### Errors - `404` POI or route not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ https://ridewithgps.com/api/v1/points_of_interest/123/routes/123.json ``` ## Updates the specified point of interest `PUT /api/v1/points_of_interest/{id}.json` Updates an existing point of interest in the authenticated organization's library. **Note**: This endpoint is available for organizations only. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | | ### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `point_of_interest` | object | yes | | | `point_of_interest.name` | string | no | | | `point_of_interest.description` | string or null | no | | | `point_of_interest.poi_type` | string | no | | | `point_of_interest.url` | string or null | no | | | `point_of_interest.lat` | number | no | Latitude | | `point_of_interest.lng` | number | no | Longitude | | `point_of_interest.tag_names` | array of strings | no | Replaces all tags. Send an empty array to remove them. | ### Response `200` | Name | Type | Description | | --- | --- | --- | | `point_of_interest` | object | | | `point_of_interest.id` | integer | | | `point_of_interest.user_id` | integer | | | `point_of_interest.type` | string | | | `point_of_interest.type_id` | integer | | | `point_of_interest.type_name` | string | | | `point_of_interest.name` | string | | | `point_of_interest.description` | string or null | | | `point_of_interest.url` | string | | | `point_of_interest.lat` | number | | | `point_of_interest.lng` | number | | | `point_of_interest.distances` | array of numbers | Distances from start in meters for waypoints | | `point_of_interest.tag_names` | array of strings | | ### Errors - `401` Unauthorized - `404` Point of interest not found - `422` Validation error ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X PUT \ -H "Content-Type: application/json" \ -d '{ "point_of_interest": { "name": "Coffee stop", "description": "Good espresso before the climb", "poi_type": "coffee", "url": "https://example.com", "lat": 45.521529, "lng": -122.691804, "tag_names": [ "Tag names" ] } }' \ https://ridewithgps.com/api/v1/points_of_interest/123.json ``` ### Example response ```json { "point_of_interest": { "id": 123, "user_id": 123, "type": "coffee", "type_id": 123, "type_name": "Coffee", "name": "Coffee stop", "description": "Good espresso before the climb", "url": "https://ridewithgps.com/api/v1/points_of_interest/123.json", "lat": 45.521529, "lng": -122.691804, "distances": [ 12487.3 ], "tag_names": [ "Tag names" ] } } ``` ## Deletes the specified point of interest `DELETE /api/v1/points_of_interest/{id}.json` Deletes a point of interest owned by the authenticated organization. **Note**: This endpoint is available for organizations only. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | | ### Response `204` Point of interest deleted successfully ### Errors - `401` Unauthorized - `404` Point of interest not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X DELETE \ https://ridewithgps.com/api/v1/points_of_interest/123.json ``` ## Disassociates a point of interest from a route `DELETE /api/v1/points_of_interest/{id}/routes/{route_id}.json` Removes the association between a point of interest and a specific route **Note**: This endpoint is available for organizations only. ### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | ### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | | | `route_id` | integer | path | yes | | ### Response `204` POI disassociated from route successfully ### Errors - `401` Unauthorized - `404` POI or route not found ### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X DELETE \ https://ridewithgps.com/api/v1/points_of_interest/123/routes/123.json ``` --- # Experiences Source: https://ridewithgps.com/api/v1/doc/organizations/experiences.md **Organizations only.** You need an organization account with access to Experiences; other accounts get a `403`. If your account does not have Experiences enabled, please contact [organizations@ridewithgps.com](mailto:organizations@ridewithgps.com). To publish a tour step by step, follow [Publish a multi-day tour](https://ridewithgps.com/api/v1/doc/organizations/publish_tours.md). See also: [Guide page blocks](https://ridewithgps.com/api/v1/doc/reference/guide_page_blocks.md), [Photos](https://ridewithgps.com/api/v1/doc/endpoints/photos.md), [Tasks](https://ridewithgps.com/api/v1/doc/endpoints/tasks.md). OpenAPI specification for these endpoints: https://ridewithgps.com/api/v1/openapi/openapi_experiences.yaml ## Experiences ### Returns a list of experiences `GET /api/v1/experiences.json` Returns a paginated list of the organization's experiences. Experiences endpoints are only available to organization accounts with access to Experiences. Supports filtering by `name` and `archived`. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `page` | integer | query | no | Page number for pagination | | `page_size` | integer | query | no | Number of items per page (20-200) | | `name` | string | query | no | Filter by name (partial match) | | `archived` | string | query | no | Filter by archived status. One of: `true`, `false`. | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `experiences` | array of objects | | | `experiences[].id` | integer | | | `experiences[].url` | string | | | `experiences[].name` | string | | | `experiences[].description` | string or null | | | `experiences[].location` | string | | | `experiences[].starts_on` | string or null | | | `experiences[].ends_on` | string or null | | | `experiences[].active` | boolean | False hides the experience from the app. | | `experiences[].archived` | boolean | | | `experiences[].publish_status` | string | `updates` means the experience changed since the last published package. `failed` means the last build failed; publish again to retry. One of: `unpublished`, `queued`, `processing`, `updates`, `published`, `failed`. | | `experiences[].logo_url` | string or null | | | `experiences[].cover_url` | string or null | | | `experiences[].expire_after_days` | integer or null | Days a guest keeps access after joining. Null or 0 means access does not expire. Organizations without unlimited experiences can only use 15 or 30. | | `experiences[].unlimited` | boolean | True when guests join with one shared guest code; false when each guest needs a limited code. | | `experiences[].show_routes` | boolean | | | `experiences[].reference_id` | string | | | `experiences[].require_name` | boolean | Ask guests for their name when they join. | | `experiences[].require_email` | boolean | | | `experiences[].require_phone` | boolean | | | `experiences[].require_zip_code` | boolean | | | `experiences[].require_reference_id` | boolean | | | `experiences[].created_at` | date-time | | | `experiences[].updated_at` | date-time | | | `meta` | object | | | `meta.pagination` | object | | | `meta.pagination.record_count` | integer | Total number of records | | `meta.pagination.page_count` | integer | Total number of pages | | `meta.pagination.page_size` | integer | Number of records per page | | `meta.pagination.next_page_url` | string or null | URL for the next page (null if last page) | #### Errors - `403` Forbidden - Not an organization account #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/experiences.json ``` #### Example response ```json { "experiences": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123.json", "name": "Oregon Coast tour", "description": "Five days along the Oregon coast", "location": "Portland, OR", "starts_on": "2000-01-01", "ends_on": "2000-01-01", "active": false, "archived": false, "publish_status": "unpublished", "logo_url": "https://ridewithgps.com/files/logo.jpg", "cover_url": "https://ridewithgps.com/files/cover.jpg", "expire_after_days": 30, "unlimited": false, "show_routes": false, "reference_id": "TOUR-2000-01", "require_name": false, "require_email": false, "require_phone": false, "require_zip_code": false, "require_reference_id": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "meta": { "pagination": { "record_count": 45, "page_count": 3, "page_size": 20, "next_page_url": "https://ridewithgps.com/api/v1/experiences.json?page=2" } } } ``` ### Returns an experience `GET /api/v1/experiences/{id}.json` #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `experience` | object | | | `experience.id` | integer | | | `experience.url` | string | | | `experience.name` | string | | | `experience.description` | string or null | | | `experience.location` | string | | | `experience.starts_on` | string or null | | | `experience.ends_on` | string or null | | | `experience.active` | boolean | False hides the experience from the app. | | `experience.archived` | boolean | | | `experience.publish_status` | string | `updates` means the experience changed since the last published package. `failed` means the last build failed; publish again to retry. One of: `unpublished`, `queued`, `processing`, `updates`, `published`, `failed`. | | `experience.logo_url` | string or null | | | `experience.cover_url` | string or null | | | `experience.expire_after_days` | integer or null | Days a guest keeps access after joining. Null or 0 means access does not expire. Organizations without unlimited experiences can only use 15 or 30. | | `experience.unlimited` | boolean | True when guests join with one shared guest code; false when each guest needs a limited code. | | `experience.show_routes` | boolean | | | `experience.reference_id` | string | | | `experience.require_name` | boolean | Ask guests for their name when they join. | | `experience.require_email` | boolean | | | `experience.require_phone` | boolean | | | `experience.require_zip_code` | boolean | | | `experience.require_reference_id` | boolean | | | `experience.created_at` | date-time | | | `experience.updated_at` | date-time | | | `experience.tags` | array of strings | | | `experience.route_ids` | array of integers | Routes in the order guests see them. | | `experience.guest_code` | string or null | Active code guests enter in the app to join. | | `experience.guide_code` | string or null | Active code for guides; guides never expire. | #### Errors - `404` Another organization's experience #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/experiences/123.json ``` #### Example response ```json { "experience": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123.json", "name": "Oregon Coast tour", "description": "Five days along the Oregon coast", "location": "Portland, OR", "starts_on": "2000-01-01", "ends_on": "2000-01-01", "active": false, "archived": false, "publish_status": "unpublished", "logo_url": "https://ridewithgps.com/files/logo.jpg", "cover_url": "https://ridewithgps.com/files/cover.jpg", "expire_after_days": 30, "unlimited": false, "show_routes": false, "reference_id": "TOUR-2000-01", "require_name": false, "require_email": false, "require_phone": false, "require_zip_code": false, "require_reference_id": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "tags": [ "Tags" ], "route_ids": [ 1 ], "guest_code": "COAST2000", "guide_code": "GUIDE2000" } } ``` ### Creates an experience `POST /api/v1/experiences.json` Creates an experience for the organization. Send `source_experience_id` to create a copy of one of the organization's experiences, with its routes and guide pages. Other fields sent with it override the copied values. `route_ids` sets the experience's routes, in order. Only routes owned by the organization are accepted. **Multipart uploads**: To upload a logo or cover image, send `multipart/form-data` with `experience[logo]` and `experience[cover]`. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `experience` | object | yes | | | `experience.source_experience_id` | integer | no | Create only. Copies this experience and its guide pages. The copy shares the original's routes; no new routes are created. | | `experience.name` | string | no | | | `experience.description` | string | no | | | `experience.location` | string | no | | | `experience.starts_on` | string | no | | | `experience.ends_on` | string | no | | | `experience.active` | boolean | no | | | `experience.archived` | boolean | no | | | `experience.expire_after_days` | integer or null | no | | | `experience.unlimited` | boolean | no | | | `experience.show_routes` | boolean | no | | | `experience.reference_id` | string | no | | | `experience.require_name` | boolean | no | | | `experience.require_email` | boolean | no | | | `experience.require_phone` | boolean | no | | | `experience.require_zip_code` | boolean | no | | | `experience.require_reference_id` | boolean | no | | | `experience.route_ids` | array of integers | no | Replaces the route list, in this order. | | `experience.tags` | array of strings | no | Replaces the tags. | | `experience.logo` | file | no | Multipart only. | | `experience.cover` | file | no | Multipart only. | #### Response `201` | Name | Type | Description | | --- | --- | --- | | `experience` | object | | | `experience.id` | integer | | | `experience.url` | string | | | `experience.name` | string | | | `experience.description` | string or null | | | `experience.location` | string | | | `experience.starts_on` | string or null | | | `experience.ends_on` | string or null | | | `experience.active` | boolean | False hides the experience from the app. | | `experience.archived` | boolean | | | `experience.publish_status` | string | `updates` means the experience changed since the last published package. `failed` means the last build failed; publish again to retry. One of: `unpublished`, `queued`, `processing`, `updates`, `published`, `failed`. | | `experience.logo_url` | string or null | | | `experience.cover_url` | string or null | | | `experience.expire_after_days` | integer or null | Days a guest keeps access after joining. Null or 0 means access does not expire. Organizations without unlimited experiences can only use 15 or 30. | | `experience.unlimited` | boolean | True when guests join with one shared guest code; false when each guest needs a limited code. | | `experience.show_routes` | boolean | | | `experience.reference_id` | string | | | `experience.require_name` | boolean | Ask guests for their name when they join. | | `experience.require_email` | boolean | | | `experience.require_phone` | boolean | | | `experience.require_zip_code` | boolean | | | `experience.require_reference_id` | boolean | | | `experience.created_at` | date-time | | | `experience.updated_at` | date-time | | | `experience.tags` | array of strings | | | `experience.route_ids` | array of integers | Routes in the order guests see them. | | `experience.guest_code` | string or null | Active code guests enter in the app to join. | | `experience.guide_code` | string or null | Active code for guides; guides never expire. | #### Errors - `404` Source experience not found - `422` Validation error #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -H "Content-Type: application/json" \ -d '{ "experience": { "source_experience_id": 123, "name": "Oregon Coast tour", "description": "Five days along the Oregon coast", "location": "Portland, OR", "starts_on": "2000-01-01", "ends_on": "2000-01-01", "active": false, "archived": false, "expire_after_days": 30, "unlimited": false, "show_routes": false, "reference_id": "TOUR-2000-01", "require_name": false, "require_email": false, "require_phone": false, "require_zip_code": false, "require_reference_id": false, "route_ids": [ 1 ], "tags": [ "Tags" ] } }' \ https://ridewithgps.com/api/v1/experiences.json ``` #### Example response ```json { "experience": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123.json", "name": "Oregon Coast tour", "description": "Five days along the Oregon coast", "location": "Portland, OR", "starts_on": "2000-01-01", "ends_on": "2000-01-01", "active": false, "archived": false, "publish_status": "unpublished", "logo_url": "https://ridewithgps.com/files/logo.jpg", "cover_url": "https://ridewithgps.com/files/cover.jpg", "expire_after_days": 30, "unlimited": false, "show_routes": false, "reference_id": "TOUR-2000-01", "require_name": false, "require_email": false, "require_phone": false, "require_zip_code": false, "require_reference_id": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "tags": [ "Tags" ], "route_ids": [ 1 ], "guest_code": "COAST2000", "guide_code": "GUIDE2000" } } ``` ### Updates an experience `PATCH /api/v1/experiences/{id}.json` Updates an experience. Only the fields sent are changed. `route_ids` replaces the whole route list, in the order given. Send an empty array to remove every route. `active: false` hides the experience from the app; publish a package to make it available again. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | | #### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `experience` | object | yes | | | `experience.source_experience_id` | integer | no | Create only. Copies this experience and its guide pages. The copy shares the original's routes; no new routes are created. | | `experience.name` | string | no | | | `experience.description` | string | no | | | `experience.location` | string | no | | | `experience.starts_on` | string | no | | | `experience.ends_on` | string | no | | | `experience.active` | boolean | no | | | `experience.archived` | boolean | no | | | `experience.expire_after_days` | integer or null | no | | | `experience.unlimited` | boolean | no | | | `experience.show_routes` | boolean | no | | | `experience.reference_id` | string | no | | | `experience.require_name` | boolean | no | | | `experience.require_email` | boolean | no | | | `experience.require_phone` | boolean | no | | | `experience.require_zip_code` | boolean | no | | | `experience.require_reference_id` | boolean | no | | | `experience.route_ids` | array of integers | no | Replaces the route list, in this order. | | `experience.tags` | array of strings | no | Replaces the tags. | | `experience.logo` | file | no | Multipart only. | | `experience.cover` | file | no | Multipart only. | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `experience` | object | | | `experience.id` | integer | | | `experience.url` | string | | | `experience.name` | string | | | `experience.description` | string or null | | | `experience.location` | string | | | `experience.starts_on` | string or null | | | `experience.ends_on` | string or null | | | `experience.active` | boolean | False hides the experience from the app. | | `experience.archived` | boolean | | | `experience.publish_status` | string | `updates` means the experience changed since the last published package. `failed` means the last build failed; publish again to retry. One of: `unpublished`, `queued`, `processing`, `updates`, `published`, `failed`. | | `experience.logo_url` | string or null | | | `experience.cover_url` | string or null | | | `experience.expire_after_days` | integer or null | Days a guest keeps access after joining. Null or 0 means access does not expire. Organizations without unlimited experiences can only use 15 or 30. | | `experience.unlimited` | boolean | True when guests join with one shared guest code; false when each guest needs a limited code. | | `experience.show_routes` | boolean | | | `experience.reference_id` | string | | | `experience.require_name` | boolean | Ask guests for their name when they join. | | `experience.require_email` | boolean | | | `experience.require_phone` | boolean | | | `experience.require_zip_code` | boolean | | | `experience.require_reference_id` | boolean | | | `experience.created_at` | date-time | | | `experience.updated_at` | date-time | | | `experience.tags` | array of strings | | | `experience.route_ids` | array of integers | Routes in the order guests see them. | | `experience.guest_code` | string or null | Active code guests enter in the app to join. | | `experience.guide_code` | string or null | Active code for guides; guides never expire. | #### Errors - `422` Validation error #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X PATCH \ -H "Content-Type: application/json" \ -d '{ "experience": { "source_experience_id": 123, "name": "Oregon Coast tour", "description": "Five days along the Oregon coast", "location": "Portland, OR", "starts_on": "2000-01-01", "ends_on": "2000-01-01", "active": false, "archived": false, "expire_after_days": 30, "unlimited": false, "show_routes": false, "reference_id": "TOUR-2000-01", "require_name": false, "require_email": false, "require_phone": false, "require_zip_code": false, "require_reference_id": false, "route_ids": [ 1 ], "tags": [ "Tags" ] } }' \ https://ridewithgps.com/api/v1/experiences/123.json ``` #### Example response ```json { "experience": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123.json", "name": "Oregon Coast tour", "description": "Five days along the Oregon coast", "location": "Portland, OR", "starts_on": "2000-01-01", "ends_on": "2000-01-01", "active": false, "archived": false, "publish_status": "unpublished", "logo_url": "https://ridewithgps.com/files/logo.jpg", "cover_url": "https://ridewithgps.com/files/cover.jpg", "expire_after_days": 30, "unlimited": false, "show_routes": false, "reference_id": "TOUR-2000-01", "require_name": false, "require_email": false, "require_phone": false, "require_zip_code": false, "require_reference_id": false, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "tags": [ "Tags" ], "route_ids": [ 1 ], "guest_code": "COAST2000", "guide_code": "GUIDE2000" } } ``` ### Deletes an experience `DELETE /api/v1/experiences/{id}.json` Deletes an experience. An experience that guests have already joined is hidden instead, so their access history is kept. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `id` | integer | path | yes | | #### Response `204` Experience deleted #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X DELETE \ https://ridewithgps.com/api/v1/experiences/123.json ``` ## Experience Guide Pages ### Returns an experience's guide pages `GET /api/v1/experiences/{experience_id}/guide_pages.json` Returns every guide page of the experience, each top-level page followed by the pages under it. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `guide_pages` | array of objects | | | `guide_pages[].id` | integer | | | `guide_pages[].url` | string | | | `guide_pages[].experience_id` | integer | | | `guide_pages[].parent_id` | integer or null | The top-level page this page sits under, or null. | | `guide_pages[].position` | integer | Place among the pages that share the parent, starting at 1. | | `guide_pages[].title` | string | | | `guide_pages[].header` | boolean | A header page only lists the pages under it and has no blocks. | | `guide_pages[].live` | boolean | Live pages update in the app without publishing a new package. | | `guide_pages[].blocks` | array of objects | | | `guide_pages[].blocks[].type` | string | One of: `text`, `photo`, `route`, `elevation_profile`. | | `guide_pages[].blocks[].markdown` | string | `text` blocks. | | `guide_pages[].blocks[].photo_id` | integer | `photo` blocks. A photo owned by the organization; upload one with `POST /api/v1/photos`. | | `guide_pages[].blocks[].on_tap` | string | `photo` blocks. What tapping the photo does. Defaults to `none`. One of: `none`, `enlarge`, `open_link`. | | `guide_pages[].blocks[].link_url` | string or null | `photo` blocks with `on_tap: open_link`. | | `guide_pages[].blocks[].route_id` | integer | `route` and `elevation_profile` blocks. A route owned by the organization. | | `guide_pages[].blocks[].url` | string or null | Read only. The photo image, for `photo` blocks. | | `guide_pages[].blocks[].name` | string | Read only. The route name shown on a `route` card. | | `guide_pages[].blocks[].distance` | number | Read only. Meters, as shown on a `route` card. | | `guide_pages[].blocks[].elevation_gain` | number | Read only. Meters, as shown on a `route` card. | | `guide_pages[].file` | object or null | Present on PDF pages. | | `guide_pages[].file.name` | string | | | `guide_pages[].file.filename` | string | | | `guide_pages[].file.content_type` | string | | | `guide_pages[].file.size` | integer | | | `guide_pages[].created_at` | date-time | | | `guide_pages[].updated_at` | date-time | | #### Errors - `404` Another organization's experience #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/experiences/123/guide_pages.json ``` #### Example response ```json { "guide_pages": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/guide_pages/123.json", "experience_id": 123, "parent_id": 123, "position": 1, "title": "Day 1: Portland to Tillamook", "header": false, "live": false, "blocks": [ { "type": "text", "markdown": "Welcome to the tour! Today we ride from Portland to the coast.", "photo_id": 123, "on_tap": "none", "link_url": "https://example.com", "route_id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "name": "Forest Park loop", "distance": 40237, "elevation_gain": 457 } ], "file": { "name": "day1.pdf", "filename": "day1.pdf", "content_type": "application/pdf", "size": 1093417 }, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } ``` ### Returns a guide page `GET /api/v1/experiences/{experience_id}/guide_pages/{id}.json` #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | | `id` | integer | path | yes | | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `guide_page` | object | | | `guide_page.id` | integer | | | `guide_page.url` | string | | | `guide_page.experience_id` | integer | | | `guide_page.parent_id` | integer or null | The top-level page this page sits under, or null. | | `guide_page.position` | integer | Place among the pages that share the parent, starting at 1. | | `guide_page.title` | string | | | `guide_page.header` | boolean | A header page only lists the pages under it and has no blocks. | | `guide_page.live` | boolean | Live pages update in the app without publishing a new package. | | `guide_page.blocks` | array of objects | | | `guide_page.blocks[].type` | string | One of: `text`, `photo`, `route`, `elevation_profile`. | | `guide_page.blocks[].markdown` | string | `text` blocks. | | `guide_page.blocks[].photo_id` | integer | `photo` blocks. A photo owned by the organization; upload one with `POST /api/v1/photos`. | | `guide_page.blocks[].on_tap` | string | `photo` blocks. What tapping the photo does. Defaults to `none`. One of: `none`, `enlarge`, `open_link`. | | `guide_page.blocks[].link_url` | string or null | `photo` blocks with `on_tap: open_link`. | | `guide_page.blocks[].route_id` | integer | `route` and `elevation_profile` blocks. A route owned by the organization. | | `guide_page.blocks[].url` | string or null | Read only. The photo image, for `photo` blocks. | | `guide_page.blocks[].name` | string | Read only. The route name shown on a `route` card. | | `guide_page.blocks[].distance` | number | Read only. Meters, as shown on a `route` card. | | `guide_page.blocks[].elevation_gain` | number | Read only. Meters, as shown on a `route` card. | | `guide_page.file` | object or null | Present on PDF pages. | | `guide_page.file.name` | string | | | `guide_page.file.filename` | string | | | `guide_page.file.content_type` | string | | | `guide_page.file.size` | integer | | | `guide_page.created_at` | date-time | | | `guide_page.updated_at` | date-time | | #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/experiences/123/guide_pages/123.json ``` #### Example response ```json { "guide_page": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/guide_pages/123.json", "experience_id": 123, "parent_id": 123, "position": 1, "title": "Day 1: Portland to Tillamook", "header": false, "live": false, "blocks": [ { "type": "text", "markdown": "Welcome to the tour! Today we ride from Portland to the coast.", "photo_id": 123, "on_tap": "none", "link_url": "https://example.com", "route_id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "name": "Forest Park loop", "distance": 40237, "elevation_gain": 457 } ], "file": { "name": "day1.pdf", "filename": "day1.pdf", "content_type": "application/pdf", "size": 1093417 }, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ### Creates a guide page `POST /api/v1/experiences/{experience_id}/guide_pages.json` Adds a guide page to the experience. Without `parent_id` and `position`, the page goes last at the top level. Content is a list of blocks: Markdown text, photos, route cards and elevation profiles. Photos and routes must belong to the organization. See [Guide page blocks](/api/v1/doc/reference/guide_page_blocks) for every block type and the Markdown text blocks accept. **PDF pages**: send `multipart/form-data` with `guide_page[title]` and `guide_page[file]` instead of blocks. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | #### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `guide_page` | object | yes | | | `guide_page.title` | string | no | | | `guide_page.header` | boolean | no | Create only. | | `guide_page.live` | boolean | no | | | `guide_page.parent_id` | integer or null | no | A top-level page of the experience, or null for top level. A page with pages under it stays top level. | | `guide_page.position` | integer | no | Place among the pages that share the parent, starting at 1. Defaults to last. | | `guide_page.blocks` | array of objects | no | Replaces the page content. | | `guide_page.blocks[].type` | string | yes | One of: `text`, `photo`, `route`, `elevation_profile`. | | `guide_page.blocks[].markdown` | string | no | `text` blocks. | | `guide_page.blocks[].photo_id` | integer | no | `photo` blocks. A photo owned by the organization; upload one with `POST /api/v1/photos`. | | `guide_page.blocks[].on_tap` | string | no | `photo` blocks. What tapping the photo does. Defaults to `none`. One of: `none`, `enlarge`, `open_link`. | | `guide_page.blocks[].link_url` | string or null | no | `photo` blocks with `on_tap: open_link`. | | `guide_page.blocks[].route_id` | integer | no | `route` and `elevation_profile` blocks. A route owned by the organization. | | `guide_page.blocks[].url` | string or null | no | Read only. The photo image, for `photo` blocks. | | `guide_page.blocks[].name` | string | no | Read only. The route name shown on a `route` card. | | `guide_page.blocks[].distance` | number | no | Read only. Meters, as shown on a `route` card. | | `guide_page.blocks[].elevation_gain` | number | no | Read only. Meters, as shown on a `route` card. | | `guide_page.file` | file | no | Create only, multipart. A PDF, sent instead of blocks. | #### Response `201` | Name | Type | Description | | --- | --- | --- | | `guide_page` | object | | | `guide_page.id` | integer | | | `guide_page.url` | string | | | `guide_page.experience_id` | integer | | | `guide_page.parent_id` | integer or null | The top-level page this page sits under, or null. | | `guide_page.position` | integer | Place among the pages that share the parent, starting at 1. | | `guide_page.title` | string | | | `guide_page.header` | boolean | A header page only lists the pages under it and has no blocks. | | `guide_page.live` | boolean | Live pages update in the app without publishing a new package. | | `guide_page.blocks` | array of objects | | | `guide_page.blocks[].type` | string | One of: `text`, `photo`, `route`, `elevation_profile`. | | `guide_page.blocks[].markdown` | string | `text` blocks. | | `guide_page.blocks[].photo_id` | integer | `photo` blocks. A photo owned by the organization; upload one with `POST /api/v1/photos`. | | `guide_page.blocks[].on_tap` | string | `photo` blocks. What tapping the photo does. Defaults to `none`. One of: `none`, `enlarge`, `open_link`. | | `guide_page.blocks[].link_url` | string or null | `photo` blocks with `on_tap: open_link`. | | `guide_page.blocks[].route_id` | integer | `route` and `elevation_profile` blocks. A route owned by the organization. | | `guide_page.blocks[].url` | string or null | Read only. The photo image, for `photo` blocks. | | `guide_page.blocks[].name` | string | Read only. The route name shown on a `route` card. | | `guide_page.blocks[].distance` | number | Read only. Meters, as shown on a `route` card. | | `guide_page.blocks[].elevation_gain` | number | Read only. Meters, as shown on a `route` card. | | `guide_page.file` | object or null | Present on PDF pages. | | `guide_page.file.name` | string | | | `guide_page.file.filename` | string | | | `guide_page.file.content_type` | string | | | `guide_page.file.size` | integer | | | `guide_page.created_at` | date-time | | | `guide_page.updated_at` | date-time | | #### Errors - `422` Invalid blocks #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -H "Content-Type: application/json" \ -d '{ "guide_page": { "title": "Day 1: Portland to Tillamook", "header": false, "live": false, "parent_id": 123, "position": 1, "blocks": [ { "type": "text", "markdown": "Welcome to the tour! Today we ride from Portland to the coast.", "photo_id": 123, "on_tap": "none", "link_url": "https://example.com", "route_id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "name": "Forest Park loop", "distance": 40237, "elevation_gain": 457 } ] } }' \ https://ridewithgps.com/api/v1/experiences/123/guide_pages.json ``` #### Example response ```json { "guide_page": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/guide_pages/123.json", "experience_id": 123, "parent_id": 123, "position": 1, "title": "Day 1: Portland to Tillamook", "header": false, "live": false, "blocks": [ { "type": "text", "markdown": "Welcome to the tour! Today we ride from Portland to the coast.", "photo_id": 123, "on_tap": "none", "link_url": "https://example.com", "route_id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "name": "Forest Park loop", "distance": 40237, "elevation_gain": 457 } ], "file": { "name": "day1.pdf", "filename": "day1.pdf", "content_type": "application/pdf", "size": 1093417 }, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ### Updates a guide page `PATCH /api/v1/experiences/{experience_id}/guide_pages/{id}.json` Updates a guide page. Only the fields sent are changed. `blocks` replaces the whole content. See [Guide page blocks](/api/v1/doc/reference/guide_page_blocks). Send `parent_id` and/or `position` to move the page; the other pages are renumbered. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | | `id` | integer | path | yes | | #### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `guide_page` | object | yes | | | `guide_page.title` | string | no | | | `guide_page.header` | boolean | no | Create only. | | `guide_page.live` | boolean | no | | | `guide_page.parent_id` | integer or null | no | A top-level page of the experience, or null for top level. A page with pages under it stays top level. | | `guide_page.position` | integer | no | Place among the pages that share the parent, starting at 1. Defaults to last. | | `guide_page.blocks` | array of objects | no | Replaces the page content. | | `guide_page.blocks[].type` | string | yes | One of: `text`, `photo`, `route`, `elevation_profile`. | | `guide_page.blocks[].markdown` | string | no | `text` blocks. | | `guide_page.blocks[].photo_id` | integer | no | `photo` blocks. A photo owned by the organization; upload one with `POST /api/v1/photos`. | | `guide_page.blocks[].on_tap` | string | no | `photo` blocks. What tapping the photo does. Defaults to `none`. One of: `none`, `enlarge`, `open_link`. | | `guide_page.blocks[].link_url` | string or null | no | `photo` blocks with `on_tap: open_link`. | | `guide_page.blocks[].route_id` | integer | no | `route` and `elevation_profile` blocks. A route owned by the organization. | | `guide_page.blocks[].url` | string or null | no | Read only. The photo image, for `photo` blocks. | | `guide_page.blocks[].name` | string | no | Read only. The route name shown on a `route` card. | | `guide_page.blocks[].distance` | number | no | Read only. Meters, as shown on a `route` card. | | `guide_page.blocks[].elevation_gain` | number | no | Read only. Meters, as shown on a `route` card. | | `guide_page.file` | file | no | Create only, multipart. A PDF, sent instead of blocks. | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `guide_page` | object | | | `guide_page.id` | integer | | | `guide_page.url` | string | | | `guide_page.experience_id` | integer | | | `guide_page.parent_id` | integer or null | The top-level page this page sits under, or null. | | `guide_page.position` | integer | Place among the pages that share the parent, starting at 1. | | `guide_page.title` | string | | | `guide_page.header` | boolean | A header page only lists the pages under it and has no blocks. | | `guide_page.live` | boolean | Live pages update in the app without publishing a new package. | | `guide_page.blocks` | array of objects | | | `guide_page.blocks[].type` | string | One of: `text`, `photo`, `route`, `elevation_profile`. | | `guide_page.blocks[].markdown` | string | `text` blocks. | | `guide_page.blocks[].photo_id` | integer | `photo` blocks. A photo owned by the organization; upload one with `POST /api/v1/photos`. | | `guide_page.blocks[].on_tap` | string | `photo` blocks. What tapping the photo does. Defaults to `none`. One of: `none`, `enlarge`, `open_link`. | | `guide_page.blocks[].link_url` | string or null | `photo` blocks with `on_tap: open_link`. | | `guide_page.blocks[].route_id` | integer | `route` and `elevation_profile` blocks. A route owned by the organization. | | `guide_page.blocks[].url` | string or null | Read only. The photo image, for `photo` blocks. | | `guide_page.blocks[].name` | string | Read only. The route name shown on a `route` card. | | `guide_page.blocks[].distance` | number | Read only. Meters, as shown on a `route` card. | | `guide_page.blocks[].elevation_gain` | number | Read only. Meters, as shown on a `route` card. | | `guide_page.file` | object or null | Present on PDF pages. | | `guide_page.file.name` | string | | | `guide_page.file.filename` | string | | | `guide_page.file.content_type` | string | | | `guide_page.file.size` | integer | | | `guide_page.created_at` | date-time | | | `guide_page.updated_at` | date-time | | #### Errors - `422` Invalid move #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X PATCH \ -H "Content-Type: application/json" \ -d '{ "guide_page": { "title": "Day 1: Portland to Tillamook", "header": false, "live": false, "parent_id": 123, "position": 1, "blocks": [ { "type": "text", "markdown": "Welcome to the tour! Today we ride from Portland to the coast.", "photo_id": 123, "on_tap": "none", "link_url": "https://example.com", "route_id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "name": "Forest Park loop", "distance": 40237, "elevation_gain": 457 } ] } }' \ https://ridewithgps.com/api/v1/experiences/123/guide_pages/123.json ``` #### Example response ```json { "guide_page": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/guide_pages/123.json", "experience_id": 123, "parent_id": 123, "position": 1, "title": "Day 1: Portland to Tillamook", "header": false, "live": false, "blocks": [ { "type": "text", "markdown": "Welcome to the tour! Today we ride from Portland to the coast.", "photo_id": 123, "on_tap": "none", "link_url": "https://example.com", "route_id": 123, "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg", "name": "Forest Park loop", "distance": 40237, "elevation_gain": 457 } ], "file": { "name": "day1.pdf", "filename": "day1.pdf", "content_type": "application/pdf", "size": 1093417 }, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ### Deletes a guide page `DELETE /api/v1/experiences/{experience_id}/guide_pages/{id}.json` Deletes a guide page. Deleting a header also deletes the pages under it. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | | `id` | integer | path | yes | | #### Response `204` Guide page deleted #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X DELETE \ https://ridewithgps.com/api/v1/experiences/123/guide_pages/123.json ``` ## Experience Packages ### Returns an experience's packages `GET /api/v1/experiences/{experience_id}/packages.json` Returns the packages built for the experience, newest first. Guests download the newest package. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | | `page` | integer | query | no | Page number for pagination | | `page_size` | integer | query | no | Number of items per page (20-200) | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `packages` | array of objects | | | `packages[].id` | integer | | | `packages[].url` | string | | | `packages[].experience_id` | integer | | | `packages[].status` | string | `failed` means the last build of the experience failed; the task of the publish request reports it too. One of: `queued`, `processing`, `ready`, `failed`. | | `packages[].file_size` | integer or null | Bytes, once the package is ready. | | `packages[].created_at` | date-time | | | `packages[].updated_at` | date-time | | | `meta` | object | | | `meta.pagination` | object | | | `meta.pagination.record_count` | integer | Total number of records | | `meta.pagination.page_count` | integer | Total number of pages | | `meta.pagination.page_size` | integer | Number of records per page | | `meta.pagination.next_page_url` | string or null | URL for the next page (null if last page) | #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/experiences/123/packages.json ``` #### Example response ```json { "packages": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/packages/123.json", "experience_id": 123, "status": "queued", "file_size": 26381512, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "meta": { "pagination": { "record_count": 45, "page_count": 3, "page_size": 20, "next_page_url": "https://ridewithgps.com/api/v1/experiences/123/packages.json?page=2" } } } ``` ### Returns a package `GET /api/v1/experiences/{experience_id}/packages/{id}.json` #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | | `id` | integer | path | yes | | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `package` | object | | | `package.id` | integer | | | `package.url` | string | | | `package.experience_id` | integer | | | `package.status` | string | `failed` means the last build of the experience failed; the task of the publish request reports it too. One of: `queued`, `processing`, `ready`, `failed`. | | `package.file_size` | integer or null | Bytes, once the package is ready. | | `package.created_at` | date-time | | | `package.updated_at` | date-time | | #### Errors - `404` Another experience's package #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/experiences/123/packages/123.json ``` #### Example response ```json { "package": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/packages/123.json", "experience_id": 123, "status": "queued", "file_size": 26381512, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ### Publishes an experience `POST /api/v1/experiences/{experience_id}/packages.json` Makes the experience available to guests and builds a new package with its current routes and guide pages. The build runs in the background. Returns a task. Poll the task URL, also given in the `Location` header, until its status is `completed`. A finished build lists the package in `items`; a failed one reports a `build_failed` error. Refused with a 409 while a build is queued or running, or when nothing changed since the last build. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | #### Response `202` | Name | Type | Description | | --- | --- | --- | | `task` | object | | | `task.id` | integer | | | `task.user_id` | integer | | | `task.url` | string | API url of the task, to poll until it completes | | `task.type` | string | What kind of work the task performs. `gps_file_upload` for uploads, `experience_package` for experience packages | | `task.status` | string | `pending` until the task has run, then `completed` | | `task.created_at` | date-time | | | `task.updated_at` | date-time | | | `task.items` | array of objects | Assets created by the task. Empty while pending, and empty if nothing was created. A file holding several tracks creates one asset per track | | `task.items[].item_type` | string | Type of the created asset: `route` or `trip` for uploads, `experience_package` for experience packages | | `task.items[].item_id` | integer | | | `task.items[].item_url` | string or null | API url of the created asset | | `task.errors` | array of objects | Anything that went wrong, one entry per track that could not be imported. Empty when the task succeeded entirely | | `task.errors[].code` | string | Machine readable reason. One of `duplicate`, `time_data_missing`, `no_tracks`, `empty_file`, `parse_failed`, `failed_to_process`, `weigh_in_failed`, `build_failed`, `error` | | `task.errors[].message` | string | Human readable description, always in English | | `task.errors[].item_type` | string or null | Set when the error refers to an existing asset, as for a duplicate | | `task.errors[].item_id` | integer or null | | | `task.errors[].item_url` | string or null | | #### Errors - `409` A build is already running #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ https://ridewithgps.com/api/v1/experiences/123/packages.json ``` #### Example response ```json { "task": { "id": 123, "user_id": 123, "url": "https://ridewithgps.com/api/v1/tasks/123.json", "type": "gps_file_upload", "status": "completed", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z", "items": [ { "item_type": "route", "item_id": 123, "item_url": "https://ridewithgps.com/api/v1/routes/123.json" } ], "errors": [ { "code": "duplicate", "message": "This route already exists", "item_type": "route", "item_id": 123, "item_url": "https://ridewithgps.com/api/v1/routes/123.json" } ] } } ``` ## Experience Codes ### Returns an experience's codes `GET /api/v1/experiences/{experience_id}/codes.json` Returns every code of the experience, active or not, newest first. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `codes` | array of objects | | | `codes[].id` | integer | | | `codes[].url` | string | | | `codes[].code` | string | What guests enter in the app. Letters and digits, upper case. | | `codes[].kind` | string | `guest`: the shared code of an unlimited experience. `guide`: for guides, whose access never expires. `limited`: a code with an `access_limit`, for experiences whose `unlimited` is false. One of: `guest`, `guide`, `limited`. | | `codes[].active` | boolean | | | `codes[].access_limit` | integer or null | How many guests can join with a `limited` code. | | `codes[].times_used` | integer | | | `codes[].created_at` | date-time | | | `codes[].updated_at` | date-time | | #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/experiences/123/codes.json ``` #### Example response ```json { "codes": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/codes/123.json", "code": "COAST2000", "kind": "guest", "active": false, "access_limit": 20, "times_used": 3, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ] } ``` ### Returns a code `GET /api/v1/experiences/{experience_id}/codes/{id}.json` #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | | `id` | integer | path | yes | | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `code` | object | | | `code.id` | integer | | | `code.url` | string | | | `code.code` | string | What guests enter in the app. Letters and digits, upper case. | | `code.kind` | string | `guest`: the shared code of an unlimited experience. `guide`: for guides, whose access never expires. `limited`: a code with an `access_limit`, for experiences whose `unlimited` is false. One of: `guest`, `guide`, `limited`. | | `code.active` | boolean | | | `code.access_limit` | integer or null | How many guests can join with a `limited` code. | | `code.times_used` | integer | | | `code.created_at` | date-time | | | `code.updated_at` | date-time | | #### Errors - `404` Another experience's code #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/experiences/123/codes/123.json ``` #### Example response ```json { "code": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/codes/123.json", "code": "COAST2000", "kind": "guest", "active": false, "access_limit": 20, "times_used": 3, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ### Creates a code `POST /api/v1/experiences/{experience_id}/codes.json` Creates a code guests enter in the app to join the experience. Omit `code` to get a random one. A new `guest` or `guide` code replaces the active code of the same kind: guests who already joined keep their access, and the old code stops working. A replaced code nobody used is deleted. `guest` codes are for experiences whose `unlimited` is true. `limited` codes are for experiences whose `unlimited` is false; they add to the existing ones and need an `access_limit`. `guide` codes need the guide shortcut in the organization's plan. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | #### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `code` | object | yes | | | `code.kind` | string | yes | One of: `guest`, `guide`, `limited`. | | `code.code` | string | no | 4 to 20 letters or digits. Stored upper case. | | `code.access_limit` | integer | no | `limited` codes only. | #### Response `201` | Name | Type | Description | | --- | --- | --- | | `code` | object | | | `code.id` | integer | | | `code.url` | string | | | `code.code` | string | What guests enter in the app. Letters and digits, upper case. | | `code.kind` | string | `guest`: the shared code of an unlimited experience. `guide`: for guides, whose access never expires. `limited`: a code with an `access_limit`, for experiences whose `unlimited` is false. One of: `guest`, `guide`, `limited`. | | `code.active` | boolean | | | `code.access_limit` | integer or null | How many guests can join with a `limited` code. | | `code.times_used` | integer | | | `code.created_at` | date-time | | | `code.updated_at` | date-time | | #### Errors - `422` Invalid code #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -H "Content-Type: application/json" \ -d '{ "code": { "kind": "guest", "code": "SMITH2000", "access_limit": 20 } }' \ https://ridewithgps.com/api/v1/experiences/123/codes.json ``` #### Example response ```json { "code": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/codes/123.json", "code": "COAST2000", "kind": "guest", "active": false, "access_limit": 20, "times_used": 3, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ### Updates a code `PATCH /api/v1/experiences/{experience_id}/codes/{id}.json` Turns a code on or off, or changes the `access_limit` of a `limited` code. The limit cannot go below the times the code was used. Turning a `guest` or `guide` code back on makes it the experience's code of that kind again. The active `guest` code cannot be turned off, and neither can the active `guide` code when the plan includes the guide shortcut: create a new code to replace it. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | | `id` | integer | path | yes | | #### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `code` | object | yes | | | `code.active` | boolean | no | | | `code.access_limit` | integer | no | | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `code` | object | | | `code.id` | integer | | | `code.url` | string | | | `code.code` | string | What guests enter in the app. Letters and digits, upper case. | | `code.kind` | string | `guest`: the shared code of an unlimited experience. `guide`: for guides, whose access never expires. `limited`: a code with an `access_limit`, for experiences whose `unlimited` is false. One of: `guest`, `guide`, `limited`. | | `code.active` | boolean | | | `code.access_limit` | integer or null | How many guests can join with a `limited` code. | | `code.times_used` | integer | | | `code.created_at` | date-time | | | `code.updated_at` | date-time | | #### Errors - `422` Invalid change #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X PATCH \ -H "Content-Type: application/json" \ -d '{ "code": { "active": false, "access_limit": 20 } }' \ https://ridewithgps.com/api/v1/experiences/123/codes/123.json ``` #### Example response ```json { "code": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/codes/123.json", "code": "COAST2000", "kind": "guest", "active": false, "access_limit": 20, "times_used": 3, "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ## Experience Guests ### Returns an experience's guests `GET /api/v1/experiences/{experience_id}/guests.json` Returns the guests who joined the experience with a code and downloaded it, newest first. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | | `page` | integer | query | no | Page number for pagination | | `page_size` | integer | query | no | Number of items per page (20-200) | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `guests` | array of objects | | | `guests[].id` | integer | | | `guests[].url` | string | | | `guests[].code` | string | The code the guest joined with. | | `guests[].code_kind` | string | One of: `guest`, `guide`, `limited`. | | `guests[].details` | object | What the guest entered when the experience asks for it (`require_name`, `require_email`, ...). | | `guests[].details.name` | string | | | `guests[].details.email` | string | | | `guests[].details.phone` | string | | | `guests[].details.zip_code` | string | | | `guests[].details.reference_id` | string | | | `guests[].can_email` | boolean | The guest agreed to be emailed. | | `guests[].download_count` | integer | | | `guests[].expires_at` | date-time or null | When access ends. Null means it does not expire. | | `guests[].removed_by_guest` | boolean | The guest removed the experience from the app. Entering the code again brings it back. | | `guests[].joined_at` | date-time | | | `guests[].updated_at` | date-time | | | `meta` | object | | | `meta.pagination` | object | | | `meta.pagination.record_count` | integer | Total number of records | | `meta.pagination.page_count` | integer | Total number of pages | | `meta.pagination.page_size` | integer | Number of records per page | | `meta.pagination.next_page_url` | string or null | URL for the next page (null if last page) | #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/experiences/123/guests.json ``` #### Example response ```json { "guests": [ { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/guests/123.json", "code": "COAST2000", "code_kind": "guest", "details": { "name": "Alex Rider", "email": "alex@example.com", "phone": "+1 503 555 0100", "zip_code": "97209", "reference_id": "BOOKING-1234" }, "can_email": false, "download_count": 1, "expires_at": "2000-01-01T12:00:00Z", "removed_by_guest": false, "joined_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "meta": { "pagination": { "record_count": 45, "page_count": 3, "page_size": 20, "next_page_url": "https://ridewithgps.com/api/v1/experiences/123/guests.json?page=2" } } } ``` ### Returns a guest `GET /api/v1/experiences/{experience_id}/guests/{id}.json` #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | | `id` | integer | path | yes | | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `guest` | object | | | `guest.id` | integer | | | `guest.url` | string | | | `guest.code` | string | The code the guest joined with. | | `guest.code_kind` | string | One of: `guest`, `guide`, `limited`. | | `guest.details` | object | What the guest entered when the experience asks for it (`require_name`, `require_email`, ...). | | `guest.details.name` | string | | | `guest.details.email` | string | | | `guest.details.phone` | string | | | `guest.details.zip_code` | string | | | `guest.details.reference_id` | string | | | `guest.can_email` | boolean | The guest agreed to be emailed. | | `guest.download_count` | integer | | | `guest.expires_at` | date-time or null | When access ends. Null means it does not expire. | | `guest.removed_by_guest` | boolean | The guest removed the experience from the app. Entering the code again brings it back. | | `guest.joined_at` | date-time | | | `guest.updated_at` | date-time | | #### Errors - `404` Another experience's guest #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/experiences/123/guests/123.json ``` #### Example response ```json { "guest": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/guests/123.json", "code": "COAST2000", "code_kind": "guest", "details": { "name": "Alex Rider", "email": "alex@example.com", "phone": "+1 503 555 0100", "zip_code": "97209", "reference_id": "BOOKING-1234" }, "can_email": false, "download_count": 1, "expires_at": "2000-01-01T12:00:00Z", "removed_by_guest": false, "joined_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ### Updates a guest's access `PATCH /api/v1/experiences/{experience_id}/guests/{id}.json` Sets when the guest loses access. Send a past time to end access now, or null so it never expires. Unless the organization has unlimited expiry, the time can be at most `expire_after_days` days from now, and null is refused when the experience sets `expire_after_days`. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | | `id` | integer | path | yes | | #### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `guest` | object | yes | | | `guest.expires_at` | date-time or null | no | | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `guest` | object | | | `guest.id` | integer | | | `guest.url` | string | | | `guest.code` | string | The code the guest joined with. | | `guest.code_kind` | string | One of: `guest`, `guide`, `limited`. | | `guest.details` | object | What the guest entered when the experience asks for it (`require_name`, `require_email`, ...). | | `guest.details.name` | string | | | `guest.details.email` | string | | | `guest.details.phone` | string | | | `guest.details.zip_code` | string | | | `guest.details.reference_id` | string | | | `guest.can_email` | boolean | The guest agreed to be emailed. | | `guest.download_count` | integer | | | `guest.expires_at` | date-time or null | When access ends. Null means it does not expire. | | `guest.removed_by_guest` | boolean | The guest removed the experience from the app. Entering the code again brings it back. | | `guest.joined_at` | date-time | | | `guest.updated_at` | date-time | | #### Errors - `422` Unreadable time #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X PATCH \ -H "Content-Type: application/json" \ -d '{ "guest": { "expires_at": "2000-01-01T12:00:00Z" } }' \ https://ridewithgps.com/api/v1/experiences/123/guests/123.json ``` #### Example response ```json { "guest": { "id": 123, "url": "https://ridewithgps.com/api/v1/experiences/123/guests/123.json", "code": "COAST2000", "code_kind": "guest", "details": { "name": "Alex Rider", "email": "alex@example.com", "phone": "+1 503 555 0100", "zip_code": "97209", "reference_id": "BOOKING-1234" }, "can_email": false, "download_count": 1, "expires_at": "2000-01-01T12:00:00Z", "removed_by_guest": false, "joined_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` ## Experience Messages ### Returns an experience's messages `GET /api/v1/experiences/{experience_id}/messages.json` Returns the messages sent to the guests of the experience, newest first. Requires messaging for the organization. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | | `page` | integer | query | no | Page number for pagination | | `page_size` | integer | query | no | Number of items per page (20-200) | #### Response `200` | Name | Type | Description | | --- | --- | --- | | `messages` | array of objects | | | `messages[].id` | integer | | | `messages[].content` | string | | | `messages[].created_at` | date-time | | | `messages[].updated_at` | date-time | | | `meta` | object | | | `meta.pagination` | object | | | `meta.pagination.record_count` | integer | Total number of records | | `meta.pagination.page_count` | integer | Total number of pages | | `meta.pagination.page_size` | integer | Number of records per page | | `meta.pagination.next_page_url` | string or null | URL for the next page (null if last page) | #### Errors - `403` Messaging is not enabled for the organization #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ https://ridewithgps.com/api/v1/experiences/123/messages.json ``` #### Example response ```json { "messages": [ { "id": 123, "content": "Meet in the hotel lobby at 8:00 for the day 2 briefing.", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } ], "meta": { "pagination": { "record_count": 45, "page_count": 3, "page_size": 20, "next_page_url": "https://ridewithgps.com/api/v1/experiences/123/messages.json?page=2" } } } ``` ### Sends a message `POST /api/v1/experiences/{experience_id}/messages.json` Sends a message to the experience's guests. Guests get a push notification and find the message in the app. #### Headers | Name | Type | Required | Description | | --- | --- | --- | --- | | `x-rwgps-api-key` | string | yes | API key for identifying the client application | | `x-rwgps-auth-token` | string | yes | Authentication token for the user | #### Parameters | Name | Type | In | Required | Description | | --- | --- | --- | --- | --- | | `experience_id` | integer | path | yes | | #### Request body (`application/json`) | Name | Type | Required | Description | | --- | --- | --- | --- | | `message` | object | yes | | | `message.content` | string | yes | | #### Response `201` | Name | Type | Description | | --- | --- | --- | | `message` | object | | | `message.id` | integer | | | `message.content` | string | | | `message.created_at` | date-time | | | `message.updated_at` | date-time | | #### Errors - `422` Empty message #### Example request ```bash curl \ -H "x-rwgps-api-key: $API_KEY" \ -H "x-rwgps-auth-token: $AUTH_TOKEN" \ -X POST \ -H "Content-Type: application/json" \ -d '{ "message": { "content": "Rain tomorrow: we start at 10:00 instead of 8:30." } }' \ https://ridewithgps.com/api/v1/experiences/123/messages.json ``` #### Example response ```json { "message": { "id": 123, "content": "Meet in the hotel lobby at 8:00 for the day 2 briefing.", "created_at": "2000-01-01T12:00:00Z", "updated_at": "2000-01-01T12:00:00Z" } } ``` --- # Publish a multi-day tour for your guests Source: https://ridewithgps.com/api/v1/doc/organizations/publish_tours.md 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. --- # Activity types Source: https://ridewithgps.com/api/v1/doc/reference/activity_types.md Routes use `activity_types` — an array of up to 3 values, included in the detailed route response. Trips use `activity_type` — a single string. The valid values differ between the two. ## Route activity types Valid route activity types: ``` cycling:generic cycling:road cycling:gravel cycling:mountain cycling:commute walking:generic walking:hiking running:generic driving:generic motorcycling:generic swimming:generic snow:generic ``` ## Trip activity type `activity_type` is a trip attribute whose value is determined from the trip FIT file, and/or by the gear associated with the trip. The owner can change it with `PUT /api/v1/trips/{id}.json` to any value below except `unknown:generic`. It takes one of the following values: ``` cycling:generic cycling:road cycling:gravel cycling:cyclocross cycling:mountain cycling:recumbent cycling:hand_cycling cycling:commute cycling:indoor cycling:virtual e_biking:generic e_biking:road e_biking:mountain running:generic running:road running:trail running:indoor walking:generic walking:hiking walking:indoor walking:speed swimming:generic swimming:lap swimming:open_water snow:generic snow:alpine_skiing snow:cross_country_skiing snow:snowboarding snow:snowshoeing driving:generic motorcycling:generic motorcycling:atv motorcycling:motocross training:generic training:strength training:cardio training:breathing training:yoga training:hiit other:generic unknown:generic ``` ## FIT sport and sub sport You can get more details on the activity from the `fit_sport` and `fit_sub_sport` trip attributes. They conform to the FIT specification, given here for reference: | Type | Value | Name | |------|-------|------| | sport | 0 | generic | | sport | 1 | running | | sport | 2 | cycling | | sport | 3 | transition | | sport | 4 | fitness_equipment | | sport | 5 | swimming | | sport | 6 | basketball | | sport | 7 | soccer | | sport | 8 | tennis | | sport | 9 | american_football | | sport | 10 | training | | sport | 11 | walking | | sport | 12 | cross_country_skiing | | sport | 13 | alpine_skiing | | sport | 14 | snowboarding | | sport | 15 | rowing | | sport | 16 | mountaineering | | sport | 17 | hiking | | sport | 18 | multisport | | sport | 19 | paddling | | sport | 20 | flying | | sport | 21 | e_biking | | sport | 22 | motorcycling | | sport | 23 | boating | | sport | 24 | driving | | sport | 25 | golf | | sport | 26 | hang_gliding | | sport | 27 | horseback_riding | | sport | 28 | hunting | | sport | 29 | fishing | | sport | 30 | inline_skating | | sport | 31 | rock_climbing | | sport | 32 | sailing | | sport | 33 | ice_skating | | sport | 34 | sky_diving | | sport | 35 | snowshoeing | | sport | 36 | snowmobiling | | sport | 37 | stand_up_paddleboarding | | sport | 38 | surfing | | sport | 39 | wakeboarding | | sport | 40 | water_skiing | | sport | 41 | kayaking | | sport | 42 | rafting | | sport | 43 | windsurfing | | sport | 44 | kitesurfing | | sport | 45 | tactical | | sport | 46 | jumpmaster | | sport | 47 | boxing | | sport | 48 | floor_climbing | | sport | 49 | baseball | | sport | 53 | diving | | sport | 62 | hiit | | sport | 64 | racket | | sport | 65 | wheelchair_push_walk | | sport | 66 | wheelchair_push_run | | sport | 67 | meditation | | sport | 69 | disc_golf | | sport | 71 | cricket | | sport | 72 | rugby | | sport | 73 | hockey | | sport | 74 | lacrosse | | sport | 75 | volleyball | | sport | 76 | water_tubing | | sport | 77 | wakesurfing | | sport | 80 | mixed_martial_arts | | sport | 82 | snorkeling | | sport | 83 | dance | | sport | 84 | jump_rope | | sport | 254 | all | | Type | Value | Name | Description | |------|-------|------|-------------| | sub_sport | 0 | generic | | | sub_sport | 1 | treadmill | Run/Fitness Equipment | | sub_sport | 2 | street | Run | | sub_sport | 3 | trail | Run | | sub_sport | 4 | track | Run | | sub_sport | 5 | spin | Cycling | | sub_sport | 6 | indoor_cycling | Cycling/Fitness Equipment | | sub_sport | 7 | road | Cycling | | sub_sport | 8 | mountain | Cycling | | sub_sport | 9 | downhill | Cycling | | sub_sport | 10 | recumbent | Cycling | | sub_sport | 11 | cyclocross | Cycling | | sub_sport | 12 | hand_cycling | Cycling | | sub_sport | 13 | track_cycling | Cycling | | sub_sport | 14 | indoor_rowing | Fitness Equipment | | sub_sport | 15 | elliptical | Fitness Equipment | | sub_sport | 16 | stair_climbing | Fitness Equipment | | sub_sport | 17 | lap_swimming | Swimming | | sub_sport | 18 | open_water | Swimming | | sub_sport | 19 | flexibility_training | Training | | sub_sport | 20 | strength_training | Training | | sub_sport | 21 | warm_up | Tennis | | sub_sport | 22 | match | Tennis | | sub_sport | 23 | exercise | Tennis | | sub_sport | 24 | challenge | | | sub_sport | 25 | indoor_skiing | Fitness Equipment | | sub_sport | 26 | cardio_training | Training | | sub_sport | 27 | indoor_walking | Walking/Fitness Equipment | | sub_sport | 28 | e_bike_fitness | E-Biking | | sub_sport | 29 | bmx | Cycling | | sub_sport | 30 | casual_walking | Walking | | sub_sport | 31 | speed_walking | Walking | | sub_sport | 32 | bike_to_run_transition | Transition | | sub_sport | 33 | run_to_bike_transition | Transition | | sub_sport | 34 | swim_to_bike_transition | Transition | | sub_sport | 35 | atv | Motorcycling | | sub_sport | 36 | motocross | Motorcycling | | sub_sport | 37 | backcountry | Alpine Skiing/Snowboarding | | sub_sport | 38 | resort | Alpine Skiing/Snowboarding | | sub_sport | 39 | rc_drone | Flying | | sub_sport | 40 | wingsuit | Flying | | sub_sport | 41 | whitewater | Kayaking/Rafting | | sub_sport | 42 | skate_skiing | Cross Country Skiing | | sub_sport | 43 | yoga | Training | | sub_sport | 44 | pilates | Fitness Equipment | | sub_sport | 45 | indoor_running | Run | | sub_sport | 46 | gravel_cycling | Cycling | | sub_sport | 47 | e_bike_mountain | Cycling | | sub_sport | 48 | commuting | Cycling | | sub_sport | 49 | mixed_surface | Cycling | | sub_sport | 50 | navigate | | | sub_sport | 51 | track_me | | | sub_sport | 52 | map | | | sub_sport | 53 | single_gas_diving | Diving | | sub_sport | 54 | multi_gas_diving | Diving | | sub_sport | 55 | gauge_diving | Diving | | sub_sport | 56 | apnea_diving | Diving | | sub_sport | 57 | apnea_hunting | Diving | | sub_sport | 58 | virtual_activity | | | sub_sport | 59 | obstacle | Used for events | | sub_sport | 62 | breathing | | | sub_sport | 65 | sail_race | Sailing | | sub_sport | 67 | ultra | Ultramarathon | | sub_sport | 68 | indoor_climbing | Climbing | | sub_sport | 69 | bouldering | Climbing | | sub_sport | 70 | hiit | High Intensity Interval Training | | sub_sport | 73 | amrap | HIIT | | sub_sport | 74 | emom | HIIT | | sub_sport | 75 | tabata | HIIT | | sub_sport | 84 | pickleball | Racket | | sub_sport | 85 | padel | Racket | | sub_sport | 86 | indoor_wheelchair_walk | | | sub_sport | 87 | indoor_wheelchair_run | | | sub_sport | 88 | indoor_hand_cycling | | | sub_sport | 94 | squash | | | sub_sport | 95 | badminton | | | sub_sport | 96 | racquetball | | | sub_sport | 97 | table_tennis | | | sub_sport | 110 | fly_canopy | Flying | | sub_sport | 111 | fly_paraglide | Flying | | sub_sport | 112 | fly_paramotor | Flying | | sub_sport | 113 | fly_pressurized | Flying | | sub_sport | 114 | fly_navigate | Flying | | sub_sport | 115 | fly_timer | Flying | | sub_sport | 116 | fly_altimeter | Flying | | sub_sport | 117 | fly_wx | Flying | | sub_sport | 118 | fly_vfr | Flying | | sub_sport | 119 | fly_ifr | Flying | | sub_sport | 254 | all | | --- # Points of interest attributes Source: https://ridewithgps.com/api/v1/doc/reference/points_of_interest.md `points_of_interest` is a route-only attribute, present when requesting the details of a route: Endpoint: [Returns the specified route](https://ridewithgps.com/api/v1/doc/endpoints/routes.md) ```json // GET https://ridewithgps.com/api/v1/routes/123.json // 200 - OK { "route": { "id": 123, // ... "points_of_interest": [ { "id": 1, "type": "convenience_store", "type_id": 24, "type_name": "Convenience Store", "name": "Seven Eleven", "description": "Get snacks on the way home", "url": null, "lat": 45.521529, "lng": -122.691804 }, // ... ] } } ``` They are exposed with one of the following `type`, `type_id` and `type_name`: | Type | Type ID | Type name | |:------------------- |:------- |:------------------ | | camping | 3 | Camping | | lodging | 10 | Lodging | | parking | 12 | Parking | | food | 13 | Food | | viewpoint | 14 | Viewpoint | | restroom | 15 | Restroom | | generic | 17 | Generic | | aid_station | 20 | Aid Station | | bar | 21 | Bar | | bike_shop | 22 | Bike Shop | | bike_parking | 23 | Bike Parking | | convenience_store | 24 | Convenience Store | | first_aid | 25 | First Aid | | hospital | 26 | Hospital | | rest_stop | 27 | Rest Stop | | trailhead | 28 | Trailhead | | geocache | 29 | Geocache | | water | 30 | Water | | control | 31 | Control | | winery | 32 | Winery | | start | 33 | Start | | stop | 34 | Stop | | finish | 35 | Finish | | atm | 36 | ATM | | caution | 37 | Caution | | coffee | 38 | Coffee | | ferry | 39 | Ferry | | gas | 40 | Gas Station | | library | 41 | Library | | monument | 42 | Monument | | park | 43 | Park | | segment_start | 44 | Segment Start | | segment_end | 45 | Segment End | | shopping | 46 | Shopping | | shower | 47 | Shower | | summit | 48 | Summit | | swimming | 49 | Swimming | | transit | 50 | Transit Center | | bikeshare | 51 | Bike Share | --- # Routes and trips attributes Source: https://ridewithgps.com/api/v1/doc/reference/routes_and_trips.md Attributes exposed by the API for routes and trips: | Attribute | Description | Type | Unit | Route | Trip | |:--------------------- |:------------------------------------------- |:------- |:----------------- |:-----:|:-----:| | `id` | Ride with GPS identifier | Integer | n/a | Y | Y | | `url` | Asset API URL | String | n/a | Y | Y | | `html_url` | Asset web page URL | String | n/a | Y | Y | | `name` | Name | String | n/a | Y | Y | | `visibility` | Visibility [^1] | String | n/a | Y | Y | | `description` | Description | String | n/a | Y | Y | | `departed_at` | Trip departed timestamp ISO 8601 | String | n/a | | Y | | `time_zone` | Timezone for `departed_at` | String | n/a | | Y | | `locality` | Locality of first track point | String | n/a | | Y | | `administrative_area` | Admin area of first track point | String | n/a | | Y | | `country_code` | Country of first track point | String | n/a | Y | Y | | `activity_types` | See [Activity types](https://ridewithgps.com/api/v1/doc/reference/activity_types.md) | Array | n/a | Y | | | `activity_type` | See [Activity types](https://ridewithgps.com/api/v1/doc/reference/activity_types.md) | String | n/a | | Y | | `fit_sport` | See [Fit sports](https://ridewithgps.com/api/v1/doc/reference/activity_types.md) | Integer | n/a | | Y | | `fit_sub_sport` | See [Fit sub sports](https://ridewithgps.com/api/v1/doc/reference/activity_types.md) | Integer | n/a | | Y | | `stationary` | Indicates a stationary trip | Boolean | n/a | | Y | | `distance` | Total distance | Integer | meters | Y | Y | | `duration` | Total duration | Integer | seconds | | Y | | `moving_time` | Moving time | Integer | seconds | | Y | | `elevation_gain` | Total elevation gain | Integer | meters | Y | Y | | `elevation_loss` | Total elevation loss | Integer | meters | Y | Y | | `first_lat` | First point latitude | Float | degrees | Y | Y | | `first_lng` | First point longitude | Float | degrees | Y | Y | | `last_lat` | Last point latitude [^6] | Float | degrees | Y | Y | | `last_lng` | Last point longitude [^6] | Float | degrees | Y | Y | | `sw_lat` | Track SW corner latitude | Float | degrees | Y | Y | | `sw_lng` | Track SW corner longitude | Float | degrees | Y | Y | | `ne_lat` | Track NE corner latitude | Float | degrees | Y | Y | | `ne_lng` | Track NE corner longitude | Float | degrees | Y | Y | | `track_type` | Type of track [^2] | String | n/a | Y | Y | | `terrain` | Type of terrain [^3] | String | n/a | Y | Y | | `difficulty` | Overall difficult [^4] | String | n/a | Y | Y | | `unpaved_pct` | Percentage of unpaved points | Integer | n/a | Y | | | `surface` | Surface type [^5] | String | n/a | Y | | | `avg_speed` | Average speed | Float | kilometers / hour | | Y | | `max_speed` | Maximum speed | Float | kilometers / hour | | Y | | `avg_cad` | Average cadence | Integer | rounds / minute | | Y | | `min_cad` | Minimum cadence | Integer | rounds / minute | | Y | | `max_cad` | Maximum cadence | Integer | rounds / minute | | Y | | `avg_hr` | Average heart rate | Integer | beats / minute | | Y | | `min_hr` | Minimum heart rate | Integer | beats / minute | | Y | | `max_hr` | Maximum heart rate | Integer | beats / minute | | Y | | `avg_watts` | Average power | Integer | watts | | Y | | `min_watts` | Minimum power | Integer | watts | | Y | | `max_watts` | Maximum power | Integer | watts | | Y | | `calories` | Calories burnt | Integer | calories | | Y | | `created_at` | Creation date ISO 8601 | String | n/a | Y | Y | | `updated_at` | Last update date ISO 8601 | String | n/a | Y | Y | | `archived` | Archived for the owner, null for others | Boolean | n/a | Y | | | `device` | Manufacturer and name of recording device | String | n/a | | Y | | `track_points` | See [Track points](https://ridewithgps.com/api/v1/doc/reference/track_points.md) | Array | n/a | Y | Y | | `course_points` | See [Course points](https://ridewithgps.com/api/v1/doc/reference/track_points.md) | Array | n/a | Y | | | `points_of_interest` | See [Points of interest](https://ridewithgps.com/api/v1/doc/reference/points_of_interest.md)| Array | n/a | Y | | > `activity_types`, `track_points`, `course_points` and `points_of_interest` are only given when requesting the record details. > They are not included in the responses of requests for collection of records. The owner can change `name`, `description`, `visibility` and `activity_types` (routes) or `activity_type` (trips) with `PUT /api/v1/routes/{id}.json` and `PUT /api/v1/trips/{id}.json`, and archive a route with `archived`. Other attributes, including the track, cannot be changed. [^1]: `visibility` is one of `public`, `followers_only`, `mutual_followers_only`, `private` (organizations use `public`, `members_only`, `managers_only`) [^2]: `track_type` is one of `loop`, `out_and_back`, `point_to_point`, `unknown` [^3]: `terrain` is one of `flat`, `rolling`, `climbing` [^4]: `difficulty` is one of `casual`, `easy`, `moderate`, `hard`, `multi_day` [^5]: `surface` is one of `paved`, `mostly_paved`, `mixed_surfaces`, `mostly_unpaved`, `unknown` [^6]: On trips, `last_lat` and `last_lng` are `null` when the track passes through a privacy zone, unless you own the trip or pass its `privacy_code` --- # Time zones Source: https://ridewithgps.com/api/v1/doc/reference/time_zones.md Time zones are names from the IANA time zone database, such as `America/Vancouver`. Any valid IANA name is accepted. These are the ones our time zone menus offer: ``` Africa/Algiers Africa/Cairo Africa/Casablanca Africa/Harare Africa/Johannesburg Africa/Monrovia Africa/Nairobi America/Argentina/Buenos_Aires America/Asuncion America/Bogota America/Caracas America/Chicago America/Chihuahua America/Denver America/Edmonton America/Guatemala America/Guyana America/Halifax America/Indiana/Indianapolis America/Inuvik America/Juneau America/La_Paz America/Lima America/Los_Angeles America/Mazatlan America/Mexico_City America/Monterrey America/Montevideo America/New_York America/Nuuk America/Phoenix America/Puerto_Rico America/Regina America/Santiago America/Sao_Paulo America/St_Johns America/Tijuana America/Vancouver America/Winnipeg Asia/Almaty Asia/Baghdad Asia/Baku Asia/Bangkok Asia/Chongqing Asia/Colombo Asia/Dhaka Asia/Hong_Kong Asia/Irkutsk Asia/Jakarta Asia/Jerusalem Asia/Kabul Asia/Kamchatka Asia/Karachi Asia/Kathmandu Asia/Kolkata Asia/Krasnoyarsk Asia/Kuala_Lumpur Asia/Kuwait Asia/Magadan Asia/Muscat Asia/Novosibirsk Asia/Rangoon Asia/Riyadh Asia/Seoul Asia/Shanghai Asia/Singapore Asia/Srednekolymsk Asia/Taipei Asia/Tashkent Asia/Tbilisi Asia/Tehran Asia/Tokyo Asia/Ulaanbaatar Asia/Urumqi Asia/Vladivostok Asia/Yakutsk Asia/Yekaterinburg Asia/Yerevan Atlantic/Azores Atlantic/Cape_Verde Atlantic/South_Georgia Australia/Adelaide Australia/Brisbane Australia/Canberra Australia/Darwin Australia/Hobart Australia/Melbourne Australia/Perth Australia/Sydney Etc/GMT+12 Etc/UTC Europe/Amsterdam Europe/Athens Europe/Belgrade Europe/Berlin Europe/Bratislava Europe/Brussels Europe/Bucharest Europe/Budapest Europe/Copenhagen Europe/Dublin Europe/Helsinki Europe/Istanbul Europe/Kaliningrad Europe/Kiev Europe/Lisbon Europe/Ljubljana Europe/London Europe/Madrid Europe/Minsk Europe/Moscow Europe/Paris Europe/Prague Europe/Riga Europe/Rome Europe/Samara Europe/Sarajevo Europe/Skopje Europe/Sofia Europe/Stockholm Europe/Tallinn Europe/Vienna Europe/Vilnius Europe/Volgograd Europe/Warsaw Europe/Zagreb Europe/Zurich Pacific/Apia Pacific/Auckland Pacific/Chatham Pacific/Fakaofo Pacific/Fiji Pacific/Guadalcanal Pacific/Guam Pacific/Honolulu Pacific/Majuro Pacific/Midway Pacific/Noumea Pacific/Pago_Pago Pacific/Port_Moresby Pacific/Tongatapu ``` --- # Track points and course points attributes Source: https://ridewithgps.com/api/v1/doc/reference/track_points.md A track is described by many track points, each track point having (usually) at least a longitude (`x`) and a latitude (`y`), so it can be drawn on a map. When a trip is recorded, the device (Ride with GPS mobile app or a bike computer) records track points at fixed frequency (at best 1Hz, 1 point per second) with their coordinates, and potentially many other attributes like the current speed, cadence, power or ambient temperature. When a route is planned, enough track points are recorded to properly describe the track. The route track points might also include attributes like elevation or surface type. Course points are present on routes only, they are the cues that form a cuesheet for the route. Course points have coordinates (`x` and `y`), but also directional attributes ("Turn left on 2nd avenue"). Course points are automatically generated for a route when it is auto-traced, and can also be customized by the user. **Attributes** Attributes exposed by the API for `course_points` and `track_points`: | Attribute | Description | Type | Unit | Route
track points | Route
course points | Trip
track points | |:---------- |:--------------------- |:------- |:----------------- |:---------------------:|:----------------------:|:--------------------:| | `x` | Longitude | Float | degrees | Y | Y | Y | | `y` | Latitude | Float | degrees | Y | Y | Y | | `d` | Distance from start | Float | meters | Y | Y | Y | | `e` | Elevation | Integer | meters | Y | | Y | | `S` | Surface type | Int | n/a | Y | | | | `R` | Highway tag | Int | n/a | Y | | | | `i` | Cue track index | Integer | n/a | | Y | | | `t` | Type of cue | String | n/a | | Y | | | `n` | Cue text | String | n/a | | Y | | | `_e` | User edited cue | Boolean | n/a | | Y | | | `t` | Unix epoch time | Int | seconds | | | Y | | `s` | Speed | Float | kilometers / hour | | | Y | | `T` | Temperature | Int | degrees celsius | | | Y | | `h` | Heart rate | Int | beats / minute | | | Y | | `c` | Cadence | Int | rounds / minute | | | Y | | `p` | Power output | Int | watts | | | Y | | `pb` | Power balance | Int | percent L/R | | | Y | | `lap` | Start of lap | Boolean | n/a | | | Y | | `k` | Exclude from metrics | Boolean | n/a | | | Y | | `m` | User modified | Boolean | n/a | | | Y | --- # Visibilities Source: https://ridewithgps.com/api/v1/doc/reference/visibilities.md Assets like routes, trips, events, and collections have a `visibility` attribute controlling who can access them. **User-owned assets:** * `public` - accessible to everyone * `followers_only` - accessible to the owner's followers * `mutual_followers_only` - accessible to followers the owner follows back * `private` - accessible only to the owner `mutual_followers_only` replaces `friends_only`. **Organization-owned assets:** * `public` - accessible to everyone * `members_only` - accessible only to organization members * `managers_only` - accessible only to organization managers Organizations have no follower levels: an organization asset set to `followers_only` or `mutual_followers_only` is stored as `members_only`. Route and trip updates accept only the values listed for the owner. --- # Guide page blocks Source: https://ridewithgps.com/api/v1/doc/reference/guide_page_blocks.md An experience's guide pages hold their content as a list of `blocks`. The guide page endpoints read and write the same list: a page you read and send back unchanged keeps its content, except for the limits listed at the end of this page. 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**. Coffee stop in [Greve](https://example.com)." }, { "type": "photo", "photo_id": 20800253, "on_tap": "enlarge" }, { "type": "route", "route_id": 123 }, { "type": "elevation_profile", "route_id": 123 }, { "type": "text", "markdown": "- Water at km 40\n- Lunch in Castellina" } ] } } ``` ## Block types | `type` | Fields you send | Fields added when you read | |---|---|---| | `text` | `markdown` | | | `photo` | `photo_id`, `on_tap` (`none`, `enlarge` or `open_link`, default `none`), `link_url` (with `open_link`) | `url` of the image | | `route` | `route_id` | `name`, `distance` and `elevation_gain` (meters) shown on the route card | | `elevation_profile` | `route_id` | | Photos must belong to your organization. Upload an image with `POST /api/v1/photos.json` and use the returned `id` as `photo_id`; use it in a page within 24 hours, because photos that nothing uses are deleted after that and a later save that names them gets a `422`. Routes must belong to your organization too. A photo or route the page already uses stays accepted, even if it belongs to someone else or was deleted, so a page read and sent back unchanged saves. Any other id is refused with a `422` that does not say whether the photo or route exists. Fields added when you read are ignored when you send them back. `link_url` and links in text must start with `http://`, `https://`, `mailto:` or `tel:`. A text block's `markdown` can be at most 1,000,000 characters. ## Markdown in text blocks A blank line starts a new paragraph. Each additional blank line adds an empty paragraph, which shows as extra space in the app. | Write | For | |---|---| | `# Title`, `## Title`, `### Title` | Headings. Deeper headings become `###`. | | `**bold**` | Bold | | `*italic*` | Italic | | `underline` | Underline | | `[text](https://example.com)` | Link. Bold, italic and underline work inside the text. | | `- item`, `* item` or `+ item` | Bullet list item | | `1. item` or `1) item` | Numbered list item. The app numbers the items itself. | | `---`, `***` or `___` alone on a line | Separator line | | a single line break | Stays inside the same paragraph or list item. The app shows it as a space. | Put a backslash before a character to write it as text: `\*`, `\[`, `\]`, `\\`, and `\`. A `*` or `` without its closing pair is written as text. When you read a page, these characters come back with their backslash, and a line that would read as a heading, list item or separator starts with a backslash: `\# not a heading`. Other HTML tags, such as ``, are not supported and are kept as plain text. Underscores (`_text_`), code, quotes, tables and images in Markdown are not supported either and are kept as plain text. Use a `photo` block for images. ## Limits These parts of a page made in the web editor are not kept when the page is read and sent back: - **Nested list indents.** Indented list items become top-level list items. Indenting a list item in Markdown does not nest it either. - **Line breaks at the start or end of a paragraph**, and a blank line inside a paragraph, which becomes two paragraphs. The app shows line breaks as spaces, so this rarely changes how a page looks. - **Links whose URL does not start with `http://`, `https://`, `mailto:` or `tel:`.** Their text is read as plain text, and a photo with such a link reads as `on_tap: "none"`. - **Images pasted into text.** They show as a 📷 character, which is kept, but the image itself is not. The app does not show these images today. --- # Logos and buttons Source: https://ridewithgps.com/api/v1/doc/reference/logos_and_assets.md When integrating with Ride with GPS, please use our official logos and brand assets to ensure a consistent experience for users. ## Official Logos Our logos are available in multiple formats at `/images/logos/`: | Logo | Path | Use Case | |------|------|----------| | Horizontal logo | `/images/logos/horizontal-logo.svg` | Default for light backgrounds | | Horizontal logo (white) | `/images/logos/horizontal-logo-white.svg` | For dark backgrounds | | Vertical logo | `/images/logos/vertical-logo.svg` | When horizontal space is limited | | Cyclist icon | `/images/logos/cyclist-logo-small.svg` | Compact branding, favicons | ## Usage Guidelines - **Do** use the official logos as provided - **Do** maintain aspect ratio when scaling - **Do** provide adequate whitespace around logos - **Don't** modify colors or add effects - **Don't** combine with other logos without approval ## Examples for Inspiration Here are some examples of how to build a "Connect with Ride with GPS" UI element. ### Simple Button A straightforward button with our logo: RWGPS Connect with Ride with GPS ```html RWGPS Connect with Ride with GPS ``` ### Dual Logo Integration Display both logos with bidirectional arrows to clearly communicate the integration:
Your Logo
⇄ RWGPS
Connect with Ride with GPS
```html
Your App ⇄ RWGPS
Connect with Ride with GPS
``` ## Media Kit For additional brand assets, guidelines, and high-resolution files, download our Media Kit. ## Questions? Contact us at [developers@ridewithgps.com](mailto:developers@ridewithgps.com) for brand usage questions.