Creating observations in v2 API doesn’t support multiple observation fields

Platform: API

App version number, if a mobile app issue: N/A

Browser, if a website issue: N/A / any HTTP client

URLs (aka web addresses) of any relevant observations or pages: https://api.inaturalist.org/v2/observations

Screenshots of what you are seeing:

Description of problem:

In the v1 API, POST /observations works with an array of observation fields:

curl -X POST "https://api.inaturalist.org/v1/observations" \
  -H "Authorization: Bearer $access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "observation": {
      "taxon_id": 12727,
      "observed_on_string": "2026-02-09",
      "time_zone": "America/New_York",
      "description": "Test observation, please ignore",
      "observation_field_values_attributes": [
          {"observation_field_id": 297, "value": 3},
          {"observation_field_id": 816, "value": 1},
          {"observation_field_id": 821, "value": 2}
      ]
    }
  }'

However, the same request fails in the v2 API:

curl -X POST "https://api.inaturalist.org/v2/observations" \
  -H "Authorization: Bearer $access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "observation": {
      "taxon_id": 12727,
      "observed_on_string": "2026-02-09",
      "time_zone": "America/New_York",
      "description": "Test observation, please ignore",
      "observation_field_values_attributes": [
          {"observation_field_id": 297, "value": 3},
          {"observation_field_id": 816, "value": 1},
          {"observation_field_id": 821, "value": 2}
      ]
    }
  }'
{"status":422,"errors":[{"path":"observation.observation_field_values_attributes","message":"must be object","instancePath":"/body/observation/observation_field_values_attributes","params":{"type":"object"}}]}

The schema here defines observation_field_values_attributes as a single object rather than an array. The Rails backend does support multiple objects, though, so this seems to just be a schema/validation bug.

The workaround is to make multiple calls to POST /observation_field_values, but that’s quite a bit less convenient than the v1 API. If this is intended behavior, feel free to move this to feature requests instead. Thanks!

4 Likes