POST /sales/buy-orders

Create a Buy Order

This endpoint allows you to create a Buy Order.

Operation ID: createBuyOrder
lock This endpoint requires a Bearer token in the Authorization header.

Request Body

Content-Type: application/json · Required fields: type, state

type string required

Type of Buy Order.

MATERIAL SERVICE
delivery_address string | null

Delivery Address of the Buy Order.

external_sale_id string | null

External ID of the Buy Order.

internal_sale_id string | null

Internal ID of the Buy Order.

observation string | null

Observations/notes of the Buy Order.

related_to_id integer | null

ID of the object (failure or scheduled work) related to the Buy Order. Required with field related_to_type.

related_to_type string | null

Type of object related to the Buy Order. Required with field related_to_id.

FAILURE SCHEDULED_WORK
state string required

State of the Buy Order.

SAVED_AS_DRAFT CREATED RECEIVED_PARTIALLY RECEIVED CONFIRMED
supplier_id integer | null

ID of the supplier associated with the Buy Order. Required for type 'SERVICE' unless the state is 'SAVED_AS_DRAFT'.

warehouse_id integer

ID of the Warehouse associated to the Buy Order. Required for type 'MATERIAL' unless the state is 'SAVED_AS_DRAFT'.

Responses

data object

Buy Order model structure details

id string read-only

ID of the Buy Order.

type string read-only

Model type

buy_order
attributes object
entity_id integer read-only
type string read-only

Type of Buy Order.

MATERIAL SERVICE
base_total string | null read-only

The total base price of the Buy Order (including discount).

code string read-only

Code of the Buy Order.

completed_at string | null read-only

Date Buy Order is Received (state transition to 'RECEIVED').

Example: 2021-07-21 18:38:00

completed_by integer | null read-only

ID of the user who Received the Buy Order (state transition to 'RECEIVED').

created_by integer | null read-only

ID of the user who created the Buy Order

date_created string | null read-only

Date Buy Order is Created.

Example: 2021-07-21 18:38:00

date_updated string read-only

Date Buy Order was last updated.

Example: 2021-07-21 18:38:00

delivery_address string | null

Delivery Address of the Buy Order.

discount_total string | null read-only

The total discount of the Buy Order.

external_buy_id string | null

External ID of the Buy Order.

internal_buy_id string | null

Internal ID of the Buy Order.

observation string | null

Observations or notes of the Buy Order.

order_id integer read-only

ID of the Buy Order.

processed_at string | null read-only

Date Buy Order is started (state transition to 'CREATED').

Example: 2021-07-21 18:38:00

processed_by integer | null read-only

ID of the user who started the Buy Order (state transition to 'CREATED').

related_to_id integer | null

ID of the object (failure or scheduled work) related to the Buy Order (required with field related_to_type).

related_to_type string | null

Type of object related to the Buy Order (required with field related_to_id).

FAILURE SCHEDULED_WORK
state string

State of the Buy Order.

SAVED_AS_DRAFT CREATED RECEIVED_PARTIALLY RECEIVED CONFIRMED

Example: SAVED_AS_DRAFT

supplier_id integer | null

ID of the Supplier associated to the Buy Order. Required for type 'SERVICE' and state is not 'SAVED_AS_DRAFT'.

total_price number read-only

The total price of the Sell Order (including VAT and discount)

vat_total string | null read-only

The total VAT of the Buy Order.

warehouse_id integer | null

ID of the Warehouse associated to the Buy Order. Required for type 'MATERIAL' and state is not 'SAVED_AS_DRAFT'.

meta object
custom_fields object | null
meta object

Meta model structure details

cost_centers array<string>

Example: ["Cost center","Cost center 2"]

status string
error
error object
properties object

Only present when related to property validation error

dev_message string

Example: Property validation error. Check the "properties" section in the response.

http_code integer
400
message string

Example: Property validation error.

more_info string
status string
error
error object
http_code integer
401
message string

Example: Authentication token invalid.

more_info string
status string
error
error object
http_code integer
403
message string

Example: Action unauthorized

more_info string
status string
error
error object
http_code integer
429
message string

Example: Too Many Requests.

more_info string
status string
error
error object
http_code integer
500
message string

Example: An error has occurred during the request.

more_info string