> ## Documentation Index
> Fetch the complete documentation index at: https://docs.basaltic.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Update target group health checks, framing, or stickiness

<Info>
  Requires the IAM action **`loadbalancer:UpdateTargetGroup`**. See [LOADBALANCER permissions](/loadbalancer/permissions) for the full list, what each one covers, and an example policy.
</Info>


## OpenAPI

````yaml /api-reference/specs/loadbalancer.yaml patch /v1/target-groups/{id}
openapi: 3.0.3
info:
  title: Basaltic Load Balancer API
  version: 1.0.0
  description: >
    Request relationships accept syntax-classified references resolved within
    the caller account and region.

    Floating IP references accept UUID or CRN only; IP targets stay literal.

    Managed load balancers: listeners, target pools, health checks and the

    TLS certificates a listener terminates.
  contact:
    name: Basaltic Support
    email: ping@basaltic.sh
  license:
    name: Proprietary
    url: https://basaltic.sh/terms
servers:
  - url: https://loadbalancer.{region}.basaltic.sh
    description: Regional API endpoint
    variables:
      region:
        default: sa-saopaulo-1
        description: Region code
security:
  - BearerAuth: []
paths:
  /v1/target-groups/{id}:
    patch:
      tags:
        - Load Balancers
      summary: Update target group health checks, framing, or stickiness
      operationId: updateTargetGroup
      parameters:
        - name: id
          in: path
          required: true
          description: UUID, CRN or exact account-scoped name
          schema:
            type: string
            example: b8c9d0e1-f2a3-4456-b7c8-d9e0f1a2b3c4
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTargetGroupRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TargetGroupResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    UpdateTargetGroupRequest:
      additionalProperties: false
      type: object
      description: >
        Names are fixed at creation because they form the CRN used by IAM
        policies.

        Sending name in an update, including an unchanged, empty or null value,
        returns a validation error.
      properties:
        health_check:
          $ref: '#/components/schemas/HealthCheck'
        proxy_protocol:
          type: boolean
          description: |
            Toggle PROXY v2 framing on upstream connections. Omitting
            the field leaves the current setting; setting true/false
            flips it explicitly.
        session_affinity:
          allOf:
            - $ref: '#/components/schemas/SessionAffinity'
          description: >-
            Replaces the stickiness config. Omitting the field leaves it alone;
            turning it off is an explicit `{"type": "none"}`.
        tags:
          $ref: '#/components/schemas/Tags'
    TargetGroupResponse:
      type: object
      properties:
        target_group:
          $ref: '#/components/schemas/TargetGroup'
    HealthCheck:
      type: object
      properties:
        protocol:
          type: string
          enum:
            - http
            - https
            - tcp
            - udp
          description: Defaults to the target group protocol when omitted
          example: http
        path:
          type: string
          example: /healthz
        port:
          type: integer
          minimum: 1
          maximum: 65535
          example: 8080
        interval_sec:
          type: integer
          default: 30
          example: 30
        timeout_sec:
          type: integer
          default: 5
          example: 5
        healthy_threshold:
          type: integer
          default: 3
          example: 3
        unhealthy_threshold:
          type: integer
          default: 3
          example: 3
        matcher:
          type: string
          default: '200'
          example: '200'
    SessionAffinity:
      type: object
      description: |
        Sticky sessions: pin a client to one backend in the group instead of
        balancing each request independently. Off unless you ask for it.

        The data plane hashes the key consistently, so adding or losing a
        backend only moves the clients that backend was serving.
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - none
            - cookie
            - source_ip
          default: none
          example: cookie
          description: >
            `none` balances every request. `cookie` sets an opaque cookie on the

            first response and routes every later request carrying it to the
            same

            backend — http and https groups only. `source_ip` hashes the client

            address, works on every protocol and is the only option for tcp and

            udp, but a NAT gateway makes every client behind it a single key.
        cookie_name:
          type: string
          maxLength: 128
          default: BASALTICLB
          example: BASALTICLB
          description: >-
            Cookie the load balancer sets and hashes. `type=cookie` only; the
            field is dropped for the other types.
        duration_sec:
          type: integer
          minimum: 1
          maximum: 604800
          default: 86400
          example: 86400
          description: How long that cookie lives, up to 7 days. `type=cookie` only.
    Tags:
      type: object
      additionalProperties:
        type: string
      example:
        environment: production
        team: backend
    TargetGroup:
      type: object
      required:
        - id
        - crn
        - account_id
        - name
        - protocol
        - target_type
        - port
        - health_check
        - proxy_protocol
        - session_affinity
        - target_mode
        - tags
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
          example: b8c9d0e1-f2a3-4456-b7c8-d9e0f1a2b3c4
        crn:
          type: string
          example: crn:loadbalancer:sa-saopaulo-1:my-account:target-group/web-backends
        account_id:
          type: string
          format: uuid
          example: 6f9619ff-8b86-4d01-b42d-00cf4fc964ff
        name:
          description: >-
            Resource names must not start with the literal crn: prefix or be
            UUIDs (canonical, compact, braced, or urn:uuid: forms, in either
            case).
          type: string
          example: web-targets
        protocol:
          type: string
          enum:
            - http
            - https
            - tcp
            - udp
          example: http
        target_type:
          type: string
          enum:
            - ip
            - instance
            - function
          example: instance
        port:
          type: integer
          minimum: 1
          maximum: 65535
          example: 8080
        health_check:
          $ref: '#/components/schemas/HealthCheck'
        proxy_protocol:
          type: boolean
          example: false
          description: |
            When true, upstream connections are wrapped in the PROXY
            v2 header so backends see the original client IP + port.
            HTTP backends already get X-Forwarded-For; PROXY is the
            right pick for TCP/UDP target groups or HTTP backends that
            prefer the framed envelope.
        session_affinity:
          $ref: '#/components/schemas/SessionAffinity'
        target_mode:
          type: string
          enum:
            - static
            - pool
          example: static
          description: >
            Where the backend set comes from. `static` routes to the targets

            attached via POST /v1/target-groups/{id}/targets; `pool` resolves
            live

            instance addresses from the compute instance pool named by

            instance_pool_id, so scaling the pool moves the backends with it.
        instance_pool_id:
          type: string
          format: uuid
          example: a1b2c3d4-e5f6-4789-a0b1-c2d3e4f5a6b7
          description: Compute instance pool backing the group. Set iff target_mode=pool.
        tags:
          $ref: '#/components/schemas/Tags'
        created_at:
          type: string
          format: date-time
          example: '2026-01-15T09:30:00Z'
        updated_at:
          type: string
          format: date-time
          example: '2026-01-15T09:30:00Z'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - request_id
          properties:
            code:
              type: string
              description: Error code identifying the type of error
              example: INVALID_INPUT
            message:
              type: string
              description: Human-readable error message
              example: Invalid request parameters
            request_id:
              type: string
              format: uuid
              description: Request ID for debugging
              example: 550e8400-e29b-41d4-a716-446655440000
  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: INVALID_INPUT
              message: Invalid request parameters
              request_id: 550e8400-e29b-41d4-a716-446655440000
    Unauthorized:
      description: Authentication required or token invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: UNAUTHORIZED
              message: Authentication required
              request_id: 550e8400-e29b-41d4-a716-446655440000
    Forbidden:
      description: Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: ACCESS_DENIED
              message: You don't have permission to perform this action
              request_id: 550e8400-e29b-41d4-a716-446655440000
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: NOT_FOUND
              message: Resource not found
              request_id: 550e8400-e29b-41d4-a716-446655440000
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        An OAuth 2.0 bearer token, sent as `Authorization: Bearer <token>`.
        This is the recommended way to authenticate.

        Get one by exchanging a service account's access key pair at
        `POST /v1/oauth/token` with `grant_type=client_credentials`. It is the
        standard client-credentials grant, so any OAuth-aware library will
        obtain and refresh it for you.

        ```
        curl -s -u "$KEY_ID:$SECRET" -d grant_type=client_credentials \
          https://iam.basaltic.sh/v1/oauth/token
        ```

        Tokens last an hour by default. The same access key pair is separately
        your AWS SigV4 credential for the S3-compatible object endpoint, which
        speaks nothing else.

````