# /personas

## sendBill

<mark style="color:green;">`POST`</mark> `URL /personas/v1/sendBill`

Envío de documentos

#### Request Body

| Name                                           | Type   | Description                                                                                                                                                                                                                                                                                                                                                     |
| ---------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| personaId<mark style="color:red;">\*</mark>    | string | Identificador de tu empresa                                                                                                                                                                                                                                                                                                                                     |
| personaToken<mark style="color:red;">\*</mark> | string | Token de acceso de tu empresa                                                                                                                                                                                                                                                                                                                                   |
| fileName<mark style="color:red;">\*</mark>     | string | <p>Nombre que usaremos para el archivo XML según parámetros de SUNAT. <strong><code>RRRRRRRRRRR-TT-SSSS-CCCCCCCC</code></strong><br><br>Donde:<br><strong>R</strong> = RUC (11 dígitos)<br><strong>T</strong> = Código de tipo de documento (2 dígitos)<br><strong>S</strong> = Serie (4 caracteres)<br><strong>C</strong> = Número correlativo (8 dígitos)</p> |
| documentBody<mark style="color:red;">\*</mark> | object | Objeto con todos los datos del documento                                                                                                                                                                                                                                                                                                                        |
| customerEmail                                  | string | Email del adquiriente. Si lo pones le enviaremos el documento luego de ser emitido.                                                                                                                                                                                                                                                                             |

{% tabs %}
{% tab title="200: OK El valor status esperado es PENDIENTE" %}

```javascript
{
    "status": "PENDIENTE",
    "documentId": "5d4g1e88b30104056706dffe"
}
```

{% endtab %}

{% tab title="400: Bad Request Si el status es diferente a PENDIENTE entonces la petición fracasó. Los detalles del error estarán en el objeto "error": {}" %}

```javascript
{
    "status": "ERROR",
    "error": {} // objeto con datos del error
}
```

{% endtab %}
{% endtabs %}

## voidBill

<mark style="color:green;">`POST`</mark> `URL /personas/v1/voidBill`

Anulación de documentos

#### Request Body

| Name                                           | Type   | Description                                    |
| ---------------------------------------------- | ------ | ---------------------------------------------- |
| personaId<mark style="color:red;">\*</mark>    | string | Identificador de tu empresa                    |
| personaToken<mark style="color:red;">\*</mark> | string | Token de acceso de tu empresa                  |
| documentId<mark style="color:red;">\*</mark>   | string | Identificador del documento que se va a anular |
| reason<mark style="color:red;">\*</mark>       | string | Motivo de la anulación (3 - 100 caracteres)    |

{% tabs %}
{% tab title="200: OK El valor status esperado es PENDIENTE" %}

```javascript
{
    "status": "PENDIENTE",
    "documentId": "5d4g1e88b30104056706dffe"
}
```

{% endtab %}

{% tab title="400: Bad Request Si el status es diferente a PENDIENTE entonces la petición fracasó. Los detalles del error estarán en el objeto "error": {}" %}

```javascript
{
    "status": "ERROR",
    "error": {} // objeto con datos del error
}
```

{% endtab %}
{% endtabs %}

## lastDocument

<mark style="color:green;">`POST`</mark> `URL /personas/lastDocument`

Obtener el número correlativo

#### Request Body

| Name                                           | Type   | Description                             |
| ---------------------------------------------- | ------ | --------------------------------------- |
| personaId<mark style="color:red;">\*</mark>    | string | Identificador de tu empresa             |
| personaToken<mark style="color:red;">\*</mark> | string | Token de acceso de tu empresa           |
| type<mark style="color:red;">\*</mark>         | string | Código de tipo de documento (2 dígitos) |
| serie<mark style="color:red;">\*</mark>        | string | Serie (4 caracteres)                    |

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

```javascript
{
    "personaId": "5f6cd73425f5c52d375dd55c",
    "production": true,
    "type": "01",
    "serie": "F001",
    "lastNumber":"00000001",
    "suggestedNumber":"00000002"
}
```

{% 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.apisunat.com/api-rest/personas.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.
