# Obtener PDF de entrega

Para obtener el PDF de una entrega particular que ya ha sido completada en Persat se debe realizar un GET como el que se muestra a continuación.

<mark style="color:blue;">`GET`</mark> `https://api.persat.com.ar/v1/deliveries/pdf/delivery_id`

{% hint style="danger" %}
Solo se pueden obtener una vez que se hayan realizado. Es decir, una vez que esté en estado FINISHED, FINISHED\_WITH\_DEVIATION o NOT\_FINISHED.
{% endhint %}

#### Path Parameters

| Name                                           | Type   | Description                  |
| ---------------------------------------------- | ------ | ---------------------------- |
| delivery\_id<mark style="color:red;">\*</mark> | String | Identificador de la entrega. |

#### Query Parameters

| Name   | Type   | Description                                                                                                      |
| ------ | ------ | ---------------------------------------------------------------------------------------------------------------- |
| format | String | Si se envía `"base64"`, el PDF se devolverá en base64. Si no se envía, la API responderá con un archivo binario. |

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer API\_KEY |

### Ejemplo en formato binario

{% hint style="info" %}
Las respuestas en formato binario retornan directamente la descarga del archivo.
{% endhint %}

#### Request con curl

```bash
curl -H "Authorization: Bearer API_KEY" \
     -J -O \
     https://api.persat.com.ar/v1/deliveries/pdf/NEWM23049
```

#### Respuesta

{% tabs %}
{% tab title="200: OK La consulta se ejecutó con éxito" %}
{% code overflow="wrap" fullWidth="true" %}

```json
HTTP/1.1 200 OK
Content-Type: application/pdf
Transfer-Encoding: chunked
Content-Disposition: attachment; filename="NEWM23049.pdf"

<Binary Data>
```

{% endcode %}
{% endtab %}

{% tab title="409: CONFLICT" %}

```json
HTTP/1.1 409 CONFLICT
Content-Type: application/json

{
    "success": false,
    "error": {
        "status": 409,
        "type": "CONFLICT",
        "userMessage": "La entrega 'NEWM23049' debe estar completada para poder generar el PDF"
    }
}
```

{% endtab %}

{% tab title="404: NOT FOUND No se encontró la OT " %}

```json
HTTP/1.1 404 NOT_FOUND
Content-Type: application/json

{
    "success": false,
    "error": {
        "status": 404,
        "type": "NOT_FOUND",
        "userMessage": "No existe una entrega con este nro."
    }
}
```

{% endtab %}
{% endtabs %}

### Analizando la Respuesta en formato base64

{% tabs %}
{% tab title="200: OK La consulta se ejecutó con éxito" %}

```json
{
    "success": true,
    "data": {
        "pdf": "JVBERi0xLjQKJdPr6eEKMSAwIG9iago8PC9DcmVh[...]", // Base64
        "name": "NEWM23049.pdf",
    }
}
```

{% endtab %}

{% tab title="409: CONFLICT" %}

```json
{
    "success": false,
    "error": {
        "status": 409,
        "type": "CONFLICT",
        "userMessage": "La entrega 'NEWM23049' debe estar completada para poder generar el PDF"
    }
}
```

{% endtab %}

{% tab title="404: Not Found No se encontro el formulario requerido" %}

```json
{
    "success": false,
    "error": {
        "status": 404,
        "type": "NOT_FOUND",
        "userMessage": "No existe una entrega con este nro."
    }
}
```

{% endtab %}
{% endtabs %}

**pdf:** Es un string. Representa el pdf en base64.

**name:** Es un string. Nombre sugerido del pdf.

### Ejemplo de PDF descargado

<figure><img src="/files/XensvWgWNIiRdsKrsbHP" alt=""><figcaption><p>Ejemplo de pdf descargado</p></figcaption></figure>


---

# 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.api.persat.com.ar/modulos/gestion-de-entregas/obtener-pdf-de-entrega.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.
