Alladdin

Work in progress

Site en construction

الموقع قيد الإنشاء

Alladdin
POST

Create a purchase shipment

Scope: inventory:purchase-shipments.write https://api.alladdin.com/api/v2/purchase-shipments

Creates a new purchase shipment (albarán de compra). Purchase shipments record the receipt of goods from a supplier.
You must provide a contact_id referring to an existing contact. Include line items in the items array. The response returns the new purchase shipment id.

Request body

object contact_id string required

Identifier of an existing contact (supplier)

contact_name string optional

Name of the contact

description string | null optional

Free-text description

date string<date> optional

Issue date in ISO 8601 format. Accepts date (YYYY-MM-DD) or datetime (e.g. 2026-01-15T00:00:00+00:00)

due_date string<date> | null optional

Payment due date in ISO 8601 format. Accepts date (YYYY-MM-DD) or datetime (e.g. 2026-01-15T00:00:00+00:00)

notes string | null optional

Internal notes visible only to your team

default_taxes boolean optional

When true, a line with no taxes of its own, not linked to a catalog product or service, for a contact without default taxes takes the account's default taxes: its sales taxes on a sales document, its purchases taxes on a purchase document. When false or omitted, such a line is created untaxed.

default: false language string | null optional

ISO 639-1 language code

currency string | null optional

ISO 4217 currency code

currency_change number<float> | null optional

Exchange rate

items[] object[] required

Line items to include

name string type string | null

Kind of line. product and service are billable lines whose amount (units × price, less discount, plus taxes) is added to the document total. title is a section-header line that shows only its name and carries no amount — it does not contribute to the total. Other values are special-purpose lines. Omit this field for an ordinary priced line item.

Enum: product title service `` description string | null product_id string | null

Identifier of an existing catalog product to link this line to. The id is stored as a reference associating the line with the product (used for stock and reporting). Each line field (price, taxes, ...) is taken as sent; api2 stores the line values you provide and does not itself read them back from the product record. Leave unset for a free-text line that is not a catalog product.

variant_id string | null

Identifier of the variant of product_id to link this line to. Requires product_id. Leave unset for a line without variant.

service_id string | null

Identifier of an existing catalog service to link this line to. When provided, the line type is automatically set to service. Leave unset for a free-text line that is not a catalog service.

units number | null price number | null discount number | null taxes[] string[] | null

Tax keys applied to this line. When omitted, the contact default tax applies, or, if the contact has none, the account default tax when the request asks for it, else no tax.

sku string | null account string | null project_id string | null unit_type string | null supplied boolean | null

Whether this line is a supply expense (suplido) paid on behalf of the client. Excluded from the tax base.

tags[] string[] optional

Tags to attach

custom_fields[] object[] optional

Custom field values

field string

Custom field identifier

value string

Value stored in the custom field

number string | null optional

Custom document number (e.g. the supplier's delivery note reference).

warehouse_id string | null optional

Identifier of the warehouse

discount number | null optional

Global discount percentage

Request

python
import requests

url = "https://api.alladdin.com/api/v2/purchase-shipments"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Accept": "application/json",
}

payload = {
    "contact_id": "string",
    "contact_name": "string",
    "description": "string",
    "date": "2026-01-15",
    "due_date": "2026-01-31",
    "notes": "string",
    "default_taxes": false,
    "language": "es",
    "currency": "EUR",
    "currency_change": 0,
    "items": [
        {
            "name": "string",
            "type": "product",
            "description": "string",
            "product_id": "string",
            "variant_id": "string",
            "service_id": "string",
            "units": 0,
            "price": 0,
            "discount": 0,
            "taxes": [
                "s_iva_21"
            ],
            "sku": "string",
            "account": "string",
            "project_id": "string",
            "unit_type": "string",
            "supplied": false
        }
    ],
    "tags": [
        "string"
    ],
    "custom_fields": [
        {
            "field": "string",
            "value": "string"
        }
    ],
    "number": "string",
    "warehouse_id": "string",
    "discount": 0
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())

Responses

Response

json
{
  "id": "507f1f77bcf86cd799439011"
}

Success responses

201 Purchase shipment created 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 422 Validation error application/json 429 Rate limit exceeded application/json

Next →Approve a purchase shipment →