Skip to main content

The Spanish version is the authoritative reference. View in Spanish

Method to Query Related Documents (GetRelatedDocuments)

If the document we want to cancel has other related documents, those related documents must be canceled first before proceeding with the cancellation of the main document.

To identify linked documents, the POST GetRelatedDocuments method can be used. To use this method, enter the URL according to the environment to be consumed:

PRODUCTIONhttps://developers.gosocket.net/api/v1/Document/GetRelatedDocuments
SANDBOXhttps://developers-sbx.gosocket.net/api/v1/Document/GetRelatedDocuments

The method has the following parameters:

GetRelatedDocuments (request)
ParameterTypeDescriptionAllowed values
UUID*StringCountry-level tax identifier of the document.UUID (36 alphanumeric characters)
RFCEmisor*StringTax ID of the document issuer Legal Entities: Made up of 3 letters followed by 6 digits and 3 alphanumeric characters = 12 Individuals: Made up of 4 letters followed by 6 digits and 3 alphanumeric characters = 13Alphanumeric characters [A-Z&Ñ]{3,4}[0-9]2(0[1-9]

* Required


Request example

image-20250827-152118.png

For this method we use Postman's Body tab.

  1. Select the method type. In this case, you must select POST.
  2. Enter the method URL.
  3. Enter the parameters shown in the table above with their corresponding values.
{
"UUID":"00000000-0000-0000-0000-000000000000",
"RFCEmisor":"ANJ235103JM8"
}
  1. Press Send.

Note: Remember that before using the method, you must authenticate within the Authorization tab and enable the company to consume it.


Response example

The Tax Authority responds to queries through the API as follows:

Successful result: With related CFDIs: Children List

{
"Success": true,
"GlobalDocumentId": "00000000-0000-0000-0000-000000000000",
"CountryDocumentId": "239EF8DC-A6C7-3E87-AAC6-FF8244DE1FB5",
"OtherData": {
"ListaHijos": "[{\"Uuid\":\"451EF0DC-A8C9-5E09-AAC8-FF0466DE3FB7\",\"RfcEmisor\":\"ANJ235103JM8\",\"RfcReceptor\":\"PEP201306OSE\"}]"
},
"Messages": [
"WS Consulta CFDI relacionados RfcEmisor: ANJ235103JM8",
"folio físcal: 239EF8DC-A6C7-3E87-AAC6-FF8244DE1FB5",
"Clave: 2000",
"Se encontraron CFDI relacionados"
],
"ResponseValue": null,
"Code": "2000",
"Description": "Se encontraron CFDI relacionados",
"ErrorException": null
}

Successful result: With related CFDIs: Parents List

{
"Success": true,
"GlobalDocumentId": "00000000-0000-0000-0000-000000000000",
"CountryDocumentId": "451EF0DC-A8C9-5E09-AAC8-FF0466DE3FB7",
"OtherData": {
"ListaPadres": "[{\"Uuid\":\"239EF8DC-A6C7-3E87-AAC6-FF8244DE1FB5\",\"RfcEmisor\":\"ANJ235103JM8\",\"RfcReceptor\":\"PEP201306OSE\"}]"
},
"Messages": [
"WS Consulta CFDI relacionados RfcEmisor: ANJ235103JM8",
"folio físcal: 451EF0DC-A8C9-5E09-AAC8-FF0466DE3FB7",
"Clave: 2000",
"Se encontraron CFDI relacionados"
],
"ResponseValue": null,
"Code": "2000",
"Description": "Se encontraron CFDI relacionados",
"ErrorException": null
}

Successful result: Without related CFDIs

{
"Success": true,
"GlobalDocumentId": "00000000-0000-0000-0000-000000000000",
"CountryDocumentId": "451EF0DC-A8C9-5E09-AAC8-FF0466DE3FB7",
"OtherData": {},
"Messages": [
"WS Consulta CFDI relacionados RfcEmisor: ANJ235103JM8",
"folio físcal: 451EF0DC-A8C9-5E09-AAC8-FF0466DE3FB7",
"Clave: 2001",
"No existen CFDI relacionados"
],
"ResponseValue": null,
"Code": "2001",
"Description": "No existen CFDI relacionados",
"ErrorException": null
}

If the sending result is NOT successful, the Inbox API will respond with an error message:

Document not found in the database:

{
"Success": false,
"GlobalDocumentId": "00000000-0000-0000-0000-000000000000",
"CountryDocumentId": "33331867-1765-49C2-8CC3-8E0E602CDA72",
"OtherData": null,
"Messages": [
"Documento no encontrado"
],
"ResponseValue": null,
"Code": "500",
"Description": "Documento no encontrado",
"ErrorException": null
}

Company not active to consume the method:

{
"Success": false,
"GlobalDocumentId": "00000000-0000-0000-0000-000000000000",
"CountryDocumentId": null,
"OtherData": null,
"Messages": null,
"ResponseValue": "Permis Required",
"Code": "500",
"Description": "Empresa no activa para utilizar el evento CancelFunction",
"ErrorException": null
}

Error with the client certificate:

{
"Success": false,
"GlobalDocumentId": "00000000-0000-0000-0000-000000000000",
"CountryDocumentId": "239EF8DC-A6C7-3E87-AAC6-FF8244DE1FB5",
"OtherData": null,
"Messages": [
"Regla: Error de Certificado, verifique el certificado y reintente nuevamente. Failed to load certificate after retries"
],
"ResponseValue": null,
"Code": "500",
"Description": "Regla: Error de Certificado, verifique el certificado y reintente nuevamente. Failed to load certificate after retries",
"ErrorException": null
}

Error with the client certificate:

{
"Success": false,
"GlobalDocumentId": "00000000-0000-0000-0000-000000000000",
"CountryDocumentId": "239EF8DC-A6C7-3E87-AAC6-FF8244DE1FB5",
"OtherData": null,
"Messages": [
"Regla: Error de Certificado, verifique el certificado y reintente nuevamente. .Cer or .Key estan vacios para el accountCode: ANJ235103JM8"
],
"ResponseValue": null,
"Code": "500",
"Description": "Regla: Error de Certificado, verifique el certificado y reintente nuevamente. .Cer or .Key estan vacios para el accountCode: ANJ235103JM8",
"ErrorException": null
}

Interpreting the Response

To correctly interpret the response, take into account the following criteria:

GetRelatedDocuments (response)
ParameterTypeDescriptionAllowed values
SuccessBooleanIndicates whether the request executed successfully.true: The request executed successfully. false: The request executed with some inconsistency.
GlobalDocumentIdStringnull00000000-0000-0000-0000-000000000000
CountryDocumentIdStringTax identifier of the queried document (UUID).null Queried UUID (36 alphanumeric characters).
OtherDataStringList of parents and/or children related to the documentnull {}
OtherData.ListaPadresStringNode containing the information of the uuid(s) that the queried document has as a parent
OtherData.ListaPadresStringThis is the Parent UUID of the document
OtherData.ListaPadresStringThis is the RFC of the issuer of the parent document
OtherData.ListaPadresStringThis is the RFC of the receiver of the parent document
OtherData.ListaHijosStringNode containing the information of the uuid(s) that the queried document has as a child
OtherData.ListaHijosStringThis is the child UUID of the document
OtherData.ListaHijosStringThis is the RFC of the issuer of the child document
OtherData.ListaHijosStringThis is the RFC of the receiver of the child document
MessagesStringDetails of the operation performed, request data, process statusExample: [ "WS Consulta CFDI relacionados RfcEmisor: ANJ235103JM8". "folio físcal: 239EF8DC-A6C7-3E87-AAC6-FF8244DE1FB5". "Clave: 2000", "Se encontraron CFDI relacionados" ]
ResponseValueStringnullnull
CodeStringResponse code for the process* 2000: Related CFDIs found * 2001: No related CFDIs exist * 2002: The tax folio does not belong to the receiver * 2003: The query exceeds the maximum allowed number of tax folios * 2004: The tax folio does not belong to the issuer * 0: RelatedDocument - some error exists * 404: Document not found * 500: Document not found
DescriptionStringIndicates the description of the process response code* 2000: Related CFDIs found * 2001: No related CFDIs exist * 2002: The tax folio does not belong to the receiver * 2003: The query exceeds the maximum allowed number of tax folios * 2004: The tax folio does not belong to the issuer * 0: RelatedDocument - some error exists * 404: Document not found * 500: Document not found
ErrorExceptionStringnullnull