API Reference

CreatePurchase

Create a purchase

Note: This mutation can be used only for companies who can create purchases.

Parameters

input - PurchaseInput
Data of the purchase

Example

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 } }

Returned data

{ "data": { "CreatePurchase": { "id": 100012, } } }

UpdatePurchase

Update a purchase

Parameters

id - ID
Id of the purchase
input - PurchaseInput
Data of the purchase

Example

mutation UpdatePurchase($id: ID!, $input: PurchaseInput!) { UpdatePurchase(id: $id, input: $input) { id shipping_at } }
{ "id": 100012, "input": { "shipping_at": "2024-01-30" } }

Returned data

{ "data": { "UpdateOrder": { "id": 100012, "shipping_at": "2024-01-30" } } }

TransformIntoPurchaseReceipt

Create a purchase receipt document based on a purchase

Parameters

id - ID
Id of the purchase

Example

mutation TransformIntoPurchaseReceipt($id: ID!) { TransformIntoPurchaseReceipt(id: $id) { id label status dated_at } }
{ "id": 100012 }

Returned data

{ "data": { "TransformIntoPurchaseReceipt": { "id": 100012, "label": "PRP00000013", "status": "unpublished", "dated_at": "2024-01-19" } } }

DeletePurchase

Delete a purchase

Parameters

id - ID
Id of the purchase

Example

mutation DeletePurchase($id: ID!) { DeletePurchase(id: $id) }
{ "id": 100009 }

Returned data

{ "data": { "DeletePurchase": true } }

PurchaseInput data type

id - Int
Unique identifier of the purchase
label - String
Title of the purchase
notes - String
Notes attached to the purchase
total_units - Float
Total units of the purchase
status - Enum
Status of the purchase (enum values : active, archived, cancelled, completed, unpublished).
update_incoming - Boolean
If true, the purchase products have their incoming updated until they are delivered
dated_at - Date
Date of the purchase
supplier - Supplier - Subquery
Supplier of the purchase
shipping_at - Date
Date the shipping is planned
shipping_cost - Float
Shipping costs of the purchase
exchange_rate - Float
Exchange rate of the purchase
currency - String
Currency code of the purchase (GBP, USD, ...)
orders - Array of OrderInput - Subquery
List of the orders the purchase is created from to reorder
line_items - LineItemInput - Subquery
List of the line items of the order.