Skip to main content
POST
/
vpn_sessions
Go (SDK)
package main

import(
	"context"
	"os"
	latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
	"github.com/latitudesh/latitudesh-go-sdk/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := latitudeshgosdk.New(
        latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
    )

    res, err := s.VpnSessions.Create(ctx, operations.PostVpnSessionVpnSessionsRequestBody{
        Data: &operations.PostVpnSessionVpnSessionsData{
            Attributes: &operations.PostVpnSessionVpnSessionsAttributes{
                Site: operations.PostVpnSessionVpnSessionsSiteSao.ToPointer(),
                ServerID: latitudeshgosdk.Pointer("sv_wg3ZDrKyO5QlP"),
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.VpnSessionWithPassword != nil {
        // handle response
    }
}
{
  "data": {
    "id": "vpn_xkjQwdENqYNVP",
    "type": "vpn_sessions",
    "attributes": {
      "user_name": "Winifred",
      "password": "caL1dENKqEspX",
      "port": "8443",
      "host": "fw04-mh1.maxi.host",
      "region": {
        "city": "São Paulo",
        "country": "Colombia",
        "site": {
          "id": "loc_w49QDBwKOagKb",
          "name": "São Paulo",
          "slug": "SAO",
          "facility": "São Paulo"
        }
      },
      "expires_at": "2025-07-16T18:38:18+00:00",
      "created_at": "2025-07-16T18:37:18+00:00",
      "updated_at": "2025-07-16T18:37:18+00:00"
    }
  },
  "meta": {}
}

Authorizations

Authorization
string
header
required

Body

data
object

Response

201 - application/vnd.api+json

Created

data
object