Rodnik.today

Rodnik.today API v1

An open JSON API for the Rodnik.today mobile app and for anyone who builds apps, scripts or research on top of Rodnik data. It uses Laravel API Resources and Sanctum bearer tokens. Reading is public; contributing requires an account.

Contract summary

  • Base URL: https://rodnik.today/api/v1
  • Success envelope: a top-level data property, except for 204 No Content. Paginated lists add links and meta.
  • Dates: YYYY-MM-DD. Timestamps use ISO 8601 in UTC.
  • Authentication: Authorization: Bearer TOKEN.
  • Token lifetime: tokens do not expire automatically; logout revokes the current token.
  • Content type: send Accept: application/json; send Content-Type: application/json for JSON bodies.
  • CORS: requests from any origin are allowed, so the API can also be used from a browser.
  • Data: user reports are in the public domain; source locations largely come from OpenStreetMap (ODbL). See licensing details.

Endpoints

MethodPathAuthenticationSuccess
POST/auth/registerNo201
POST/auth/tokenNo200
DELETE/auth/tokenRequired204
GET/meRequired200
DELETE/meRequired204
GET/springs/{spring}No200
POST/springsRequired201
GET/users/{user}/reportsOptional200
POST/reportsRequired201
PATCH/reports/{report}Owner200
DELETE/reports/{report}Owner204
POST/reports/{report}/photosOwner201
DELETE/photos/{photo}Owner204

Rate limits

Limits protect the map from spam. When one is exceeded the API responds with 429 and a Retry-After header in seconds.

EndpointLimit
All endpoints600 requests per minute per user or IP address
POST /auth/token5 attempts per minute per email and IP address
POST /auth/register3 new accounts per hour per IP address; failed attempts only count towards 10 per minute
POST /springs30 new sources per hour per user
POST /reports30 new reports per hour per user

Create the report before uploading photos. A report is the owning server resource; photos cannot exist in the API without its ID. Keep the form and selected images as a local draft until the report request succeeds.

  1. Prepare a local draft. Store the report fields and local image references on the device. Do not upload temporary photos and do not include images in POST /reports.
  2. Create the report. Send POST /reports as JSON. Disable duplicate submit actions while this request is in progress.
  3. Persist the returned report ID. After 201 Created, immediately save data.id in the local draft before starting any upload. From this point onward, resume the existing server report; do not create another report when a photo fails.
  4. Upload photos sequentially in the desired display order. Send one multipart request to POST /reports/{report}/photos at a time. The server assigns photo order by successful arrival, so parallel uploads may produce a different order.
  5. Persist each returned photo ID. Mark a local image as uploaded only after its 201 Created response and store data.id for deletion or reconciliation.
  6. Complete and refresh. When no local photos remain pending, request GET /springs/{spring} and replace local server-derived data with the response.

Client state model

StateStored locallyNext action
local_draftFields and local image referencesPOST /reports
report_createdReport ID and pending imagesUpload the first pending photo
uploading_photosReport ID, uploaded photo IDs, pending imagesContinue sequential uploads
needs_attentionAll identifiers and the last errorCorrect, reconcile, or retry
completeReport ID and photo IDsRefresh the spring and clear temporary files

Persist this state across app restarts. If the app closes after the report is created, resume photo uploads using the saved report ID. If the user cancels after creation, call DELETE /reports/{report} to hide the incomplete report.

Partial success and recovery

  • A failed report request leaves the local draft unchanged.
  • A failed photo request does not roll back the report or photos that were already uploaded.
  • For 422, correct the indicated fields or image; repeating the same request will fail again.
  • For 401, stop the queue, remove the rejected local token, and ask the user to log in again.
  • For 403 or 404, stop automatic retries and refresh the spring because ownership or visibility may have changed.
  • For 429, honor the Retry-After header before continuing the queue.
  • For an offline error, retain the draft and pending queue and resume when connectivity returns.

Version 1 has no idempotency key. If a connection drops after a POST may have reached the server, do not retry it blindly. First refresh GET /springs/{spring} and reconcile the report or photo with server state; otherwise a retry may create a duplicate.

Accounts and authentication

Register

