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

# Patch resources custom attributes

> Upserts specific custom attributes on a resource, leaving all other existing attributes untouched. For each key in the request body, the existing value (if any) is replaced. Keys not present in the request body are not modified.



## OpenAPI

````yaml https://app.opal.dev/openapi.yaml patch /resources/{resource_id}/custom-attributes
openapi: 3.1.0
info:
  contact:
    email: hello@opal.dev
    name: Opal Team
    url: https://www.opal.dev/
  description: >-
    The Opal API is a RESTful API that allows you to interact with the Opal
    Security platform programmatically.
  title: Opal API
  version: '1.0'
servers:
  - description: Production
    url: https://api.opal.dev/v1
security: []
tags:
  - name: access-rules
    description: Operations related to access rules
  - name: agent-activity
    description: Operations related to agent activity telemetry
  - name: apps
    description: Operations related to apps
  - name: bundles
    description: Operations related to bundles
  - name: campaigns
    description: Operations related to access review campaigns
  - name: configuration-templates
    description: Operations related to configuration templates
  - name: delegations
    description: Operations related to request reviewer delegations
  - name: event-streams
    description: Operations related to event streaming connections
  - name: events
    description: Operations related to events
  - name: groups
    description: Operations related to groups
  - name: group-bindings
    description: Operations related to group bindings
  - name: idp-group-mappings
    description: Operations related to IDP group mappings
  - name: idp-user-attribute-mappings
    description: >-
      Operations related to the user attributes Opal imports from identity
      providers and HRIS apps
  - name: ip-acl
    description: >-
      Operations related to the API IP allowlist (IP zones and its enforcement
      setting)
  - name: message-channels
    description: Operations related to message channels
  - name: non-human-identities
    description: Operations related to non-human identities
  - name: on-call-schedules
    description: Operations related to on-call schedules
  - name: opal-queries
    description: Operations related to OpalQuery
  - name: opal-scripts
    description: Operations related to OpalScripts
  - name: owners
    description: Operations related to owners
  - name: requests
    description: Operations related to requests
  - name: resources
    description: Operations related to resources
  - name: role-assignments
    description: >-
      Operations related to role assignments (general grants between an entity
      and a principal)
  - name: paladin
    description: Operations related to Paladin
  - name: service-users
    description: Operations related to service users (non-human identities owned by a team)
  - name: sessions
    description: Operations related to sessions
  - name: tags
    description: Operations related to tags
  - name: tokens
    description: Operations related to API tokens
  - name: uars
    description: Operations related to UARs. Deprecated in favor of the `campaigns` API.
  - name: users
    description: Operations related to users
paths:
  /resources/{resource_id}/custom-attributes:
    patch:
      tags:
        - resources
      description: >-
        Upserts specific custom attributes on a resource, leaving all other
        existing attributes untouched. For each key in the request body, the
        existing value (if any) is replaced. Keys not present in the request
        body are not modified.
      operationId: patch_resource_custom_attributes
      parameters:
        - description: The ID of the resource whose custom attributes to upsert.
          name: resource_id
          example: 1b978423-db0a-4037-a4cf-f79c60cb67b3
          explode: false
          in: path
          required: true
          schema:
            type: string
            format: uuid
          style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomAttributesList'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomAttributesList'
          description: >-
            The full list of custom attributes for the resource after the
            upsert.
      security:
        - BearerAuth: []
components:
  schemas:
    CustomAttributesList:
      description: A list of custom attributes.
      properties:
        custom_attributes:
          items:
            $ref: '#/components/schemas/CustomAttribute'
          type: array
      required:
        - custom_attributes
      type: object
    CustomAttribute:
      description: >-
        A custom attribute key/value pair attached to a resource or group.


        The `values` array encoding depends on `value_type`:

        - `TEXT`: one or more plain strings.

        - `BOOLEAN`: a single-element array containing `"true"` or `"false"`.

        - `USERS`, `GROUPS`, `RESOURCES`: one or more UUID strings referencing
        the
          respective entity type.
      properties:
        key:
          description: The name of the custom attribute.
          example: team
          type: string
        value_type:
          $ref: '#/components/schemas/CustomAttributeValueTypeEnum'
        values:
          description: The attribute's value(s), encoded as strings.
          example:
            - platform
          items:
            type: string
          type: array
      required:
        - key
        - value_type
        - values
      type: object
    CustomAttributeValueTypeEnum:
      description: The type of value stored in a custom attribute.
      enum:
        - TEXT
        - BOOLEAN
        - USERS
        - GROUPS
        - RESOURCES
      type: string
  securitySchemes:
    BearerAuth:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.