> ## 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.

# Set the ID of the configuration template linked to a resource

> Attaches, repoints, or detaches the configuration template linked to a
resource. This endpoint only manages the link (by ID) between a
resource and an existing configuration template — it does not create,
modify, or delete the template itself. To manage a template's own
fields (name, description, request configurations, visibility, etc.),
use the `/configuration-templates` endpoints.

The request body is `{"configuration_template_id": "<uuid>" | null}`:

  * A `<uuid>` value links the resource to the configuration template
    with that ID. If the resource was previously linked to a different
    template, the resource is repointed in place.
  * `null` detaches the resource from its current configuration
    template. The template is deep-copied into a new private
    configuration with the same settings so the resource's current
    behaviour is preserved, and the resource is repointed at the fork.

The `configuration_template_id` field is required. Sending `{}` or any
body in which the field is omitted is rejected with `400`.

The call is idempotent: if the request body matches the resource's
current link, no changes are made and no audit events are emitted.

This endpoint is the preferred, Terraform-friendly surface for linking
and unlinking configuration templates on resources. The equivalent
`configuration_template_id` field on `PUT /resources` remains available
but is deprecated for this purpose.




## OpenAPI

````yaml https://app.opal.dev/openapi.yaml put /resources/{resource_id}/configuration-template
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: 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: 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}/configuration-template:
    put:
      tags:
        - resources
      summary: Set the ID of the configuration template linked to a resource
      description: |
        Attaches, repoints, or detaches the configuration template linked to a
        resource. This endpoint only manages the link (by ID) between a
        resource and an existing configuration template — it does not create,
        modify, or delete the template itself. To manage a template's own
        fields (name, description, request configurations, visibility, etc.),
        use the `/configuration-templates` endpoints.

        The request body is `{"configuration_template_id": "<uuid>" | null}`:

          * A `<uuid>` value links the resource to the configuration template
            with that ID. If the resource was previously linked to a different
            template, the resource is repointed in place.
          * `null` detaches the resource from its current configuration
            template. The template is deep-copied into a new private
            configuration with the same settings so the resource's current
            behaviour is preserved, and the resource is repointed at the fork.

        The `configuration_template_id` field is required. Sending `{}` or any
        body in which the field is omitted is rejected with `400`.

        The call is idempotent: if the request body matches the resource's
        current link, no changes are made and no audit events are emitted.

        This endpoint is the preferred, Terraform-friendly surface for linking
        and unlinking configuration templates on resources. The equivalent
        `configuration_template_id` field on `PUT /resources` remains available
        but is deprecated for this purpose.
      operationId: update_resource_configuration_template
      parameters:
        - description: >-
            The ID of the resource whose configuration template link is being
            set.
          example: 4baf8423-db0a-4037-a4cf-f79c60cb67a5
          explode: false
          in: path
          name: resource_id
          required: true
          schema:
            type: string
            format: uuid
          style: simple
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResourceConfigurationTemplate'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceConfigurationTemplate'
          description: >-
            The ID of the configuration template now linked to the resource, or
            `null` if the resource was detached.
        '400':
          description: >-
            The request body was malformed, the required
            `configuration_template_id` field was omitted, or the target
            `configuration_template_id` does not reference a configuration
            template.
        '403':
          description: The caller is not authorized to update this resource.
        '404':
          description: The resource was not found.
      security:
        - BearerAuth: []
components:
  schemas:
    ResourceConfigurationTemplate:
      description: |-
        A reference, by ID only, to the configuration template a resource is
        linked to. This schema does not include any of the template's own
        fields (name, description, request configurations, visibility, etc.) —
        to read or modify those, use the `/configuration-templates` endpoints
        with the ID carried here. A `null` `configuration_template_id`
        indicates that the resource is not linked to a configuration template
        and uses its own private configuration.
      example:
        configuration_template_id: 06851574-e50d-40ca-8c78-f72ae6ab4304
      properties:
        configuration_template_id:
          description: |-
            The ID of the configuration template that the resource is linked
            to, or `null` if the resource is not linked to a configuration
            template. Only the ID is exposed here; the template's own fields
            are managed through the `/configuration-templates` endpoints.
          example: 06851574-e50d-40ca-8c78-f72ae6ab4304
          format: uuid
          nullable: true
          type: string
      type: object
      required:
        - configuration_template_id
  securitySchemes:
    BearerAuth:
      scheme: bearer
      type: http

````

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