Skip to content
Docs

    Update User Security Settings

    client.User.Security.Update(ctx, body) (*UserSecurity, error)
    PATCH/v1/user/security

    Update the current user’s security settings

    ParametersExpand Collapse
    body SecurityUpdateParams
    SourceIPRule param.Field[SourceIPRule]Optional

    IP filter rules.

    ReturnsExpand Collapse
    type UserSecurity struct{…}

    User security settings response.

    IP filter rules.

    Allowed []string

    List of IPv4 CIDR addresses to allow.

    Blocked []string

    List of IPv4 CIDR addresses to deny.

    CreatedAt TimeOptional

    When the user security settings were created.

    formatdate-time
    UpdatedAt TimeOptional

    When the user security settings were updated.

    formatdate-time

    Update User Security Settings

    package main
    
    import (
      "context"
      "fmt"
    
      "github.com/nirvana-labs/nirvana-go"
      "github.com/nirvana-labs/nirvana-go/option"
      "github.com/nirvana-labs/nirvana-go/user"
    )
    
    func main() {
      client := nirvana.NewClient(
        option.WithAPIKey("My API Key"),
      )
      userSecurity, err := client.User.Security.Update(context.TODO(), user.SecurityUpdateParams{
    
      })
      if err != nil {
        panic(err.Error())
      }
      fmt.Printf("%+v\n", userSecurity.SourceIPRule)
    }
    
    {
      "source_ip_rule": {
        "allowed": [
          "192.168.1.0/24",
          "10.0.0.0/8"
        ],
        "blocked": [
          "192.168.1.100/32"
        ]
      },
      "created_at": "2025-01-01T00:00:00Z",
      "updated_at": "2025-01-01T00:00:00Z"
    }
    Returns Examples
    {
      "source_ip_rule": {
        "allowed": [
          "192.168.1.0/24",
          "10.0.0.0/8"
        ],
        "blocked": [
          "192.168.1.100/32"
        ]
      },
      "created_at": "2025-01-01T00:00:00Z",
      "updated_at": "2025-01-01T00:00:00Z"
    }