Skip to main content
The Users API allows you to manage system users including sellers, administrators, and other staff members. Users can be assigned roles and permissions to control access to different parts of the system.

List Sellers

Returns all active users with the SELLER role.

Response

id
integer
required
User unique identifier
rut
string
Chilean tax ID (RUT)
email
string
User email address
name
string
required
User full name
role
string
User role (e.g., SELLER, ADMINISTRADOR)
role_id
integer
Associated role ID
is_active
boolean
required
Whether the user is active
is_owner
boolean
Whether the user is the tenant owner
role_obj
object
Detailed role information including permissions

Example

curl -X GET "https://api.torn.cl/api/users/sellers" \
  -H "Authorization: Bearer YOUR_TOKEN"
[
  {
    "id": 1,
    "rut": "12345678-9",
    "email": "[email protected]",
    "name": "Juan Pérez",
    "role": "SELLER",
    "role_id": 2,
    "is_active": true,
    "is_owner": false,
    "role_obj": {
      "id": 2,
      "name": "VENDEDOR",
      "can_perform_sales": true
    }
  }
]

List All Users

Returns all active users in the current tenant. Optionally filter by role.

Query Parameters

role
string
Filter users by role name (e.g., SELLER, ADMINISTRADOR)

Response

Returns an array of user objects with the same structure as the sellers endpoint.

Example

curl -X GET "https://api.torn.cl/api/users/?role=SELLER" \
  -H "Authorization: Bearer YOUR_TOKEN"

Create User

Creates a new user in both the global system and the local tenant. If the email doesn’t exist globally, a new SaaS user will be created.

Request Body

full_name
string
required
User’s full name
email
string
required
User’s email address (used for login)
password
string
Password for new users (required if email doesn’t exist)
rut
string
Chilean tax ID (RUT) - optional for staff
role_id
integer
Role ID to assign to the user

Response

Returns the created user object with status code 201.

Example

curl -X POST "https://api.torn.cl/api/users/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "full_name": "María González",
    "email": "[email protected]",
    "password": "securePassword123",
    "role_id": 2
  }'
{
  "id": 5,
  "rut": null,
  "email": "[email protected]",
  "name": "María González",
  "role": "VENDEDOR",
  "role_id": 2,
  "is_active": true,
  "is_owner": false,
  "role_obj": {
    "id": 2,
    "name": "VENDEDOR",
    "description": "Usuario de ventas",
    "can_perform_sales": true
  }
}

Update User

Updates an existing user’s information. The owner can only update their own name and password through this endpoint.

Path Parameters

user_id
integer
required
ID of the user to update

Request Body

full_name
string
User’s full name
email
string
User’s email address
password
string
New password for the user
role_id
integer
New role ID to assign
is_active
boolean
Whether the user is active

Response

Returns the updated user object.

Example

curl -X PUT "https://api.torn.cl/api/users/5" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "full_name": "María González Pérez",
    "role_id": 3
  }'

Deactivate User

Performs a soft delete by marking the user as inactive. The main administrator cannot deactivate themselves.

Path Parameters

user_id
integer
required
ID of the user to deactivate

Response

Returns status code 204 (No Content) on success.

Example

curl -X DELETE "https://api.torn.cl/api/users/5" \
  -H "Authorization: Bearer YOUR_TOKEN"

Error Responses

400
error
Cannot deactivate the main administrator
403
error
Cannot delete a system user
404
error
User not found

Build docs developers (and LLMs) love