> ## Documentation Index
> Fetch the complete documentation index at: https://trophy-ci-i18n-auto-translations.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update attributes

> Update attributes by ID.



## OpenAPI

````yaml https://admin.trophy.so/v1/openapi patch /attributes
openapi: 3.1.0
info:
  title: Trophy
  version: 1.19.0
servers:
  - x-fern-server-name: Admin API
    url: https://admin.trophy.so/v1
    description: Admin API
security: []
paths:
  /attributes:
    servers:
      - url: https://admin.trophy.so/v1
        description: Admin API
    parameters:
      - $ref: '#/components/parameters/TenantId'
    patch:
      tags:
        - Admin
      summary: Update attributes
      description: Update attributes by ID.
      operationId: admin_attributes_update
      requestBody:
        description: >-
          Array of attributes to update. Each item must include an ID and may
          include `name`. `key` and `type` cannot be changed.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAttributesRequest'
            examples:
              Rename attributes:
                value:
                  - id: 550e8400-e29b-41d4-a716-446655440000
                    name: Subscription Plan
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateAttributesResponse'
              examples:
                Success with no issues:
                  value:
                    updated:
                      - id: 550e8400-e29b-41d4-a716-446655440000
                        name: Subscription Plan
                        key: plan
                        type: user
                    issues: []
                Mixed success and errors:
                  value:
                    updated:
                      - id: 550e8400-e29b-41d4-a716-446655440001
                        name: Device
                        key: device
                        type: event
                    issues:
                      - id: 550e8400-e29b-41d4-a716-446655440999
                        severity: error
                        message: Attribute not found by ID
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminErrorBody'
        '422':
          description: Unprocessible Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminErrorBody'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: javascript
          source: |
            import { TrophyApiClient } from '@trophyso/node';

            const trophy = new TrophyApiClient({
              apiKey: 'YOUR_API_KEY'
            });

            const response = await trophy.admin.attributes.update([
              {
                id: '550e8400-e29b-41d4-a716-446655440000',
                name: 'Subscription Plan'
              }
            ]);
        - lang: python
          source: |
            from trophy import TrophyApi

            client = TrophyApi(api_key='YOUR_API_KEY')

            response = client.admin.attributes.update([
              {
                "id": "550e8400-e29b-41d4-a716-446655440000",
                "name": "Subscription Plan"
              }
            ])
        - lang: go
          source: >
            import (
              "context"

              api "github.com/trophyso/trophy-go"
              trophyclient "github.com/trophyso/trophy-go/client"
              "github.com/trophyso/trophy-go/option"
            )


            client := trophyclient.NewClient(
              option.WithApiKey("YOUR_API_KEY"),
            )


            response, err := client.Admin.Attributes.Update(context.TODO(),
            api.UpdateAttributesRequest{})
components:
  parameters:
    TenantId:
      name: Tenant-ID
      in: header
      description: >-
        The tenant identifier for multi-tenant organisations. Required when the
        organisation has multi-tenancy enabled. Pass your own internal customer
        ID for the tenant. Ignored for single-tenant organisations.
      required: false
      schema:
        type: string
      example: customer_12345
  schemas:
    UpdateAttributesRequest:
      title: UpdateAttributesRequest
      type: array
      description: Request body for updating attributes.
      items:
        $ref: '#/components/schemas/UpdateAttributeRequestItem'
      minItems: 1
      maxItems: 100
    UpdateAttributesResponse:
      title: UpdateAttributesResponse
      type: object
      description: >-
        Response containing updated attributes and any per-item issues
        identified by attribute ID.
      properties:
        updated:
          type: array
          items:
            $ref: '#/components/schemas/AdminAttribute'
          description: Array of successfully updated attributes.
        issues:
          type: array
          items:
            $ref: '#/components/schemas/AdminIssue'
          description: Array of issues encountered during attribute update.
      required:
        - updated
        - issues
    AdminErrorBody:
      title: AdminErrorBody
      type: object
      properties:
        error:
          type: string
      required:
        - error
    UpdateAttributeRequestItem:
      title: UpdateAttributeRequestItem
      type: object
      description: >-
        An attribute update object. `id` is required and `name` is optional.
        `key` and `type` cannot be changed through this endpoint.
      properties:
        id:
          type: string
          format: uuid
          description: The UUID of the attribute to update.
          example: 550e8400-e29b-41d4-a716-446655440000
        name:
          type: string
          description: The updated attribute name.
          example: Subscription Plan
      required:
        - id
    AdminAttribute:
      title: AdminAttribute
      type: object
      description: An attribute returned from the admin attributes endpoints.
      properties:
        id:
          type: string
          format: uuid
          description: The UUID of the attribute.
        name:
          type: string
          description: The attribute name.
        key:
          type: string
          description: The attribute key.
        type:
          type: string
          enum:
            - user
            - event
          description: The attribute type.
      required:
        - id
        - name
        - key
        - type
    AdminIssue:
      title: AdminIssue
      type: object
      description: An issue encountered while processing an item in an admin API request.
      properties:
        id:
          type: string
          description: The ID of the resource the issue relates to, when applicable.
          example: 550e8400-e29b-41d4-a716-446655440000
        userId:
          type: string
          description: The ID of the user the issue relates to, when applicable.
          example: user-123
        boostId:
          type: string
          description: The ID of the points boost the issue relates to, when applicable.
          example: 550e8400-e29b-41d4-a716-446655440000
        index:
          type: integer
          description: >-
            The zero-based index of the item the issue relates to, when no
            resource ID exists yet.
          example: 0
        severity:
          type: string
          enum:
            - error
            - warning
          description: The severity level of the issue.
          example: warning
        message:
          type: string
          description: A human-readable description of the issue.
          example: Would exceed maximum freeze limit
      required:
        - severity
        - message
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````