Update the fields of a person. Send only the fields to change. You can change your own person. To change another person, you must be an administrator. If you are not an administrator, the route ignores expiration_date, role, departments, active, is_bot, archived, studio_id, last_presence, the login failure fields and the LDAP, OIDC and SAML fields. To change your own email, give current_password too, and one of totp, email_otp, fido_authentication_response or recovery_code when two-factor authentication is enabled. You cannot change id, created_at, updated_at, password, jti, the two-factor fields and the preview account fields. You cannot change a preview account. You cannot deactivate a protected account of another person or change its role. You cannot activate a person who is not a bot when the user limit is reached. The route checks role, contract_type, country, locale, display_date_format, two_factor_authentication, email and expiration_date. A new expiration date cannot be in the past. When you change the expiration_date of a bot, the response gives a new access_token, unless the date is in the past. expiration_date uses the YYYY-MM-DD format.
curl -X PUT "http://api.example.com/data/persons/a24a6ea4-ce75-4665-a070-57453082c25" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@example.com",
"password": "newsecurepassword123",
"role": "manager",
"active": true,
"contract_type": "freelance",
"two_factor_authentication": "totp",
"expiration_date": "2025-12-31"
}'
import requests
url = "http://api.example.com/data/persons/a24a6ea4-ce75-4665-a070-57453082c25"
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json"
}
params = {}
payload = {
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@example.com",
"password": "newsecurepassword123",
"role": "manager",
"active": true,
"contract_type": "freelance",
"two_factor_authentication": "totp",
"expiration_date": "2025-12-31"
}
response = requests.put(
url,
headers=headers,
params=params,
json=payload
)
response.raise_for_status()
if response.content:
print(response.json())
{
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@example.com",
"role": "manager",
"active": true,
"contract_type": "freelance",
"expiration_date": "2025-12-31",
"current_password": "string",
"country": "FR"
}
{
"id": "a24a6ea4-ce75-4665-a070-57453082c250",
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@example.com",
"role": "manager",
"active": true,
"contract_type": "freelance",
"two_factor_authentication": "totp",
"departments": [
"string"
],
"country": "FR",
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T11:00:00Z"
}