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

# Set Room E2E Key

## OpenAPI

````json POST /api/v1/e2e.setRoomKeyID
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Settings"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "paths": {
    "/api/v1/e2e.setRoomKeyID": {
      "parameters": [],
      "post": {
        "summary": "Set Room E2E Key",
        "operationId": "post-api-v1-e2e.setRoomKeyID",
        "responses": {
          "200": {
            "$ref": "#/components/responses/trueSuccess"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    },
                    "errorType": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Invalid Params": {
                    "value": {
                      "success": "false",
                      "error": "must have required property 'rid' [invalid-params]",
                      "errorType": "invalid-params"
                    }
                  },
                  "E2E Key Exists": {
                    "value": {
                      "success": "false",
                      "error": "E2E Key ID already exists [error-room-e2e-key-already-exists]",
                      "errorType": "error-room-e2e-key-already-exists",
                      "details": {
                        "method": "e2e.setRoomKeyID"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          }
        },
        "tags": [
          "E2E"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/X-User-Id"
          },
          {
            "$ref": "#/components/parameters/X-Auth-Token"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rid": {
                    "type": "string",
                    "description": "The room ID."
                  },
                  "keyID": {
                    "type": "string",
                    "description": "The key that you want to set for the room. Enter a unique string."
                  }
                },
                "required": [
                  "rid",
                  "keyID"
                ]
              },
              "examples": {
                "Example": {
                  "value": {
                    "rid": "wCiXndNp5NqNY3uCc",
                    "keyID": "my-UniQu3_ke4_Id"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "trueSuccess": {
        "description": "OK",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean"
                }
              }
            },
            "examples": {
              "Success": {
                "value": {
                  "success": "true"
                }
              }
            }
          }
        }
      },
      "authorizationError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Authorization Error": {
                "value": {
                  "status": "error",
                  "message": "You must be logged in to do this."
                }
              }
            }
          }
        }
      }
    },
    "parameters": {
      "X-User-Id": {
        "name": "X-User-Id",
        "in": "header",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "CkCPNctrgCDfmWLqC",
        "description": "The user ID."
      },
      "X-Auth-Token": {
        "name": "X-Auth-Token",
        "in": "header",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "1Dd4iN_ClKn5jl-xPC36snQ4s9Zd5GZnXCQuCNSKcVE",
        "description": "The authentication token."
      }
    }
  }
}
````

