# Cancelar dispersión

Las dispersiones por cumplimiento de la normatividad vigente no pueden ser eliminadas, sin embargo, al completar esta acción cambiarán su estado a canceladas y podrán visualizarlas en el reporte y API como `canceled`.

## Ruta

<mark style="color:red;">`DELETE`</mark> `v1/merchant/payout/{external_reference}`

## **Encabezado**

<table><thead><tr><th width="253">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>x-auth-token</code><mark style="color:red;">*</mark></td><td><p>Es el código generado a partir del proceso de autenticación.</p><p><em><code>Ejemplo: 8dsa819dj736f1d87fdhd172f12ddw</code></em></p></td></tr><tr><td><code>Content-Type</code><mark style="color:red;">*</mark></td><td><p>Es el tipo de contenido que se está enviando en la solicitud.</p><p><em><code>Ejemplo: application/json</code></em></p></td></tr><tr><td><code>child-id</code></td><td>Es el código de la cuenta que se busca administrar. Es opcional. Más info en el <a href="/pages/cmdh7wawmADehdqeF0JP#user-content-guia-de-uso-paso-a-paso-operar-en-nombre-de-una-cuenta-administrada">link</a><br><em><code>Ejemplo: negociohijo</code></em></td></tr></tbody></table>

## **Respuesta**

{% tabs %}
{% tab title="200" %}

```json
{
    "message": "The dispersion has been successfully canceled.",
    "updated_at": "2024-08-27T10:01:20-05:00"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "error": "Only dispersions in the CREATED or SCHEDULED state can be canceled."
}
```

{% endtab %}
{% endtabs %}

***

## Ejemplo

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location --request DELETE '{{base_url}/v1/merchant/payout/external_reference/{{reference}}' \
--header 'x-auth-token: {{token}}' \
--data ''
```

{% endtab %}

{% tab title="NodeJS (Axios)" %}

```javascript
const axios = require('axios');
let data = '';

let config = {
  method: 'delete',
  maxBodyLength: Infinity,
  url: `${base_url}/v1/merchant/payout/external_reference/${reference}`,
  headers: { 
    'x-auth-token': token //Añadir token
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = f"{base_url}/v1/merchant/payout/external_reference/{reference}"

payload = ""
headers = {
  'x-auth-token': token #Añadir token
}

response = requests.request("DELETE", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.qentaz.com/documentation/dispersiones/cancelar-dispersion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
