Receive units of a purchase order
Scope: inventory:purchase-orders.write https://api.alladdin.com/api/v2/purchase-orders/{purchaseOrderId}/receive
Registers the receipt of units for a purchase order. Internally creates a linked purchase shipment (albarán de compra) and updates the purchase order's pending units accordingly.
Provide the lines you want to receive in the items array. Each item references an existing purchase order line by line_id together with the units being received. Partial reception is supported: any line of the purchase order that is not listed in items remains untouched and pending, and you can call this endpoint again later to receive the remaining units.
Parameters
Path parameters
purchaseOrderId string required
Purchase Order ID (24-char hex ObjectId)
Request body
object items[] object[] required
Lines being received. Each item must reference an existing purchase order line.
line_id string required
Identifier of the purchase order line being received
units number required
Number of units being received. Must be greater than zero and not exceed the line's pending units.
date string<date> | null optional
Reception date in ISO 8601 format (YYYY-MM-DD). Defaults to today.
warehouse_id string | null optional
Warehouse where the units are received. Defaults to the purchase order warehouse.
Request
import requests
url = "https://api.alladdin.com/api/v2/purchase-orders/{purchaseOrderId}/receive"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
}
payload = {
"items": [
{
"line_id": "string",
"units": 0
}
],
"date": "2024-01-15",
"warehouse_id": "string"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())Responses
Response
{
"id": "507f1f77bcf86cd799439011"
}Success responses
201 Reception registered. Returns the created purchase shipment id. application/json object id string
Error responses
400 Bad request application/json 401 Invalid or missing API key application/json 403 Insufficient permissions application/json 404 Purchase order not found application/json 409 Conflict application/json object type string title string status integer detail string 422 Validation error application/json 429 Rate limit exceeded application/json
