# Ubicaciones

{% hint style="success" %}
**Producción:** <https://api.payvalida.com/utilities/locations>
{% endhint %}

{% hint style="success" %}
**Sandbox:** <https://api-test.payvalida.com/utilities/locations>
{% endhint %}

<mark style="color:blue;">`GET`</mark> `/utilities/locations`

#### Request Body

| Name    | Type   | Description                                                                               |
| ------- | ------ | ----------------------------------------------------------------------------------------- |
| country | String | Con este campo, obtendrás la lista de estados/provincias de éste.                         |
| state   | String | Con este campo y el campo *country*, obtendrás la lista de ciudades del estado/provincia. |

{% tabs %}
{% tab title="200: OK Ejemplos de respuestas OK" %}
{% tabs %}
{% tab title="Lista de países" %}

```
Request: {} // Request vacío

Response: { 
    "CODE": "0000",
    "DESC": "OK",
    "DATA": {
        "countries": [
            "Colombia",
            "Argentina",
            "Ecuador",
            "Peru",
            "Guatemala",
            "..."
        ]
    }
}
```

{% endtab %}

{% tab title="Lista de estados/provincias" %}

```
Request: {
    "country": "Colombia"
}

Response: {
    "CODE": "0000",
    "DESC": "OK",
    "DATA": {
        "states": [
            "Amazonas",
            "Antioquia",
            "Arauca",
            "..."
        ]
    }
}
```

{% endtab %}

{% tab title="Lista de ciudades" %}

```
Request: {
    "country": "Colombia",
    "state": "Antioquia"
}

Response: {
    "CODE": "0000",
    "DESC": "OK",
    "DATA": {
        "cities": [
            "Abejorral",
            "Abriaquí",
            "Alejandría",
            "Amagá",
            "Medellín",
            "..."
        ]
    }
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="200: OK Respuesta con error" %}
{% tabs %}
{% tab title="Request es incorrecto" %}

```
Request: {
    "country": "InvalidCountry",
    "state": InvalidValue
}

Response: { 
    "CODE": "0001",
    "DESC": "solicitud incorrecta"
}
```

{% endtab %}

{% tab title="País/Estado no encontrados" %}

```
Request: {
    "country": "InvalidCountry",
    "state": "InvalidState"
}

Response: { 
    "CODE": "0002",
    "DESC": "Error de procesamiento"
}
```

{% endtab %}
{% endtabs %}
{% 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.payvalida.com/api-recaudo/ubicaciones.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.
