/sales/sell-orders/{sellOrderId}/lines
This endpoint allows you to create a Sell Order (Sale) Line for a specific Sell Order.
createSellOrderLine
| Name | Type | Description |
|---|---|---|
sellOrderId
required
|
string |
The Sell Order (Sale) ID |
| Name | Type | Description |
|---|---|---|
expanded
|
string |
Available expands for the Sell Order Line cost_center
material
other_cost
|
Content-Type: application/json
· Required fields: type, quantity, unit_price
description
string | null
Description of the Sell Order (Sale) Line Item. This field is required if `type` is `SERVICE`.
Example: Short description regarding the Sell Order (Sale) Line Item
type
string
required
Type of the item on the Sell Order (Sale) Line Item. Available types are: - `MATERIAL` - `SERVICE` - `OTHER_COST`
MATERIAL
SERVICE
OTHER_COST
Example: SERVICE
discount
number
Discount percentage applied to the item in the Sell Order (Sale) Line. **`10.23` in this field means 10.23% Discount**
Example: 10.23
material_id
integer | null
ID of the Material in the Sell Order (Sale) Line Item. This field is required if `type` is `MATERIAL`.
Example: 123
observations
string | null
Observations or notes regardint the Sell Order (Sale) Line Item.
Example: Some observation that gives more context about the Line Item.
other_cost_id
integer | null
ID of the Other Cost in the Sell Order (Sale) Line Item. This field is required if `type` is `OTHER_COST`.
Example: 123
quantity
string
required
Quantity of items in the Sell Order (Sale) Line. **This field is a Numeric String.**
Example: 10.00
unit
string | null
Unit of the item in the Sell Order (Sale) Line.
Example: kg
unit_price
number
required
Price of each unit of the item in the Sell Order (Sale) Line.
Example: 12.34
vat
number
Tax percentage applied to the item in the Sell Order (Sale) Line. **`10.23` in this field means 10.23% Tax**
Example: 10.23
data
object
Sell Order (Sale) Line Item Resource structure details
id
string
read-only
ID of the Sell Order (Sale) Line Item
Example: 123
type
string
read-only
Resource type
sell_order_line
Example: sell_order_line
attributes
object
cost_center_id
integer
ID of the associated Cost Center.
Example: 123
description
string | null
Description of the Sell Order (Sale) Line Item. This field is required if `type` is `SERVICE`.
Example: Short description regarding the Sell Order (Sale) Line Item
type
string
Type of the item on the Sell Order (Sale) Line Item. Available types are: - `MATERIAL` - `SERVICE` - `OTHER_COST`
MATERIAL
SERVICE
OTHER_COST
Example: SERVICE
base_total
number
Total Base Price amount for the Sell Order (Sale) Line Item. **This amount does not include Discount or Taxes.** This amount is calculated by: `quantity * unit_price`
Example: 100.23
discount
number
Discount percentage applied to the item in the Sell Order (Sale) Line. **`10.23` in this field means 10.23% Discount**
Example: 10.23
discount_total
number
Total Discount amount for the Sell Order (Sale) Line Item. This amount is calculated by: `base_total * (discount / 100)`
Example: 10.23
material_id
integer | null
ID of the Material in the Sell Order (Sale) Line Item. This field is required if `type` is `MATERIAL`.
Example: 123
observations
string | null
Observations or notes regardint the Sell Order (Sale) Line Item.
Example: Some observation that gives more context about the Line Item.
other_cost_id
integer | null
ID of the Other Cost in the Sell Order (Sale) Line Item. This field is required if `type` is `OTHER_COST`.
Example: 123
quantity
string
Quantity of items in the Sell Order (Sale) Line. **This field is a Numeric String.**
Example: 10.00
total
number
Total Price amount for the Sell Order (Sale) Line Item. **This amount includes Discount but __DOES NOT include Taxes__.** This amount is calculated by: `base_total - discount_total`
Example: 90
unit
string | null
Unit of the item in the Sell Order (Sale) Line.
Example: kg
unit_price
number
Price of each unit of the item in the Sell Order (Sale) Line.
Example: 12.34
vat
number
Tax percentage applied to the item in the Sell Order (Sale) Line. **`10.23` in this field means 10.23% Tax**
Example: 10.23
vat_total
number
Total Price amount including Taxes for the Sell Order (Sale) Line Item. **This amount includes Discount and Taxes.** This amount is calculated by: `total * (vat / 100)`
Example: 97.34
included
array<union>
List of expanded relationships for the Sell Order (Sale) Line. Items available in this list will vary depending on the value supplied in `expanded` query parameter.
id
string
read-only
Cost Center ID
type
string
read-only
Resource type
cost_center
attributes
object
name
string
Name for the Cost Center.
Example: AVAC Corretiva
code
string
Code for the Cost Center
Example: C.AVAC
responsible_name
string | null
Name for the person responsible for the Cost Center
Example: Luis
responsible_email
string | null
Email for the person responsible for the Cost Center
Example: luis@example.com
responsible_phone
string | null
Phone Number for the person responsible for the Cost Center
Example: +351912345678
responsible_cellphone
string | null
Cellphone Number for the person responsible for the Cost Center
Example: +351912345678
observation
string | null
User defined Observations for the Cost Center
Example: An observation regarding my cost center.
id
string
required
read-only
ID of the Material
Example: 1
type
string
required
read-only
Model type
stock-material
Example: stock-material
attributes
object
required
material_id
string
read-only
ID of the material
Example: 1
material_type_id
string
read-only
ID of the material type
Example: 11
name
string
Name of the material
Example: Chair
code
string
Code of the material
Example: CH-00001
purchase_consumption_type
string
Purchase consumption type of the material
INHERIT
AUTOMATIC
MANUAL
Example: INHERIT
units
string
Indicates which kind of unit should this material be measured with
Example: un
observations
string | null
Material observations
Example: This is a observation
description
string
Description of the material
Example: This is a chair
sku
string | null
SKU of the material
Example: SKU-00001
ean_upc
string | null
EAN/UPC of the material
Example: 1234567890123
sale_price
number
Sale price of the material
Example: 10
sale_vat
number
Sale VAT of the material
Example: 23
created_at
string | null
read-only
Date of creation
Example: 2021-07-21 18:38:00
updated_at
string | null
read-only
Last update date
Example: 2021-07-21 18:38:00
warehouses_minimum_stocks
array<object>
warehouse_id
integer
Example: 1
warehouse_name
string
Example: Warehouse
minimum_quantity
integer
Example: 10
id
string
required
read-only
The ID of the Other Cost
Example: 123
type
string
required
read-only
Model type
other-cost
Example: other-cost
attributes
object
required
other_cost_id
integer
read-only
The ID of the Other Cost
Example: 123
entity_id
integer
read-only
The ID of the Entity
Example: 123
input_type
string
The type of Other Cost. Different types of Other Costs have different associated fields. Other Costs of type resource will measure its total cost based on how long (e.g. hours, minutes) the resource is occupied. Other Costs of type distance will measure its total cost based on how many units (e.g. meters, kilometers) are needed. Other Costs of type interval and time_range will measure its total cost based on duration. Other Costs of type currency will have a fixed cost manually defined for each operation. Other Costs of type custom_unit_of_measurement will measure its total cost based on how many units (e.g. m3, liters) are needed.
currency
distance
interval
time_range
resource
custom_unit_of_measurement
Example: currency
name
string
The name (or description) of the Other Cost
Example: Contractual Labor
failure
boolean
Indicates if the Other Cost can be included in costs for Corrective Maintenance (Work Orders)
Example: 1
schedule_work
boolean | null
Indicates if the Other Cost can be included in costs for Preventive Maintenance (Planned Job Orders)
Example: 1
operator
boolean | null
Indicates if the Other Cost can be included in individual costs for operators (technicians)
Example: 1
icon
string
The icon to be presented for the Other Cost in Infraspeak platform.
truck
car
clock-o
bed
user
usd
cutlery
wrench
Example: truck
element
boolean | null
Indicates if the Other Cost can be included in costs for Assets
Example: 1
cost_per_unit
number | null
Cost per unit of the Other Cost. Specific for input_type "resource", "distance" or "custom_unit_of_measurement"
Example: 2.5
default_sell_price
number | null
Default sell price of the Other Cost. Specific for input_type "resource", "distance" or "custom_unit_of_measurement"
Example: 4
default_sell_vat
number | null
Default sale VAT/IVA percentage of the Other Cost. Specific for input_type "resource", "distance" or "custom_unit_of_measurement"
Example: 23
unit
string | null
Unit of the Other Cost. Specific for input_type "resource", "distance" or "custom_unit_of_measurement"
relationships
object
The relationships of the Other Cost (Only present when expanded in the request)
customClientPrices
object
The Custom Client Prices associated with the Other Cost
entity
object
The Entity where the Other Cost belongs
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
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
curl -X POST \
'https://api.sandbox.infraspeak.com/v3/sales/sell-orders/{sellOrderId}/lines' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-d '{
"description": "Short description regarding the Sell Order (Sale) Line Item",
"type": "SERVICE",
"discount": 10.23,
"material_id": 123,
"observations": "Some observation that gives more context about the Line Item.",
"other_cost_id": 123,
"quantity": "10.00",
"unit": "kg",
"unit_price": 12.34,
"vat": 10.23
}'
const response = await fetch('https://api.sandbox.infraspeak.com/v3/sales/sell-orders/{sellOrderId}/lines', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
body: JSON.stringify({
"description": "Short description regarding the Sell Order (Sale) Line Item",
"type": "SERVICE",
"discount": 10.23,
"material_id": 123,
"observations": "Some observation that gives more context about the Line Item.",
"other_cost_id": 123,
"quantity": "10.00",
"unit": "kg",
"unit_price": 12.34,
"vat": 10.23
}),
});
const data = await response.json();
$response = Http::withHeaders([
'Accept' => 'application/json',
'Content-Type' => 'application/json',
])->withToken('YOUR_API_TOKEN')
->post('https://api.sandbox.infraspeak.com/v3/sales/sell-orders/{sellOrderId}/lines',
array (
'description' => 'Short description regarding the Sell Order (Sale) Line Item',
'type' => 'SERVICE',
'discount' => 10.23,
'material_id' => 123,
'observations' => 'Some observation that gives more context about the Line Item.',
'other_cost_id' => 123,
'quantity' => '10.00',
'unit' => 'kg',
'unit_price' => 12.34,
'vat' => 10.23,
)
);
import requests
response = requests.post(
'https://api.sandbox.infraspeak.com/v3/sales/sell-orders/{sellOrderId}/lines',
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
},
json={
{
"description": "Short description regarding the Sell Order (Sale) Line Item",
"type": "SERVICE",
"discount": 10.23,
"material_id": 123,
"observations": "Some observation that gives more context about the Line Item.",
"other_cost_id": 123,
"quantity": "10.00",
"unit": "kg",
"unit_price": 12.34,
"vat": 10.23
}
},
)
data = response.json()