Update user private data
PATCH
/api/users/[user_id]/private_data
Updates specified fields within the user's private data. Only the data provided in the request will be updated. Field values can be strings, booleans, numbers, arrays, or objects. To unset a key, pass a `null` value for that key. Due to the sensitive nature of this data, ensure that only authorized backend applications have access to this endpoint.
Path Parameters
user_id
string
Required
The ID of the user whose private data should be updated.
Body Parameters
private_data
object
Required
An object containing fields to update within the user's private data. Only the data provided in the object will be updated. Field values can be strings, booleans, numbers, arrays, or objects. To unset a key, pass a null value for that key.
Authentication
X-API-KEY
header
Required
The API key is essential for accessing MonoCloud's APIs. You can find it in the Tenant Settings section of your MonoCloud dashboard. To authenticate your requests, include this key in the request header using the following format: X-API-Key: <Your_API_Key>.
Headers
content-type
string
- application/json
accept
string
- application/json
- application/problem+json
Responses
200
Successfully updated the fields for the user's private data
400
Bad Request
422
Client Error
404
Not Found
401
Unauthorized
403
Forbidden
Request Example
Request
curl -X PATCH "https://<your-domain>/api/users/{user_id}/private_data" \
-H "X-API-KEY: <your-api-key>" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
--data-raw '{
"private_data" : {
"transaction_ids" : ["5GRZ4X7XUItpRGOwkHhONqTtG", "9Fw7Jx9Zja5lWlmRkYJf1WMV9"],
"subscription_plan" : "premium",
"last_renewed" : 1672511400
}
}'
Response Example
Response
200 OK
{
"private_data": {
"transaction_ids": [
"5GRZ4X7XUItpRGOwkHhONqTtG",
"9Fw7Jx9Zja5lWlmRkYJf1WMV9"
],
"subscription_plan": "premium",
"last_renewed": 1672511400
}
}