See the Queries page for a presentation of this resource.
Create a purchase
Note: This mutation can be used only for companies who can create purchases.
input Data of the purchase
GraphQL
mutation {
CreatePurchase(
input: {
id: null,
label: null,
notes: null,
total_units: null,
status: "active",
dated_at: null,
shipping_at: "2024-01-31",
update_incoming: true,
exchange_rate: 1,
currency: "EUR",
supplier: {
id: 100001,
label: "consequatur"
},
line_items: [
{
temporary_id: 1705668862433,
is_kit: false,
quantity: 3,
cost: 10,
weight: 0,
description: "",
location: {
id: 100006,
label: "assumenda"
},
variant: {
id: 100290,
label: "Amazeballs Humbro Shoes"
}
},
{
temporary_id: 1705665562433,
is_kit: false,
quantity: 20,
cost: 10,
weight: 0,
description: "",
location: {
id: 100006,
label: "assumenda"
},
variant: {
id: 100280,
label: "Cawabunga Assault Rifle
},
batch_numbers:[
{
batch_number:{
id:189000
}
quantity:12
},
{
batch_number:{
id:189666
}
quantity:8
}
]
}
]
}
) {
id
}
}
JSON
{
"data": {
"CreatePurchase": {
"id": 100012,
}
}
}
Update a purchase
input Data of the purchase
GraphQL
mutation UpdatePurchase($id: ID!, $input: PurchaseInput!) {
UpdatePurchase(id: $id, input: $input) {
id
shipping_at
}
}
Variables (JSON)
{
"id": 100012,
"input": {
"shipping_at": "2024-01-30"
}
}
JSON
{
"data": {
"UpdateOrder": {
"id": 100012,
"shipping_at": "2024-01-30"
}
}
}
Create a purchase receipt document based on a purchase
GraphQL
mutation TransformIntoPurchaseReceipt($id: ID!) {
TransformIntoPurchaseReceipt(id: $id) {
id
label
status
dated_at
}
}
JSON
{
"data": {
"TransformIntoPurchaseReceipt": {
"id": 100012,
"label": "PRP00000013",
"status": "unpublished",
"dated_at": "2024-01-19"
}
}
}
Delete a purchase
GraphQL
mutation DeletePurchase($id: ID!) {
DeletePurchase(id: $id)
}
JSON
{
"data": {
"DeletePurchase": true
}
}
Generates the next available purchase number.
GraphQL
mutation {
GeneratePurchaseNumber
}
id Unique identifier of the purchase
label Title of the purchase
notes Notes attached to the purchase
status Status of the purchase (enum values : active, archived, cancelled, completed, unpublished).
update_incoming If true, the purchase products have their incoming updated until they are delivered
supplier_id Unique identifier of the supplier
supplier Supplier of the purchase
line_items List of the line items of the purchase
dated_at Date of the purchase
created_at Creation date of the purchase
shipping_at Date the shipping is planned
shipping_cost Shipping costs of the purchase
exchange_rate Exchange rate of the purchase
total_units Total units of the purchase
currency Currency code of the purchase (GBP, USD, ...)
orders List of the orders the purchase is created from to reorder
data List of the orders the purchase is created from to reorder