Skip to main content

Overview

The Anticipos API provides several query operations to retrieve advance information based on different criteria. All queries support GraphQL field selection for optimized data retrieval.

GetAnticipos

Retrieves all advances in the system (legacy endpoint for basic advance listings).
query {
  getAnticipos {
    cedula
    estadoSolicitud
    cedulaSolicitante
  }
}

Response Fields

cedula
string
Identification number of the requester
estadoSolicitud
string
Current status of the advance request (e.g., “EN PROCESO”)
cedulaSolicitante
string
Identification number of the person requesting the advance

Example Response

{
  "data": {
    "getAnticipos": [
      {
        "cedula": "1234567890",
        "estadoSolicitud": "EN PROCESO",
        "cedulaSolicitante": "1234567890"
      }
    ]
  }
}

GetAnticipoById

Retrieves detailed information about a specific advance by its ID.
query {
  getAnticipoById(id: 123) {
    idAnticipo
    correo
    cedula
    nombre
    estado
    valor
    descripcion
    fechaRegistro
    fechaCambioEstado
    codigoRegistroSap
    beneficiario {
      idbeneficiario
      codigoBeneficiario
      razonSocial
      identificacionFiscal
      tipoBeneficiario {
        nombre
        valor
      }
      compania {
        nombre
        identificacionCompania
      }
    }
    ordenCompra {
      idOrdenCompra
      codigo
      valorCompra
    }
    tipoMoneda {
      nombre
      valor
    }
    porcentaje {
      nombre
      valor
    }
    cme {
      tipo
      descripcion
    }
  }
}

Parameters

id
integer
required
The unique identifier of the advance

Response Fields

idAnticipo
integer
Unique identifier of the advance
correo
string
Email address of the requester
cedula
string
Identification number of the requester
nombre
string
Full name of the requester
estado
string
Current state of the advance. Possible values:
  • INGRESADO: Initial state
  • REVISIÓN: Under review
  • APROBADO_T: First-level approved
  • APROBADO: Fully approved
  • RECHAZADO: Rejected by first approver
  • RECHAZADO_T: Rejected by second approver
  • VENCIDO: Expired
valor
decimal
Amount of the advance in the specified currency
valorMoneda
decimal
Exchange rate or currency value
descripcion
string
Description or justification for the advance
credito
string
Credit-related information
justifica
string
Justification details
suministro
string
Supply-related flag
fechaRegistro
datetime
Date and time when the advance was created
fechaCambioEstado
datetime
Date and time of last status change
observaciones
string
Additional observations or rejection reasons
claseDoc
string
SAP document class
texto
string
Text field for SAP integration
asignacion
string
Assignment code (includes payment date)
codigoRegistroSap
string
SAP document number assigned after approval
beneficiario
object
Beneficiary information:
  • idbeneficiario: Beneficiary ID
  • codigoBeneficiario: SAP beneficiary code
  • razonSocial: Legal name
  • identificacionFiscal: Tax ID
  • tipoBeneficiario: Beneficiary type (supplier, employee, etc.)
  • compania: Associated company
  • bloqueado: Blocked status
  • cupo: Credit limit
ordenCompra
object
Purchase order information (if applicable):
  • idOrdenCompra: Purchase order ID
  • codigo: PO code
  • valorCompra: Purchase order amount
  • beneficiario: PO beneficiary
tipoMoneda
object
Currency information from catalog:
  • nombre: Currency name
  • valor: Currency code (e.g., “USD”, “EUR”)
porcentaje
object
Percentage catalog entry (if advance is percentage-based)
motivoRechazo
object
Rejection reason (if rejected)
cme
object
Special payment condition (CME):
  • tipo: CME type code
  • descripcion: CME description

Example Response

{
  "data": {
    "getAnticipoById": {
      "idAnticipo": 123,
      "correo": "user@example.com",
      "cedula": "1234567890",
      "nombre": "Juan Pérez",
      "estado": "APROBADO",
      "valor": 5000.00,
      "valorMoneda": 1.0,
      "descripcion": "Anticipo para compra de materiales",
      "fechaRegistro": "2024-03-05T10:30:00",
      "fechaCambioEstado": "2024-03-05T14:20:00",
      "codigoRegistroSap": "5000012345",
      "beneficiario": {
        "idbeneficiario": 456,
        "codigoBeneficiario": "PROV001",
        "razonSocial": "Proveedor XYZ S.A.",
        "identificacionFiscal": "1790123456001",
        "tipoBeneficiario": {
          "nombre": "Proveedor",
          "valor": "K"
        },
        "compania": {
          "nombre": "Empresa ABC",
          "identificacionCompania": "1000"
        }
      },
      "ordenCompra": {
        "idOrdenCompra": 789,
        "codigo": "4500123456",
        "valorCompra": 10000.00
      },
      "tipoMoneda": {
        "nombre": "Dólar",
        "valor": "USD"
      },
      "cme": {
        "tipo": "Z001",
        "descripcion": "Anticipo a Proveedores"
      }
    }
  }
}

