Skip to main content
Creates a new user account. The action is role-gated server-side: only Gefe, Jefe, and Supervisor roles can create users, and each can only create users of roles lower than their own. Endpoint: USERS service — https://script.google.com/macros/s/AKfycbxAqyEcAHetH6yN4qccGILL-L3IzMSPVuVJ1kpuO86GqfDXTKP8cHrrB7UkKN1r_0g5/exec Action: createUser
The server generates the final username automatically if the provided Nombre_Usuario conflicts with an existing one — it appends a numeric suffix (e.g., juan.perezjuan.perez1). Always check the returned message to confirm the actual username created.
Creator roleRoles they can create
DesarrolladorDesarrollador, Gefe, Supervisor, Tecnico, Tecnico_exterior
Gefe / JefeSupervisor, Tecnico
SupervisorTecnico

Request

action
string
required
Must be "createUser".
payload.sessionToken
string
required
The active session token of the user performing the creation. Used to verify role permissions.
payload.newUser
object
required
Object containing the new user’s details.

Response

status
string
required
"success" on success, "error" on failure.
message
string
On success: "Usuario '<username>' creado." where <username> is the actual (possibly de-duplicated) username assigned.

Example

const USERS_ENDPOINT = 'https://script.google.com/macros/s/AKfycbxAqyEcAHetH6yN4qccGILL-L3IzMSPVuVJ1kpuO86GqfDXTKP8cHrrB7UkKN1r_0g5/exec';

const session = JSON.parse(localStorage.getItem('gpsepedia_session'));

const response = await fetch(USERS_ENDPOINT, {
  method: 'POST',
  headers: { 'Content-Type': 'text/plain' },
  body: JSON.stringify({
    action: 'createUser',
    payload: {
      sessionToken: session.SessionToken,
      newUser: {
        Nombre_Usuario: 'maria.garcia',
        Password: 'initialPass123',
        Privilegios: 'Tecnico',
        Nombre_Completo: 'María García',
        Telefono: '+1-555-0100',
        Correo_Electronico: '[email protected]'
      }
    }
  }),
  redirect: 'follow'
});

const result = await response.json();
if (result.status === 'success') {
  console.log(result.message); // "Usuario 'maria.garcia' creado."
}

Build docs developers (and LLMs) love