# P4Warehouse REST API

## Autenticación

Todas las llamadas y consultas a la API REST requieren una clave de API del sistema. Para obtener la clave, vaya a Configuración > Sistema > Usuario, como se muestra a continuación.

<figure><img src="/files/MZ4xVmnHNBLcA9fZF2kS" alt=""><figcaption><p>P4Warehouse Rest API</p></figcaption></figure>

En la lista de usuarios disponibles, haga clic en el usuario «sistema».

In the user detail page, click the drop down icon to access API key for your tenant.

{% hint style="info" %}
If this is for a 3PL client, be sure the API is for a user that is specifically assigned to the 3PL client.
{% endhint %}

<figure><img src="/files/7PJGqKL2K5yoCuNEftEg" alt=""><figcaption><p>P4 Warehouse Rest API</p></figcaption></figure>

## Endpoints and Requests

API endpoints are organized by resource type. Use different endpoints depending on your API call requirements.

Here are couple example of API endpoints used throughout the P4W system.

#### **'CreateOrUpdate'** and **'DeleteBatch'** follow this pattern:[&#xD;](<&#xD;&#xA;https://doc1.p4warehouse.com/api/>)

```json
https://{tenant_name}.p4warehouse.com/api/{Resource}Api/CreateOrUpdate

https://{tenant_name}.p4warehouse.com/api/{Resource}Api/DeleteBatch
```

Replace {Resource} with Product, Client, Vendor, PickTicket, PurchaseOrder, etc.

Replace `{tenant_name}` with your tenant's domain.

#### **OData**

For querying database, P4W uses OData protocol.[](<&#xD;&#xA;https://doc1.p4warehouse.com/odata/PickTicket?$expand=>)

<pre class="language-json"><code class="lang-json"><strong>"https://{tenant_name}.p4warehouse.com/odata/PickTicket?$expand={Resources&#x26;Parameters}
</strong></code></pre>

&#x20;Replace `{tenant_name}` with your tenant's domain.

All requests produce HTTP response status code.

#### Four Wall Report

FourWallReport endpoint provides a simple way to retrieve full inventory list including individual products quantities.&#x20;

```json
https://{tenant_name}.p4warehouse.com/api/Report/FourWallReport
```

Replace `{tenant_name}` with your tenant's domain.

#### Execute&#x20;

'Execute' endpoint is used in conjunction with Audit reports.&#x20;

## Payload

API calls containing payload utilize JSON format across the board.


---

# 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.p4.software/p4-warehouse-spanish/api-rest/p4warehouse-rest-api.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.
