Upload trail file
Deprecated
POST
/api/v1/trail/{id}/file
const url = 'https://example.com/api/v1/trail/example/file';const form = new FormData();form.append('name', 'example');form.append('description', 'example');form.append('location', 'example');form.append('date', '2026-04-15');form.append('public', 'true');form.append('completed', 'true');form.append('completed_at', '2026-04-15T12:00:00Z');form.append('difficulty', 'easy');form.append('lat', '1');form.append('lon', '1');form.append('distance', '1');form.append('elevation_gain', '1');form.append('elevation_loss', '1');form.append('duration', '1');form.append('photos', 'example');form.append('photos-', 'example');form.append('photos+', 'example');form.append('thumbnail', '1');form.append('like_count', '0');form.append('category', 'example');form.append('subcategory', 'example');form.append('tags', 'example');form.append('gpx', 'example');
const options = {method: 'POST'};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/trail/example/file \ --header 'Content-Type: multipart/form-data' \ --form name=example \ --form description=example \ --form location=example \ --form date=2026-04-15 \ --form public=true \ --form completed=true \ --form completed_at=2026-04-15T12:00:00Z \ --form difficulty=easy \ --form lat=1 \ --form lon=1 \ --form distance=1 \ --form elevation_gain=1 \ --form elevation_loss=1 \ --form duration=1 \ --form photos=example \ --form photos-=example \ --form 'photos+=example' \ --form thumbnail=1 \ --form like_count=0 \ --form category=example \ --form subcategory=example \ --form tags=example \ --form gpx=exampleDeprecated alias of POST /api/v1/trail/form/{id}, which accepts the same multipart body and is the endpoint to use. Kept for compatibility; behaves like the form endpoint, except that a body without a gpx or photos part (PocketBase’s +/- modifiers are accepted) is rejected with 400 missing_file instead of being applied as a no-op.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
string
Request Bodyrequired
Section titled “Request Bodyrequired”Media typemultipart/form-data
object
name
string
description
string
location
string
date
string format: date
public
boolean
completed
boolean
completed_at
string format: date-time
difficulty
string
lat
number
lon
number
distance
number
elevation_gain
number
elevation_loss
number
duration
number
photos
Array<string>
photos-
Remove photo by name
string
photos+
Add photo by name
string
thumbnail
integer
like_count
integer
category
string
subcategory
string
tags
Array<string>
gpx
string
Responses
Section titled “Responses”Trail updated
Media typeapplication/json
object
id
required
Trail ID (15 chars)
string
name
required
Trail name
string
description
string
location
string
author
required
Author user ID
string
date
string format: date
public
required
boolean
completed
required
boolean
completed_at
string format: date-time
difficulty
string
lat
number
lon
number
distance
Distance in meters
number
elevation_gain
Elevation gain in meters
number
elevation_loss
Elevation loss in meters
number
duration
Duration in seconds
number
photos
Array<string>
thumbnail
Index of thumbnail photo
integer
like_count
integer
category
Category ID (15 chars)
string
subcategory
Subcategory ID (15 chars)
string
tags
Array<string>
gpx
GPX file path
string
created
string format: date-time
updated
string format: date-time
Example
{ "difficulty": "easy", "like_count": 0}Bad Request (no gpx or photos part in the body, invalid id, or body id differs from the path)
Not Found
Internal Server Error