> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/infra-controller/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/infra-controller/_mcp/server.

# Reencrypt Tenant Identity Secrets

POST https://nico-rest-api.nico.svc.cluster.local/v2/org/{org}/nico/site/{siteID}/tenant-identity/re-encrypt
Content-Type: application/json

Re-wrap stored `tenant_identity_config` ciphertext with the Site's
current master encryption key (KEK rotation). This is a
site-operator operation, not a per-tenant one.

User must have authorization role with `PROVIDER_ADMIN` suffix in the URL `{org}`.

Reference: https://docs.nvidia.com/infra-controller/rest-api-reference/api-reference/tenant-identity/reencrypt-tenant-identity-secrets

## Authentication

- `Authorization` header (bearer token, required) — ``` export JWT_BEARER_TOKEN="<jwt-bearer-token>" # Example org name: "acme-inc export ORG_NAME=<org-name> # Use the JWT bearer token in your API request auth header: curl -v -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $JWT_BEARER_TOKEN" https://nico-rest-api.nico.svc.cluster.local/v2/org/$ORG_NAME/nico/user/current ```

## Request

### Path parameters

- `org` (string, required) — Name of the provider organization authorizing the operation
- `siteID` (string, required) — ID of the target Site

### Body (application/json)

This endpoint expects an object.

- `organizationId` (string, optional, nullable) — Optional tenant organization identifier (`org`), not the tenant's REST resource UUID or display name. A non-null value must contain one or more ASCII letters, digits, underscores, or hyphens; empty and whitespace-containing strings are rejected, not treated as site-wide scope. The value is matched case-insensitively and is lowercased before the Tenant lookup and before it reaches Core. The tenant must have an allocation and tenant identity configuration on the Site; only that organization's secrets are re-wrapped. The URL `{org}` separately identifies the provider authorizing the operation. If omitted or null, every row in the Site's tenant identity store is processed.
- `dryRun` (boolean, optional, default: false) — When true, decrypt and validate only; no changes are written.

## Response

### 200

Reencryption completed; counters and any per-field failures are reported in the body.

- `rowsExamined` (integer, required) — Number of rows examined.
- `rowsUpdated` (integer, required) — Number of rows re-wrapped with the current key.
- `rowsSkippedAllOnTarget` (integer, required) — Number of rows skipped because all fields were already on the target key.
- `fieldsReencrypted` (integer, required) — Number of individual fields re-wrapped.
- `fieldsSkippedOnTarget` (integer, required) — Number of fields skipped because they were already on the target key.
- `rowsFailed` (integer, required) — Number of rows with at least one field that failed to re-wrap.
- `failures` (list of object, required) — Per-field re-wrap failures; an empty array when none occurred.
  - `organizationId` (string, required) — Org whose secret failed to re-wrap.
  - `field` (string, required) — Name of the field that failed to re-wrap.
  - `error` (string, required) — Error describing why the field could not be re-wrapped.
- `currentEncryptionKeyId` (string, required) — Site machine_identity.current_encryption_key_id used as the re-wrap target.

## Errors

### 400 Bad Request Error

Error response when request data cannot be validated

- `source` (enum, optional) — Source of the error.
  - Allowed values: `nico`
- `message` (string, optional) — Message describing the error
- `data` (object, optional, nullable) — Additional data about the error

### 403 Forbidden Error

Error response when user is not authorized to call an endpoint or retrieve/modify objects

- `source` (enum, optional) — Source of the error.
  - Allowed values: `nico`
- `message` (string, optional) — Message describing the error
- `data` (object, optional, nullable) — Additional data about the error

### 404 Not Found Error

Error response when requested object is not found

- `source` (enum, optional) — Source of the error.
  - Allowed values: `nico`
- `message` (string, optional) — Message describing the error
- `data` (object, optional, nullable) — Additional data about the error

### 500 Internal Server Error

Response when the API handler encounters an unexpected error

- `source` (enum, optional) — Source of the error.
  - Allowed values: `nico`
- `message` (string, optional) — Message describing the error
- `data` (object, optional, nullable) — Additional data about the error

### 503 Service Unavailable Error

Core gRPC API is unavailable, or site-level machine identity is disabled (`enabled=false` in site config), so the request cannot be served.

- `source` (enum, optional) — Source of the error.
  - Allowed values: `nico`
- `message` (string, optional) — Message describing the error
- `data` (object, optional, nullable) — Additional data about the error

### 504 Gateway Timeout Error

Response when the API handler encounters an unexpected error

- `source` (enum, optional) — Source of the error.
  - Allowed values: `nico`
- `message` (string, optional) — Message describing the error
- `data` (object, optional, nullable) — Additional data about the error

## Examples

**Request**

```json
{
  "organizationId": "tenant-corp",
  "dryRun": true
}
```

**Response**

```json
{
  "rowsExamined": 3,
  "rowsUpdated": 2,
  "rowsSkippedAllOnTarget": 1,
  "fieldsReencrypted": 4,
  "fieldsSkippedOnTarget": 2,
  "rowsFailed": 0,
  "failures": [],
  "currentEncryptionKeyId": "key-2"
}
```

**SDK Code**

```python
import requests

url = "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/site/siteID/tenant-identity/re-encrypt"

payload = {
    "organizationId": "tenant-corp",
    "dryRun": True
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/site/siteID/tenant-identity/re-encrypt';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"organizationId":"tenant-corp","dryRun":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/site/siteID/tenant-identity/re-encrypt"

	payload := strings.NewReader("{\n  \"organizationId\": \"tenant-corp\",\n  \"dryRun\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/site/siteID/tenant-identity/re-encrypt")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"organizationId\": \"tenant-corp\",\n  \"dryRun\": true\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/site/siteID/tenant-identity/re-encrypt")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"organizationId\": \"tenant-corp\",\n  \"dryRun\": true\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/site/siteID/tenant-identity/re-encrypt', [
  'body' => '{
  "organizationId": "tenant-corp",
  "dryRun": true
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/site/siteID/tenant-identity/re-encrypt");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"organizationId\": \"tenant-corp\",\n  \"dryRun\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "organizationId": "tenant-corp",
  "dryRun": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://nico-rest-api.nico.svc.cluster.local/v2/org/org/nico/site/siteID/tenant-identity/re-encrypt")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```