---
title: "open connection · RUAL Documentation"
description: "Open a connection with the NS (Nederlandse Spoorwegen) Reisinformatie API. Reuse the resulting connection in the other NS blocks."
canonical: https://docs.rual.nl/block-types/NS/nsconnection_open
language: en
---

# open connection

This block is part of the [`NS`](https://docs.rual.nl/block-types/NS) group and was last modified in core [`v15.0.0`](https://docs.rual.nl/core-versions/150000).

Open a connection with the NS (Nederlandse Spoorwegen) Reisinformatie API. Reuse the resulting connection in the other NS blocks.

- flow `flow`

- API key required `value` Your NS API subscription key (Ocp-Apim-Subscription-Key) from the NS API portal.

- Base URL `value` Optional override for the API base URL. Defaults to the public NS gateway.

Default `https://gateway.apiportal.ns.nl/reisinformatie-api`

- flow `flow`

- Connection `nsconnection` The NS connection.

- Success `condition` True if a valid connection could be created.

- Error `value` Error message if the connection could not be established.

| `trein` |
| --- |
| `spoor` |
| `ns api` |
| `reisinformatie` |

A typical wiring for [open connection](https://docs.rual.nl/block-types/NS/nsconnection_open): [get setting](https://docs.rual.nl/block-types/system%20settings/value_get_system_key_select) feeds the `api_key` pin; the `flow` out pin feeds [branch](https://docs.rual.nl/block-types/flow/branch); the `connection` out pin feeds [get nearest stations](https://docs.rual.nl/block-types/NS/nsconnection_nearest_stations).

![Studio canvas example for the open connection block: typical wiring for open connection.](https://docs.rual.nl/canvas-examples/nsconnection_open.png)

### Commonly used with

In production blueprints, this block is most often wired together with:

- [branch](https://docs.rual.nl/block-types/flow/branch): this block feeds into it.

- [get nearest stations](https://docs.rual.nl/block-types/NS/nsconnection_nearest_stations): this block feeds into it. Find the NS stations closest to a coordinate. Provide a geo point, or a separate latitude and longitude.

- [get stations](https://docs.rual.nl/block-types/NS/nsconnection_stations): this block feeds into it. List or search NS stations. Leave the search empty to retrieve all stations.

- [create](https://docs.rual.nl/block-types/globals/trigger_custom_function): feeds into this block. Creates a new function that can be executed using the given name.

- [get setting](https://docs.rual.nl/block-types/system%20settings/value_get_system_key_select): feeds into this block. get a created system setting.

### Version history

Introduced in [`v15.0.0`](https://docs.rual.nl/core-versions/150000).