GetAnticipoByBeneficiarioOC

Retrieves all active advances for a specific beneficiary and purchase order combination.
query {
  getAnticipoByBeneficiarioOC(codigo: 456, orden: 789) {
    idAnticipo
    estado
    valor
    fechaRegistro
    beneficiario {
      razonSocial
      codigoBeneficiario
    }
    ordenCompra {
      codigo
      valorCompra
    }
  }
}

Parameters

codigo
integer
required
The beneficiary ID
orden
integer
required
The purchase order ID

Response Fields

Returns an array of advances with the same structure as GetAnticipoById.
This query automatically filters out advances in the following states:
  • INGRESADO
  • RECHAZADO
  • RECHAZADO_T
  • VENCIDO
Only active advances (in review, approved, or approved by treasury) are returned.

Example Response

{
  "data": {
    "getAnticipoByBeneficiarioOC": [
      {
        "idAnticipo": 123,
        "estado": "APROBADO",
        "valor": 5000.00,
        "fechaRegistro": "2024-03-05T10:30:00",
        "beneficiario": {
          "razonSocial": "Proveedor XYZ S.A.",
          "codigoBeneficiario": "PROV001"
        },
        "ordenCompra": {
          "codigo": "4500123456",
          "valorCompra": 10000.00
        }
      }
    ]
  }
}

GetAllAnticiposByCorreo

Retrieves all advances created by a specific user (by email).
query {
  getAllAnticiposByCorreo(correo: "user@example.com") {
    idAnticipo
    nombre
    estado
    valor
    descripcion
    fechaRegistro
    fechaCambioEstado
    beneficiario {
      razonSocial
      codigoBeneficiario
    }
    tipoMoneda {
      valor
    }
  }
}

Parameters

correo
string
required
Email address of the user

Response Fields

Returns an array of advances with full detail including beneficiary and purchase order information.

GetAllAnticiposActivos

Retrieves all active advances in the system (excluding those in INGRESADO state).
query {
  getAllAnticiposActivos {
    idAnticipo
    correo
    nombre
    estado
    valor
    fechaRegistro
    beneficiario {
      razonSocial
      codigoBeneficiario
      tipoBeneficiario {
        valor
      }
    }
    tipoMoneda {
      valor
    }
  }
}

Response Fields

Returns an array of all active advances with complete information including beneficiary details, purchase order, currency type, and CME information.
Use this query for dashboard views or reporting that needs to show all advances currently in the system, excluding drafts.

GetAnticipoByUser

Retrieves a specific advance if the requesting user is the owner.
query {
  getAnticipoByUser(id_ant: 123, correo: "user@example.com") {
    idAnticipo
    estado
    valor
    descripcion
    # ... other fields
  }
}

Parameters

id_ant
integer
required
The advance ID
correo
string
required
Email address of the requesting user
This query returns null if the advance does not belong to the specified user, providing a security layer to prevent unauthorized access to advance details.

Approval Queries

GetAprobadorByAnticipo

Retrieves the first-level approver for a specific advance.
query {
  getAprobadorByAnticipo(id: 123) {
    idAprobacion
    nivel
    estado
    aprobador {
      id
      nombre
      email
    }
  }
}

GetAprobadoresByAnticipo

Retrieves all approvers (both levels) for a specific advance.
query {
  getAprobadoresByAnticipo(id: 123) {
    idAprobacion
    nivel
    estado
    sistema
    aprobador {
      id
      nombre
      email
    }
    anticipo {
      idAnticipo
      estado
    }
  }
}

GetAllAprobacionByAnticipos

Retrieves approvals for multiple advances.
query {
  getAllAprobacionByAnticipos(anticipos: [123, 124, 125]) {
    idAprobacion
    nivel
    estado
    aprobador {
      nombre
      email
    }
    anticipo {
      idAnticipo
      valor
    }
  }
}

Parameters

anticipos
integer[]
required
Array of advance IDs

Query Optimization Tips

GraphQL allows you to request only the fields you need. For list views, request minimal fields to improve performance:
query {
  getAllAnticiposActivos {
    idAnticipo
    estado
    valor
  }
}
Instead of querying all advances and filtering client-side, use specific queries like GetAnticipoByBeneficiarioOC or GetAllAnticiposByCorreo to reduce data transfer.
The API automatically includes related objects (beneficiary, purchase order, etc.) through Entity Framework Include statements. Request nested fields when you need complete information:
beneficiario {
  razonSocial
  tipoBeneficiario {
    valor
  }
  compania {
    nombre
  }
}

Error Handling

All queries follow GraphQL error conventions:
{
  "errors": [
    {
      "message": "IndAntAnticipoDTO not found.",
      "extensions": {
        "code": "IndAntAnticipoDTO_NOT_FOUND"
      }
    }
  ]
}
Common error codes:
  • IndAntAnticipoDTO_NOT_FOUND: Advance not found
  • UNAUTHORIZED: User not authorized to access this advance