---
title: "Returns all infra objects of some type according to a hierarchical query."
method: POST
path: "/search"
tags: ["search"]
---

# Returns all infra objects of some type according to a hierarchical query.

`POST /search`

# Payload

    {
        "object": string,
        "query": query,
        "dry": boolean, # default: false
    }

Where:
- `object` can be any search object declared in `search.yml`
- `query` is a JSON document which can be deserialized into a [search::SearchAst].
  Check out examples below.

# Response

The response structure depends on the `object`.

# Query language

The query itself is defined using a language made up of nested JSON arrays.
It will be parsed and transformed into a PostgreSQL WHERE statement.
The language consist of a single boolean expression of comparison statements
in prefix notation. For example, the query `["like", ["name"], "%ari%"]`
will generate a WHERE statement like `WHERE "name" LIKE '%ari%'`.
For more information on the query language itself, check out examples below.

# Available functions

See [search::create_processing_context()].

# A few query examples

* The railway station PNO: `["=", ["trigram"], "pno"]`
* The railway stations with either "Paris" or "Lyon" (or both) in their name:
  `["or", ["search", ["name"], "Paris"], ["search", ["name"], "Lyon"]]`
* All railway stations with "Paris" in their name but not PNO :
  `["and", ["search", ["name"], "Paris"], ["not", ["=", ["trigram"], "pno"]]]`

See [search::SearchAst] for a more detailed view of the query language.

## Query parameters

- `page` integer
- `page_size` integer

## Request body

- SearchPayload — The payload of a search request
  - `dry` boolean — Whether to return the SQL query instead of executing it Only available in debug builds.
  - `object` 'track' | 'signal' | 'project' | 'study' | 'scenario' | 'trainschedule' | 'operationalpoint' | 'user', required — Object type for query search
  - `query` union, required — A search query
    - boolean
    - number, double
    - integer
    - string
    - object

## Response `200`

The search results

- SearchResultItem[]
  - union — A search result item that depends on the query's `object`
    - SearchResultItemTrack — A search result item for a query with `object = "track"`
      - `infra_id` integer, required
      - `line_code` integer, required
      - `line_name` string, required
    - SearchResultItemOperationalPoint — A search result item for a query with `object = "operationalpoint"`
      - `country_code` string, required
      - `geographic` GeoJsonPoint
        - `coordinates` number[], required
        - `type` 'Point', required
      - `infra_id` integer, required
      - `is_passenger_station` boolean, required
      - `main_code` string, required
      - `name` string, required
      - `obj_id` string, required
      - `secondary_code` string, nullable
      - `secondary_name` string, nullable
      - `track_sections` SearchResultItemOperationalPointTrackSections[], required
        - `position` number, double, required
        - `track` string, required
      - `uic` integer, nullable
    - SearchResultItemSignal — A search result item for a query with `object = "signal"`
      - `geographic` GeoJsonPoint, required
        - `coordinates` number[], required
        - `type` 'Point', required
      - `infra_id` integer, required
      - `label` string, required
      - `line_code` integer, required
      - `line_name` string, required
      - `obj_id` string, required
      - `settings` string[], required
      - `signaling_systems` string[], required
      - `sprite` string, nullable
      - `sprite_signaling_system` string, nullable
    - SearchResultItemProject — A search result item for a query with `object = "project"`
      - `description` string, required
      - `id` integer, required
      - `image` integer, nullable, required
      - `last_modification` string, date-time, required
      - `name` string, required
      - `studies_count` integer, required
      - `tags` string[], required
    - SearchResultItemStudy — A search result item for a query with `object = "study"`
      - `budget` integer, nullable, required
      - `business_code` string, nullable, required
      - `description` string, nullable, required
      - `id` integer, required
      - `last_modification` string, date-time, required
      - `name` string, required
      - `project_id` integer, required
      - `scenarios_count` integer, required
      - `service_code` string, nullable, required
      - `study_type` string, nullable, required
      - `tags` string[], required
    - SearchResultItemScenario — A search result item for a query with `object = "scenario"`
      - `description` string, required
      - `electrical_profile_set_id` integer, nullable, required
      - `id` integer, required
      - `infra_id` integer, required
      - `infra_name` string, required
      - `last_modification` string, date-time, required
      - `name` string, required
      - `study_id` integer, required
      - `tags` string[], required
      - `train_schedules_count` integer, required
    - SearchResultItemTrainSchedule — A search result item for a query with `object = "trainschedule"`
      - `comfort` integer, required
      - `constraint_distribution` integer, required
      - `id` integer, required
      - `initial_speed` number, double, required
      - `labels` string[], required
      - `margins` Margins, required
        - `boundaries` NonBlankString[], required
        - `values` string[], required — The values of the margins. Must contains one more element than the boundaries Can be a percentage `X%` or a time in minutes per 100 kilometer `Xmin/100km`
      - `options` TrainScheduleOptions, required
        - `stops_at_end_of_block` boolean
        - `use_electrical_profiles` boolean
        - `use_speed_limits_for_simulation` boolean
      - `path` PathItem[], required
        - `id` string, required — The unique identifier of the path item. This is used to reference path items in the train schedule.
        - `location` union, required — The location of a path waypoint
          - object
            - `offset` integer, required — Offset in mm
            - `track` string, required — Track section identifier
            - `type` 'track_offset', required
          - object
            - `local_track_name` string, nullable
            - `operational_point` union, required
              - …
            - `type` 'operational_point_part_reference', required
      - `power_restrictions` PowerRestrictionItem[], required
        - `from` string, required
        - `to` string, required
        - `value` string, required
      - `rolling_stock_name` string, required
      - `schedule` ScheduleItem[], required
        - `arrival` string, duration — Duration in ISO 8601 format (e.g. PT2H for 2 hours)
        - `at` string, required — Position on the path of the schedule item.
        - `reception_signal` 'OPEN' | 'STOP' | 'SHORT_SLIP_STOP' — State of the signal where the train is received for its stop. For (important) details, see <https://osrd.fr/en/docs/reference/design-docs/timetable/#modifiable-fields>.
        - `reference_base_arrival` string, duration — Duration in ISO 8601 format (e.g. PT2H for 2 hours)
        - `reference_position` integer, nullable
        - `stop_for` string, duration — Duration in ISO 8601 format (e.g. PT2H for 2 hours)
      - `speed_limit_tag` string, nullable
      - `start_time` integer, required — For calendar timetables: elapsed ms since 1970-01-01T00:00:00Z. For hourly timetables: elapsed ms since the timetable start.
      - `train_name` string, required
      - `train_schedule_set_id` integer, required
    - SearchResultItemUser — A search result item for a query with `object = "user"`
      - `id` integer, required
      - `name` string, required

---

[API](https://skmtc.net/openrailassociation/apis/osrd-editoast.md) · [All operations](https://skmtc.net/openrailassociation/apis/osrd-editoast/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openrailassociation/osrd-editoast/versions/1840dbbd64ac/schema)
