{
  "info": {
    "name": "Digitra API (partners)",
    "description": "Colección de pruebas. Pon tu llave dgt_test_ en la variable api_key. Guía: guia-integracion.md",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://digitra.rentals"
    },
    {
      "key": "api_key",
      "value": "dgt_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    {
      "key": "external_id",
      "value": "GY-PRUEBA-0001"
    },
    {
      "key": "property_id",
      "value": "00000000-0000-0000-0000-000000000000"
    },
    {
      "key": "listing_id",
      "value": "listing-prueba-1"
    },
    {
      "key": "webhook_id",
      "value": "00000000-0000-0000-0000-000000000000"
    },
    {
      "key": "delivery_id",
      "value": "00000000-0000-0000-0000-000000000000"
    }
  ],
  "item": [
    {
      "name": "1. Propiedades",
      "item": [
        {
          "name": "Listar propiedades",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/properties",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "properties"
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Asociar listing_id",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/properties",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "properties"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"mappings\": [\n    {\n      \"property_id\": \"{{property_id}}\",\n      \"external_id\": \"{{listing_id}}\"\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        }
      ]
    },
    {
      "name": "2. Reservas",
      "item": [
        {
          "name": "Crear reserva",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/reservations",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "reservations"
              ]
            },
            "description": "Repetirla con el mismo cuerpo devuelve 200 con la misma reserva.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"external_id\": \"{{external_id}}\",\n  \"source\": \"guesty\",\n  \"property_external_id\": \"{{listing_id}}\",\n  \"check_in\": \"2026-10-10\",\n  \"check_out\": \"2026-10-12\",\n  \"guest_name\": \"María Pérez\",\n  \"guests_count\": 2,\n  \"guest_email\": \"huesped@ejemplo.com\",\n  \"metadata\": {\n    \"canal\": \"airbnb\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Crear reserva con rechazo TRA simulado (solo pruebas)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/reservations",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "reservations"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"external_id\": \"{{external_id}}-ERR\",\n  \"property_id\": \"{{property_id}}\",\n  \"check_in\": \"2026-10-15\",\n  \"check_out\": \"2026-10-16\",\n  \"guest_name\": \"Prueba Error\",\n  \"guests_count\": 1,\n  \"sandbox_simulate\": \"tra_failed\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Consultar estado",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/registrations?external_id={{external_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "registrations"
              ],
              "query": [
                {
                  "key": "external_id",
                  "value": "{{external_id}}"
                }
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Consultar estado con huéspedes",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/registrations?external_id={{external_id}}&include=guests",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "registrations"
              ],
              "query": [
                {
                  "key": "external_id",
                  "value": "{{external_id}}"
                },
                {
                  "key": "include",
                  "value": "guests"
                }
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Modificar",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/reservations",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "reservations"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"external_id\": \"{{external_id}}\",\n  \"check_out\": \"2026-10-13\",\n  \"guests_count\": 3\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Cancelar",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/reservations/cancel",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "reservations",
                "cancel"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"external_id\": \"{{external_id}}\",\n  \"reason\": \"Cancelada en Guesty\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        }
      ]
    },
    {
      "name": "3. Webhooks",
      "item": [
        {
          "name": "Registrar endpoint",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/webhooks",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "webhooks"
              ]
            },
            "description": "Guarda el secret: solo se muestra en esta respuesta.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"url\": \"https://tu-servidor.com/webhooks/digitra\",\n  \"events\": [\n    \"*\"\n  ],\n  \"include_guests\": true\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Listar endpoints",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/webhooks",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "webhooks"
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Enviar ping de prueba",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/webhooks/{{webhook_id}}/test",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "webhooks",
                "{{webhook_id}}",
                "test"
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Modificar endpoint",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/webhooks/{{webhook_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "webhooks",
                "{{webhook_id}}"
              ]
            },
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"events\": [\n    \"registration.completed\",\n    \"tra.reported\",\n    \"tra.failed\",\n    \"sire.reported\",\n    \"sire.failed\",\n    \"reservation.cancelled\"\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Rotar secreto",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/webhooks/{{webhook_id}}/rotate-secret",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "webhooks",
                "{{webhook_id}}",
                "rotate-secret"
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Historial de entregas",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/webhooks/deliveries?status=failed&limit=50",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "webhooks",
                "deliveries"
              ],
              "query": [
                {
                  "key": "status",
                  "value": "failed"
                },
                {
                  "key": "limit",
                  "value": "50"
                }
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Reenviar evento",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/webhooks/deliveries/{{delivery_id}}/redeliver",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "webhooks",
                "deliveries",
                "{{delivery_id}}",
                "redeliver"
              ]
            },
            "description": ""
          }
        },
        {
          "name": "Desactivar endpoint",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{api_key}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/partners/webhooks/{{webhook_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "partners",
                "webhooks",
                "{{webhook_id}}"
              ]
            },
            "description": ""
          }
        }
      ]
    }
  ]
}