curl -X POST 'https://rodnik.today/api/v1/auth/register' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Example User",
    "email": "user@example.com",
    "password": "example-password",
    "device_name": "Example phone",
    "locale": "en"
  }'

Creates an account and signs it in on this device. The rules for name, email and password are the same as on the website. locale is optional (en or ru) and sets the language of emails and notifications.

The 201 response has the same shape as POST /auth/token below, so the app is signed in right away. All invalid fields are reported together in one 422 response.

Create a token

curl -X POST 'https://rodnik.today/api/v1/auth/token' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "user@example.com",
    "password": "example-password",
    "device_name": "Example phone"
  }'
{
  "data": {
    "token": "1|plain-text-token-returned-once",
    "token_type": "Bearer",
    "user": {
      "id": 42,
      "name": "Example User",
      "email": "user@example.com",
      "locale": "en",
      "rating": 12,
      "profile_photo_url": "https://example.test/profile-photo.jpg"
    }
  }
}

Store the token in the operating system Keychain or Keystore. Never log it or place it in a URL.

Current user

curl 'https://rodnik.today/api/v1/me' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer TOKEN'

The response is the same user object under data.

Revoke the current token

curl -X DELETE 'https://rodnik.today/api/v1/auth/token' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer TOKEN'

This revokes only the token used by the request. Other devices remain signed in.

Delete the account

curl -X DELETE 'https://rodnik.today/api/v1/me' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer TOKEN' \
  -d '{"password": "example-password"}'

Permanently deletes the account after checking the current password, exactly like the profile page on the website: all tokens are revoked, maps and tracks are deleted, and reports and photos stay on the map without the author's name. This cannot be undone. A wrong password returns 422 with an error for password.

Sources

Get a source

GET /springs/{spring}

This public endpoint returns the source (internally called a “spring”), all visible user reports, and each report's photos in one request. Hidden and OpenStreetMap-imported reports are omitted. Reports are newest first by visit date; photos use their saved order.

{
  "data": {
    "id": 123,
    "name": "Forest spring",
    "type": "Spring",
    "latitude": 55.7558,
    "longitude": 37.6173,
    "intermittent": "no",
    "water_score": 1,
    "not_found": false,
    "reports_count": 1,
    "reports": [
      {
        "id": 456,
        "spring_id": 123,
        "visited_at": "2026-08-15",
        "state": "running",
        "quality": "good",
        "access_limited": false,
        "littered": false,
        "broken": false,
        "comment": "Clear and flowing.",
        "author": {
          "id": 42,
          "name": "Example User",
          "profile_photo_url": "https://example.test/profile-photo.jpg"
        },
        "created_at": "2026-08-15T10:00:00.000000Z",
        "updated_at": "2026-08-15T10:00:00.000000Z",
        "photos": [
          {
            "id": 789,
            "url": "https://example.test/photos/789.jpg",
            "width": 1280,
            "height": 960
          }
        ]
      }
    ]
  }
}

state is running, dripping, dry, notfound, or null. quality is good, uncertain, bad, or null. Historical anonymous reports have author: null.

A hidden source returns 404. A merged source returns 308 with a Location header for the canonical source.

Add a source

curl -X POST 'https://rodnik.today/api/v1/springs' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer TOKEN' \
  -d '{
    "latitude": 55.7558,
    "longitude": 37.6173,
    "name": "Forest spring",
    "type": "Spring"
  }'

Adds a new water source at the given coordinates. Only latitude and longitude are required. name is free text up to 255 characters; type is one of: Spring, Water well, Water tap, Drinking water source, Fountain, Water source.

The 201 response contains the new source in the same format as GET /springs/{spring}, with country, region and nearest city filled in, but without reports. Use its id as spring_id to add the first report.

Before adding, check the map for an existing source nearby: the API does not detect duplicates.

Map discovery

A map may reuse the public vector-style JSON tile feed at https://rodnik.today/tiles/{z}/{x}/{y}.json, then request the source endpoint when a user selects a point. There is no separate paginated source-list endpoint in v1.

Reports

List a user's reports

