curl --request PUT \
--url https://api.credira.com/v1/users/user_123456789 \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"name": "John Smith",
"role": "senior_billing_manager",
"department": "finance",
"phone": "+1987654321",
"status": "active",
"permissions": [
"calls:read",
"calls:write",
"emails:read",
"emails:write",
"callouts:read",
"callouts:write",
"users:read"
],
"metadata": {
"subscription_plan": "enterprise",
"timezone": "America/Los_Angeles",
"language": "en",
"notes": "Promoted to senior role"
}
}'
const userId = "user_123456789";
const response = await fetch(`https://api.credira.com/v1/users/${userId}`, {
method: "PUT",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "John Smith",
role: "senior_billing_manager",
department: "finance",
phone: "+1987654321",
status: "active",
permissions: [
"calls:read",
"calls:write",
"emails:read",
"emails:write",
"callouts:read",
"callouts:write",
"users:read",
],
metadata: {
subscription_plan: "enterprise",
timezone: "America/Los_Angeles",
language: "en",
notes: "Promoted to senior role",
},
}),
});
const data = await response.json();
console.log(data);
{
"success": true,
"data": {
"id": "user_123456789",
"email": "john.doe@company.com",
"name": "John Smith",
"company": "Acme Corporation",
"role": "senior_billing_manager",
"department": "finance",
"phone": "+1987654321",
"account_id": "acc_789123456",
"status": "active",
"created_time": "2024-01-15T10:30:00Z",
"updated_time": "2024-01-15T10:30:00Z",
"last_login": "2024-01-20T09:15:00Z",
"permissions": [
"calls:read",
"calls:write",
"emails:read",
"emails:write",
"callouts:read",
"callouts:write",
"users:read"
],
"activity_stats": {
"total_calls_made": 45,
"total_emails_sent": 120,
"total_callouts_created": 8,
"last_activity": "2024-01-20T09:15:00Z"
},
"metadata": {
"subscription_plan": "enterprise",
"timezone": "America/Los_Angeles",
"language": "en",
"notes": "Promoted to senior role"
}
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789",
"message": "User updated successfully"
}
}
Users
Update User
Update user account details and settings
PUT
/
users
/
{id}
curl --request PUT \
--url https://api.credira.com/v1/users/user_123456789 \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"name": "John Smith",
"role": "senior_billing_manager",
"department": "finance",
"phone": "+1987654321",
"status": "active",
"permissions": [
"calls:read",
"calls:write",
"emails:read",
"emails:write",
"callouts:read",
"callouts:write",
"users:read"
],
"metadata": {
"subscription_plan": "enterprise",
"timezone": "America/Los_Angeles",
"language": "en",
"notes": "Promoted to senior role"
}
}'
const userId = "user_123456789";
const response = await fetch(`https://api.credira.com/v1/users/${userId}`, {
method: "PUT",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "John Smith",
role: "senior_billing_manager",
department: "finance",
phone: "+1987654321",
status: "active",
permissions: [
"calls:read",
"calls:write",
"emails:read",
"emails:write",
"callouts:read",
"callouts:write",
"users:read",
],
metadata: {
subscription_plan: "enterprise",
timezone: "America/Los_Angeles",
language: "en",
notes: "Promoted to senior role",
},
}),
});
const data = await response.json();
console.log(data);
{
"success": true,
"data": {
"id": "user_123456789",
"email": "john.doe@company.com",
"name": "John Smith",
"company": "Acme Corporation",
"role": "senior_billing_manager",
"department": "finance",
"phone": "+1987654321",
"account_id": "acc_789123456",
"status": "active",
"created_time": "2024-01-15T10:30:00Z",
"updated_time": "2024-01-15T10:30:00Z",
"last_login": "2024-01-20T09:15:00Z",
"permissions": [
"calls:read",
"calls:write",
"emails:read",
"emails:write",
"callouts:read",
"callouts:write",
"users:read"
],
"activity_stats": {
"total_calls_made": 45,
"total_emails_sent": 120,
"total_callouts_created": 8,
"last_activity": "2024-01-20T09:15:00Z"
},
"metadata": {
"subscription_plan": "enterprise",
"timezone": "America/Los_Angeles",
"language": "en",
"notes": "Promoted to senior role"
}
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789",
"message": "User updated successfully"
}
}
Update user account information, permissions, and settings.
Only certain fields can be updated depending on the user’s role and
permissions. Some fields require special privileges to modify.
Request
string
required
The unique identifier of the user to update
string
The full name of the user
string
The role of the user within the organization
string
The department the user belongs to
string
The phone number of the user
string
User account status (active, inactive, suspended)
array
Array of permissions to grant to the user
object
Additional metadata for the user account
string
required
Bearer token for API authentication
curl --request PUT \
--url https://api.credira.com/v1/users/user_123456789 \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"name": "John Smith",
"role": "senior_billing_manager",
"department": "finance",
"phone": "+1987654321",
"status": "active",
"permissions": [
"calls:read",
"calls:write",
"emails:read",
"emails:write",
"callouts:read",
"callouts:write",
"users:read"
],
"metadata": {
"subscription_plan": "enterprise",
"timezone": "America/Los_Angeles",
"language": "en",
"notes": "Promoted to senior role"
}
}'
const userId = "user_123456789";
const response = await fetch(`https://api.credira.com/v1/users/${userId}`, {
method: "PUT",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "John Smith",
role: "senior_billing_manager",
department: "finance",
phone: "+1987654321",
status: "active",
permissions: [
"calls:read",
"calls:write",
"emails:read",
"emails:write",
"callouts:read",
"callouts:write",
"users:read",
],
metadata: {
subscription_plan: "enterprise",
timezone: "America/Los_Angeles",
language: "en",
notes: "Promoted to senior role",
},
}),
});
const data = await response.json();
console.log(data);
{
"success": true,
"data": {
"id": "user_123456789",
"email": "john.doe@company.com",
"name": "John Smith",
"company": "Acme Corporation",
"role": "senior_billing_manager",
"department": "finance",
"phone": "+1987654321",
"account_id": "acc_789123456",
"status": "active",
"created_time": "2024-01-15T10:30:00Z",
"updated_time": "2024-01-15T10:30:00Z",
"last_login": "2024-01-20T09:15:00Z",
"permissions": [
"calls:read",
"calls:write",
"emails:read",
"emails:write",
"callouts:read",
"callouts:write",
"users:read"
],
"activity_stats": {
"total_calls_made": 45,
"total_emails_sent": 120,
"total_callouts_created": 8,
"last_activity": "2024-01-20T09:15:00Z"
},
"metadata": {
"subscription_plan": "enterprise",
"timezone": "America/Los_Angeles",
"language": "en",
"notes": "Promoted to senior role"
}
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789",
"message": "User updated successfully"
}
}
{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "Invalid request data"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789"
}
}
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789"
}
}
{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "You don't have permission to update this user"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789"
}
}
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "User not found"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789"
}
}
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid phone number format"
},
"meta": {
"timestamp": "2024-01-15T10:30:00Z",
"request_id": "req_123456789"
}
}
