---
name: hs-crypto-uko-align-key
title: Realigning managed keys with key templates
description: After you create a managed key with a key template, you can still update the key template on general properties, key lifecycles, and assigned keystores. If it happens, an `Unaligned` flag can be displayed on the key details card for keys that are created with the key template. You can then manually realign your key with the key template with the Unified Key Orchestrator UI, or programmatically with the Unified Key Orchestrator. You can either realign active or deactivated keys with the key template.
last-updated: 2026-06-16
---

> ## Documentation Index
> The table of contents for this documentation set is at https://cloud.ibm.com/docs/hs-crypto?format=markdown
> The index for all IBM Cloud docs is at: https://cloud.ibm.com/docs/llms.txt
> Use these files to discover more information as needed.

# Realigning managed keys with key templates
{: #align-key}

After you create a managed key with a key template, you can still update the key template on general properties, key lifecycles, and assigned keystores. If it happens, an `Unaligned` flag can be displayed on the key details card for keys that are created with the key template. You can then manually realign your key with the key template with the Unified Key Orchestrator UI, or programmatically with the Unified Key Orchestrator. You can either realign active or deactivated keys with the key template.  
{: shortdesc}

  
Currently, with the Unified Key Orchestrator UI, you can only realign assigned keystores with the key template. To realign general properties and key lifecycles, use the Unified Key Orchestrator.  
{: note}


## Realigning managed keys with key templates through the UI
{: #align-key-ui}
{: ui}

To realign managed keys with key templates by using the UI, complete the following steps:

1. [Log in to the Hyper Protect Crypto Services instance](https://cloud.ibm.com/login){: external}.
2. Click **Managed keys** from the navigation to view all the available keys. 
3. Click the Actions icon ![Actions icon](../icons/action-menu-icon.svg "Actions") on the key that you want to realign, and select **Show details**.
4. To realign the key with key templates, click **Actions** and select **Realign with template**.
5. View the details on the confirmation page, check all boxes, and then click **Realign with template** to confirm.

Your key is now aligned again with the key template in terms of assigned keystores. 


 
If the key template is archived, you cannot realign the key with key templates.  
{: note}


## Realigning keys with key templates through the API
{: #align-key-api}
{: api}

To realign keys with key templates through the API, complete the following steps:

1. [Retrieve your service and authentication credentials to work with keys in the service](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-set-up-uko-api&format=markdown).
   
2. Create a key template by making a `POST` call to the following endpoint.

    
    
    ```
    https://<instance_ID>.uko.<region>.hs-crypto.appdomain.cloud/api/v4/managed_keys/<id>/update_from_template
    
    ```
    {: codeblock}
    

    Replace `<id>` with the ID of your key.

    For detailed instructions and code examples about using the API method, check out the [Hyper Protect Crypto Services Unified Key Orchestrator API reference doc](https://cloud.ibm.com/apidocs/uko#update-managed-key-from-template){: external}.


## What's next
{: #align-key-next}

- To find out instructions on editing a key template, check out [Editing key template details](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-edit-template&interface=ui&format=markdown).

- To find out more about managing your key template, check out [Viewing a list of key templates](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-view-key-template&interface=ui&format=markdown).