curl 'https://rodnik.today/api/v1/users/42/reports?page=1' \
  -H 'Accept: application/json'
{
  "data": [
    {
      "id": 456,
      "spring_id": 123,
      "spring": {
        "id": 123,
        "name": "Forest spring",
        "type": "Spring",
        "latitude": 55.7558,
        "longitude": 37.6173
      },
      "visited_at": "2026-08-15",
      "state": "running",
      "quality": "good",
      "...": "the same report fields as above",
      "photos": []
    }
  ],
  "links": {
    "first": "https://rodnik.today/api/v1/users/42/reports?page=1",
    "last": "https://rodnik.today/api/v1/users/42/reports?page=3",
    "prev": null,
    "next": "https://rodnik.today/api/v1/users/42/reports?page=2"
  },
  "meta": {
    "current_page": 1,
    "last_page": 3,
    "per_page": 50,
    "total": 128
  }
}

This public endpoint returns a user's visible reports, newest first, 50 per page. Pass ?page=N for the next pages. Each report also has a short spring block with the source's id, name, type and coordinates.

Reports on hidden sources are only included when the request carries the token of that user or of a moderator. An unknown user returns 404.

Create

curl -X POST 'https://rodnik.today/api/v1/reports' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer TOKEN' \
  -d '{
    "spring_id": 123,
    "visited_at": "2026-08-15",
    "timezone": "Europe/Moscow",
    "state": "running",
    "quality": "good",
    "access_limited": false,
    "littered": false,
    "broken": false,
    "comment": "Clear and flowing."
  }'

The 201 response contains the created report under data, initially with photos: [].

Update

PATCH /reports/{report}

Send any subset of visited_at, timezone, state, quality, access_limited, littered, broken, and comment. Ownership, source, visibility, and OpenStreetMap fields cannot be changed.

Hide

DELETE /reports/{report}

Deleting a report is a soft hide. The report and photos are retained but disappear from public responses. Repeating the request is safe and returns 204.

Normalization

  • dry and notfound always clear quality.
  • notfound also clears access_limited, littered, and broken.
  • visited_at cannot be later than the current date in the supplied IANA timezone.

Photos

Follow the recommended save workflow: create the report first, persist its ID, then upload each photo separately and sequentially. This provides independent progress and recovery without temporary server uploads.

curl -X POST 'https://rodnik.today/api/v1/reports/456/photos' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer TOKEN' \
  -F 'photo=@spring.jpg' \
  -F 'latitude=55.7558' \
  -F 'longitude=37.6173'

One JPEG, PNG, or WebP image is accepted per request, up to 10 MB. It is oriented, resized to fit within 1280 × 1280, converted to JPEG, attached immediately, and returned under data with id, url, width, and height.

DELETE /photos/{photo}

Photo deletion removes both the database record and stored file. Only the report owner may upload or delete its photos.

Errors

StatusMeaning
401Bearer token is missing, invalid, or revoked.
403The authenticated user does not own the report or photo.
404The resource does not exist or is not publicly available.
422Validation or credentials failed.
429The request rate limit was exceeded.
{
  "message": "The given data was invalid.",
  "errors": {
    "visited_at": ["The visit date cannot be in the future."]
  }
}

Clients should use the HTTP status and field keys, not parse human-readable message text. Messages follow the server's default language.

API client best practices

  • Secure tokens: keep tokens only in Keychain or Keystore, never application logs, analytics, URLs, or ordinary preferences.
  • One token per installation: use a recognizable device_name; revoke the current token during logout before deleting it locally.
  • Explicit JSON: always send Accept: application/json and use the HTTP status plus stable field keys for decisions.
  • Server authority: after a successful mutation, use the returned resource and later source response instead of assuming the server stored the submitted values unchanged.
  • Normalization: expect the server to clear incompatible quality and problem fields for dry and notfound.
  • Dates: send the user's current IANA timezone with visited_at so date validation follows the user's local day.
  • Images: resize or compress large images before upload to reduce mobile bandwidth, but still handle server-side conversion and returned dimensions.
  • Local cleanup: delete temporary local image copies only after their photo IDs have been persisted or the user deliberately discards the draft.
  • Redirects: when a source response is 308, persist and use the canonical source ID from the Location URL.
  • Be gentle: cache responses where you can and do not crawl every source; use the data exports for bulk downloads.