Skip to main content

Overview

The Credentials Management API allows you to create, update, and manage employee credentials (accounts/badges) for accessing various systems and facilities. This includes managing credential types and associating credentials with employees, departments, and units.

Understanding Credentials

Credentials in the Integra system represent:
  • Access badges for physical locations
  • System login accounts
  • Department-specific access credentials
  • Unit-based authentication tokens
Each credential is associated with:
  • A credential type (badge type, account type)
  • An employee or department
  • A specific unit/location
  • Optional username and password

Creating Credentials

Register new credentials for employees or departments.
1

Prepare credential data

Endpoint: POST /credencialesRequest Body:
{
  "usuario": "jgarcia",
  "clave": "SecurePassword123",
  "idTipoCuenta": 1,
  "idDepartamento": 10,
  "idUnidad": 5,
  "nota": "Credencial de acceso principal"
}
Required Fields:
  • usuario - Username/credential identifier (required, cannot be empty)
  • idTipoCuenta - Credential type ID (required)
  • idDepartamento - Department ID associated with the credential (required)
  • idUnidad - Unit ID where credential is valid (required)
Optional Fields:
  • clave - Password or access code
  • nota - Additional notes or description
2

Submit credential creation

curl -X POST https://api.example.com/credenciales \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "usuario": "jgarcia",
    "clave": "SecurePassword123",
    "idTipoCuenta": 1,
    "idDepartamento": 10,
    "idUnidad": 5,
    "nota": "Credencial de acceso principal"
  }'
3

Confirm creation

Success Response (200 OK):
{
  "data": null,
  "message": "Cuenta registrada"
}
The credential has been successfully created and is ready for use.

Retrieving Credentials

Query existing credentials using various filters.
1

Apply filters

Endpoint: GET /credencialesQuery Parameters:
  • idTipo - Filter by credential type ID
  • idDepartamento - Filter by department ID
  • idUnidad - Filter by unit ID
All parameters are optional and can be combined.
2

Execute query

Example: Get all credentials for a department
curl -X GET "https://api.example.com/credenciales?idDepartamento=10" \
  -H "Authorization: Bearer YOUR_TOKEN"
Example: Get credentials by type and unit
curl -X GET "https://api.example.com/credenciales?idTipo=1&idUnidad=5" \
  -H "Authorization: Bearer YOUR_TOKEN"
Example: Get all credentials for a specific unit
curl -X GET "https://api.example.com/credenciales?idUnidad=5" \
  -H "Authorization: Bearer YOUR_TOKEN"
3

Process credential list

Success Response (200 OK):
{
  "data": [
    {
      "id": 101,
      "usuario": "jgarcia",
      "tipoCuenta": {
        "id": 1,
        "nombre": "Acceso Principal"
      },
      "departamento": {
        "id": 10,
        "nombre": "Operaciones"
      },
      "unidad": {
        "id": 5,
        "nombre": "Unidad Centro"
      },
      "nota": "Credencial de acceso principal",
      "activo": true,
      "fechaCreacion": "2026-03-01T10:30:00"
    },
    {
      "id": 102,
      "usuario": "mrodriguez",
      "tipoCuenta": {
        "id": 2,
        "nombre": "Supervisor"
      },
      "departamento": {
        "id": 10,
        "nombre": "Operaciones"
      },
      "unidad": {
        "id": 5,
        "nombre": "Unidad Centro"
      },
      "nota": "Credencial supervisor de área",
      "activo": true,
      "fechaCreacion": "2026-03-02T14:15:00"
    }
  ],
  "message": "Cuentas registradas"
}

Updating Credentials

Modify existing credential information.
1

Prepare update data

Endpoint: PUT /credenciales/{id}Path Parameters:
  • id - Credential ID to update
Request Body:
{
  "usuario": "jgarcia_updated",
  "clave": "NewPassword456",
  "idTipoCuenta": 2,
  "idDepartamento": 10,
  "idUnidad": 5,
  "nota": "Credencial actualizada - acceso supervisor"
}
All fields from the creation request can be updated.
2

Submit update

curl -X PUT https://api.example.com/credenciales/101 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "usuario": "jgarcia_updated",
    "clave": "NewPassword456",
    "idTipoCuenta": 2,
    "idDepartamento": 10,
    "idUnidad": 5,
    "nota": "Credencial actualizada - acceso supervisor"
  }'
3

Verify update

Success Response (200 OK):
{
  "data": null,
  "message": "Cuenta actualizada"
}

Deleting Credentials

Remove credentials that are no longer needed.
1

Delete credential

