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:
https://developers.gosocket.net/api/v1/Document/GetRelatedDocumentshttps://developers-sbx.gosocket.net/api/v1/Document/GetRelatedDocumentsThe method has the following parameters:
| GetRelatedDocuments (request) | |||
|---|---|---|---|
| Parameter | Type | Description | Allowed values |
| UUID* | String | Country-level tax identifier of the document. | UUID (36 alphanumeric characters) |
| RFCEmisor* | String | Tax 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 = 13 | Alphanumeric characters [A-Z&Ñ]{3,4}[0-9]2(0[1-9] |
* Required
Request example

For this method we use Postman's Body tab.
- Select the method type. In this case, you must select POST.
- Enter the method URL.
- Enter the parameters shown in the table above with their corresponding values.
{
"UUID":"00000000-0000-0000-0000-000000000000",
"RFCEmisor":"ANJ235103JM8"
}- 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) | |||
|---|---|---|---|
| Parameter | Type | Description | Allowed values |
| Success | Boolean | Indicates whether the request executed successfully. | true: The request executed successfully. false: The request executed with some inconsistency. |
| GlobalDocumentId | String | null | 00000000-0000-0000-0000-000000000000 |
| CountryDocumentId | String | Tax identifier of the queried document (UUID). | null Queried UUID (36 alphanumeric characters). |
| OtherData | String | List of parents and/or children related to the document | null {} |
| OtherData.ListaPadres | String | Node containing the information of the uuid(s) that the queried document has as a parent | |
| OtherData.ListaPadres | String | This is the Parent UUID of the document | |
| OtherData.ListaPadres | String | This is the RFC of the issuer of the parent document | |
| OtherData.ListaPadres | String | This is the RFC of the receiver of the parent document | |
| OtherData.ListaHijos | String | Node containing the information of the uuid(s) that the queried document has as a child | |
| OtherData.ListaHijos | String | This is the child UUID of the document | |
| OtherData.ListaHijos | String | This is the RFC of the issuer of the child document | |
| OtherData.ListaHijos | String | This is the RFC of the receiver of the child document | |
| Messages | String | Details of the operation performed, request data, process status | Example: [ "WS Consulta CFDI relacionados RfcEmisor: ANJ235103JM8". "folio físcal: 239EF8DC-A6C7-3E87-AAC6-FF8244DE1FB5". "Clave: 2000", "Se encontraron CFDI relacionados" ] |
| ResponseValue | String | null | null |
| Code | String | Response 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 |
| Description | String | Indicates 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 |
| ErrorException | String | null | null |