Set Predefined Code

🔐 Set Predefined Code API

This API allows enterprise backend applications to set a predefined code and verification key for a REL-ID user. This code acts as an access code or OTP and will be used during the user's activation process.


🔗 Endpoint

PUT https://REL-ID-SERVER-IP:9442/v1/users/{userId}/predefinedCode

🔐 Authorization

Authorization: Bearer <access_token>
Content-Type: application/json

📥 Path Parameter

ParameterTypeRequiredDescription
userIdString✅ YesUnique REL-ID user ID for which the code is being set.

🧾 Request Body

{
  "predefinedCode": "ACCESS123",
  "predefinedVerKey": "KEY456"
}
FieldTypeRequiredDescription
predefinedCodeString✅ YesThe access code or OTP value that should be set for the user.
predefinedVerKeyString❌ OptionalA verification key shown alongside the access code.

✅ Success Response

{
  "message": "Predefined code set successfully"
}

❌ Error Responses (Collapsible)

🔍 404 - User Not Found
{
  "timeStamp": "2023-05-30T12:33:32IST",
  "status": 404,
  "error": "Data not present.",
  "message": "User not found.",
  "path": "/v1/users/su1/predefinedCode"
}
⚠️ 422 - Invalid or Missing Fields
{
  "timeStamp": "2023-05-30T12:33:32IST",
  "status": 422,
  "error": "Invalid data.",
  "message": "Mandatory fields missing",
  "path": "/v1/users/u1/predefinedCode"
}
💥 500 - Internal Server Error
{
  "timeStamp": "2023-05-30T12:33:32IST",
  "status": 500,
  "error": "Internal Server Error",
  "message": "Unexpected error occurred while processing request",
  "path": "/v1/users/u1/predefinedCode"
}

📝 Notes

  • This API is typically used when the enterprise wants to control the activation code instead of letting REL-ID generate it dynamically.
  • The code set via this API will be used by the REL-ID SDK during device activation.