Endpoint: DELETE /credenciales/{id}Path Parameters:
  • id - Credential ID to delete
curl -X DELETE https://api.example.com/credenciales/101 \
  -H "Authorization: Bearer YOUR_TOKEN"
2

Confirm deletion

Success Response (200 OK):
{
  "data": null,
  "message": "Cuenta eliminada"
}
The credential has been permanently removed from the system.

Managing Credential Types

Credential types define different categories of access credentials (e.g., employee badge, supervisor access, admin account).

Viewing Credential Types

1

Retrieve all types

Endpoint: GET /credenciales/tipos
curl -X GET https://api.example.com/credenciales/tipos \
  -H "Authorization: Bearer YOUR_TOKEN"
2

Review available types

Success Response (200 OK):
{
  "data": [
    {
      "id": 1,
      "nombre": "Acceso Principal"
    },
    {
      "id": 2,
      "nombre": "Supervisor"
    },
    {
      "id": 3,
      "nombre": "Administrador"
    },
    {
      "id": 4,
      "nombre": "Temporal"
    }
  ],
  "message": "Tipos de cuentas"
}

Creating Credential Types

1

Define new type

Endpoint: POST /credenciales/tipoRequest Body:
{
  "nombre": "Acceso Nocturno"
}
Required Fields:
  • nombre - Type name (required, cannot be empty)
curl -X POST https://api.example.com/credenciales/tipo \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "nombre": "Acceso Nocturno"
  }'
2

Confirm type creation

Success Response (200 OK):
{
  "data": null,
  "message": "Tipo registrado"
}

Updating Credential Types

1

Update type information

Endpoint: PUT /credenciales/tipo/{id}Path Parameters:
  • id - Credential type ID
Request Body:
{
  "nombre": "Acceso Nocturno Actualizado"
}
curl -X PUT https://api.example.com/credenciales/tipo/4 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "nombre": "Acceso Nocturno Actualizado"
  }'
2

Verify type update

Success Response (200 OK):
{
  "data": null,
  "message": "Tipo actualizado"
}

Deleting Credential Types

1

Remove credential type

Endpoint: DELETE /credenciales/tipo/{id}Path Parameters:
  • id - Credential type ID to delete
curl -X DELETE https://api.example.com/credenciales/tipo/4 \
  -H "Authorization: Bearer YOUR_TOKEN"
Ensure no active credentials are using this type before deletion, or they will become invalid.
2

Confirm type deletion

Success Response (200 OK):
{
  "data": null,
  "message": "Tipo eliminado"
}

Common Use Cases

Creating Employee Badge Credentials

curl -X POST https://api.example.com/credenciales \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "usuario": "BADGE-12345",
    "idTipoCuenta": 1,
    "idDepartamento": 10,
    "idUnidad": 5,
    "nota": "Badge físico para acceso a instalaciones"
  }'

Creating System Login Accounts

curl -X POST https://api.example.com/credenciales \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "usuario": "jgarcia",
    "clave": "SecurePassword123",
    "idTipoCuenta": 2,
    "idDepartamento": 10,
    "idUnidad": 5,
    "nota": "Cuenta de sistema para aplicación web"
  }'

Querying Credentials by Department

curl -X GET "https://api.example.com/credenciales?idDepartamento=10" \
  -H "Authorization: Bearer YOUR_TOKEN"

Updating Credential Password

curl -X PUT https://api.example.com/credenciales/101 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "usuario": "jgarcia",
    "clave": "NewSecurePassword789",
    "idTipoCuenta": 2,
    "idDepartamento": 10,
    "idUnidad": 5,
    "nota": "Password actualizado por política de seguridad"
  }'

Best Practices

Security

  • Use strong passwords for credential clave field
  • Regularly update passwords for system accounts
  • Delete credentials immediately when employees leave
  • Assign appropriate credential types based on access needs

Organization

  • Use meaningful usernames that identify the credential purpose
  • Document credential assignments in the nota field
  • Group credentials by department for easier management
  • Create specific credential types for different access levels

Maintenance

  • Periodically audit credentials by department and unit
  • Remove unused credential types
  • Update credential information when employees change roles
  • Maintain consistent naming conventions for usernames

Reference

Controller: CredencialController.java at /credenciales/controller/CredencialController.java:1 Related Models:
  • NuevaCuenta.java - Credential creation/update request
  • TipoCuenta.java - Credential type model
  • FiltroCuenta - Credential filter parameters
  • CuentaEntityDto - Credential query response

Next Steps

Employee Management

Associate credentials with employees

Attendance Recording

Use credentials for attendance tracking

Build docs developers (and LLMs) love