> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/network-services/vpn-gateway/api-how-tos/retrieve-all-ipsec-tunnels.md).

# Retrieve all IPSec Tunnels

IONOS CLOUD VPN Gateway: retrieve all IPSec tunnels using the API

Enables retrieving all IPSec Tunnels using pagination and optional filters.

To retrieve all the IPSec Tunnels, perform a `GET` request.

## Endpoint

Use a [<mark style="color:blue;">region-specific</mark>](/cloud/network-services/vpn-gateway/api-how-tos.md#endpoints) endpoint to retrieve all IPSec Tunnels: `https://vpn.{region}.ionos.com/ipsecgateways/{gatewayId}/tunnels`.

## Request

```bash
curl --location \
--request GET 'https://vpn.de-fra.ionos.com/ipsecgateways/66a114c7-2ddd-5119-9ddf-5a789f5a5a44/tunnels?limit=100&offset=0' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJraWQiO'
```

{% tabs %}
{% tab title="Path Parameters" %}
Below is the list of optional Path Parameters:

| Query Parameters | Type    | Description                                                                                                                      | Example |
| ---------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `offset`         | integer | The first element (of the total list of elements) to include in the response. Use together with limit for pagination. Default: 0 | 0       |
| `limit`          | integer | The maximum number of elements to return. Use together with offset for pagination. Default: 100                                  | 100     |
| {% endtab %}     |         |                                                                                                                                  |         |

{% tab title="Request Header Parameters" %}
To make authenticated requests to the API, the following fields are mandatory in the request header:

| Header Parameters | Required | Type   | Description                                                                     |
| ----------------- | -------- | ------ | ------------------------------------------------------------------------------- |
| `Authorization`   | yes      | string | The Bearer token enables requests to authenticate using a JSON Web Token (JWT). |
| `Content-Type`    | no       | string | Set this to `application/json`.                                                 |
| {% endtab %}      |          |        |                                                                                 |
| {% endtabs %}     |          |        |                                                                                 |

## Response

**200 Successful operation**

```json
{
  "id": "0ef10f6b-8742-5e74-98ff-3e89354b1082",
  "type": "collection",
  "href": "/ipsecgateways/{gatewayId}/tunnels",
  "items": [
    {
      "id": "c28b2d3e-7b15-53ca-ae88-6ae9378d6efe",
      "type": "ipsectunnel",
      "href": "/ipsecgateways/{gatewayId}/tunnels/c28b2d3e-7b15-53ca-ae88-6ae9378d6efe",
      "metadata": {
        "createdDate": "2020-12-10T13:37:50+01:00",
        "createdBy": "ionos:identity:::users/87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "createdByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "lastModifiedDate": "2020-12-11T13:37:50+01:00",
        "lastModifiedBy": "ionos:identity:::users/87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "lastModifiedByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
        "resourceURN": "ionos:<product>:<location>:<contract>:<resource-path>",
        "status": "AVAILABLE",
        "statusMessage": null
      },
      "properties": {
        "name": "My Company Gateway Tunnel",
        "description": "Allows local subnet X to connect to virtual network Y.",
        "remoteHost": "vpn.mycompany.com",
        "auth": {
          "method": "PSK",
          "psk": {}
        },
        "ike": {
          "diffieHellmanGroup": "16-MODP4096",
          "encryptionAlgorithm": "AES256",
          "integrityAlgorithm": "SHA256",
          "lifetime": 86400
        },
        "esp": {
          "diffieHellmanGroup": "16-MODP4096",
          "encryptionAlgorithm": "AES256",
          "integrityAlgorithm": "SHA256",
          "lifetime": 3600
        },
        "cloudNetworkCIDRs": [
          "203.0.113.0/24"
        ],
        "peerNetworkCIDRs": [
          "198.51.100.0/24"
        ]
      }
    }
  ],
  "offset": 0,
  "limit": 42,
  "_links": {
    "prev": "http://PREVIOUS-PAGE-URI",
    "self": "http://THIS-PAGE-URI",
    "next": "http://NEXT-PAGE-URI"
  }
}
```

{% hint style="success" %}
**Result:** All existing IPSec Tunnels and their details are successfully obtained.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ionos.com/cloud/network-services/vpn-gateway/api-how-tos/retrieve-all-ipsec-tunnels.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
