POST /api/users/{user_id}/activate
Sets a user’s is_active flag to true, restoring their ability to authenticate and use the API. This endpoint is restricted to administrators.
Authentication
Requires a valid Bearer access token. The authenticated user must have the admin role.
Authorization: Bearer <access_token>
Path Parameters
The ID of the user to activate.
Request Body
No request body is required.
Response
true when the activation succeeds.
Human-readable confirmation message.
The updated user object with is_active: true.
Unique identifier for the user.
The user’s unique username.
The user’s email address.
Concatenation of first_name and last_name. Falls back to username if names are not set.
true — the account is now active.
Role name. Either admin or user.
Human-readable description of the role.
ISO 8601 timestamp of when the user was created.
ISO 8601 timestamp of the last update.
Errors
| Status | Description |
|---|
401 | Missing or invalid access token. |
403 | The authenticated user does not have the admin role. |
404 | No user exists with the given user_id. |
Example
curl -X POST "https://task-forge-gbd6h8gtg8hchve9.chilecentral-01.azurewebsites.net/api/users/42/activate" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
{
"success": true,
"message": "Usuario activado con exito",
"data": {
"id": 42,
"username": "jdoe",
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"is_active": true,
"role": {
"id": 2,
"name": "user",
"description": "Standard user"
},
"created_at": "2024-01-15T10:30:00",
"updated_at": "2024-03-17T14:00:00"
}
}