API reference (OpenAPI)
Browse every REST endpoint, its parameters, request bodies and responses. The schema is generated from the backend code at documentation build time, so it always matches the released version.
Each operation declares the errors it can answer (400, 401, 403, 404, 409, 412, 413, 415, 428, 429, 503) as problem documents, the headers it sends (ETag, Location, Content-Location, Retry-After, and X-RateLimit-Limit and X-RateLimit-Remaining on 429) and whether it requires If-Match. Every path starts with the API root, /api/v1. Each operation's operationId is the name of its handler (read_users_me), which does not change when the route moves; a generated client names its methods after it. A description is the prose of the handler's docstring. An operation lists the credentials it accepts: the bearer token (HTTPBearer), the X-API-Key header (ApiKey, on every authenticated operation, with the same scopes; a key reaches only the operations whose scopes it can hold) and, on POST /auth/refresh and POST /auth/logout, the refresh cookie (RefreshTokenCookie). Only the six session operations under /auth declare X-Client-Type as a header parameter (see Handling authentication). The ?api_key= query parameter is not listed because it is off by default; see API keys.
Users have one item URL, GET /users/{user_id}, and one list, GET /users. A token with users:read-all (an administrator) gets the full record with its ETag, and a token with only users:read gets the public projection (id, name, username, city, photo_path) of a user who is active and has been approved. The list filters by username (an exact name, of any length from 1 character) and username_contains (at least 3 characters), and an administrator also by active, email_verified, pending_approval, external_auth (each true or false; external_auth=false keeps the users with a local password only); a regular token that sends one of those four gets 403. A regular token must send username or username_contains, so a list with neither is 422 (a username_contains shorter than 3 characters is 422 too); only users:read-all lists every user. A regular token's list leaves out users who switched off "Let others find me in search". A user's profile page data is GET /users/{user_id}/overview. POST /users and PATCH /users/{user_id} answer 422 when the body contains pending_admin_approval: a read carries the flag, and an administrator approves a pending user only through POST /users/{user_id}/approve, which needs no step-up and requires a verified email while verification is required.
PATCH /users/{user_id} is a partial edit: it changes only the fields the body carries and keeps the rest, so a client sends only what it changes (and step_up when the change needs one). name, username, email, access_type and active can be left out but not sent as null (422). A changed email is applied at once only when the same body also sends email_verified: true; otherwise it is requested and confirmed through a link sent to the new address. An edit that sets active to true on a user who awaits approval is 409 with urn:endurain:error:approval-pending: approve them with POST /users/{user_id}/approve. A changed email that is applied without email_verified: true (because outgoing email is not configured) is stored with email_verified set to false.
Following a user is POST /users/{user_id}/followers; it always creates a pending request. The follow requests addressed to you are under /profile/follow-requests: GET /profile/follow-requests lists them, POST /profile/follow-requests/{follower_id}/accept accepts one (answers the accepted relationship) and DELETE /profile/follow-requests/{follower_id} declines it. Reading needs followers:read and the writes followers:write.
After you decline a request, the same user cannot ask you again for 7 days: their POST /users/{user_id}/followers answers 429 with Retry-After. Your block list is GET /profile/blocked-users (a page of public profiles, newest block first), PUT /profile/blocked-users/{user_id} to block and DELETE /profile/blocked-users/{user_id} to unblock (404 when that user is not blocked). Blocking answers 204 for any other user id, whether or not the account exists, and 422 for your own id. It removes every follow between you and that user, pending requests included, without notifying them. Following a user you blocked answers 409. A blocked user's follow request answers the same 404 as a request to a user who cannot be followed. GET /users/{user_id}/relationship carries is_blocked, whether you blocked that user. A block list is not part of the profile export.
GET /notifications lists your notifications, newest first, as {"items": [...], "num_records": <int>, "next_cursor": <string or null>}. num_records is the slice size (1 to 200, default 25). Send the next_cursor of a slice as cursor to get the following one; it is null on the last slice. The cursor is opaque and names the last notification you saw, so a notification created between two requests does not shift or repeat any row, and the response has no total. unread_only=true keeps only the unread ones; send the same value with every request of one walk. GET /notifications/unread-count answers {"count": <int>} with the number of unread ones; it needs notifications:read.
DELETE /notifications/{notification_id} deletes one of your notifications (204, or 404 when it is not yours). POST /notifications/read with {"ids": [...]} (1 to 100 ids) marks those as read and answers 204; an id that is not yours is skipped. Sent without a body it marks every unread notification. Both need notifications:write.
A notification's options depend on its type, and the schema names each shape (the notification is a union discriminated by type):
type |
options |
|---|---|
new_activity, duplicate_activity |
activity_id |
new_follower_request, new_follower_request_accepted, admin_new_sign_up_approval_request, admin_user_promoted |
user_id (a UUID string), user_name, user_username |
garmin_token_expired, strava_data_deleted |
none (an empty object) |
strava_token_expired |
delete_on (a date), only when Strava access was revoked |
idp_linked |
idp_id, idp_name (null when the provider was deleted since) |
account_security_changed |
change, and idp_id and idp_name for an unlink, backup_codes_remaining for a used backup code, access_type for a role change |
new_device_sign_in |
browser, operating_system, ip_address |
For authentication, scopes, errors and rate limits see the other pages in this section. Requests cannot be sent from this page. An Endurain instance serves the schema (/openapi.json) and its interactive pages (/api/v1/docs, /api/v1/redoc) only when ENVIRONMENT is development or demo; in production the schema is not served and this reference holds it.