Creates an Order
curl --request POST \
--url http://{defaultHost}/api/v2/platform/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"order": {
"item_total": 170.9,
"total": 190.9,
"state": "complete",
"adjustment_total": 20,
"user_id": "1",
"completed_at": "2022-11-08 19:33:50 UTC",
"bill_address_id": "1",
"ship_address_id": "1",
"payment_total": 190.9,
"shipment_state": "shipped",
"payment_state": "paid",
"email": "[email protected]",
"special_instructions": "I need it ASAP!",
"currency": "USD",
"last_ip_address": "127.0.0.1",
"created_by_id": "1",
"shipment_total": 10,
"additional_tax_total": 10,
"promo_total": 0,
"channel": "online",
"included_tax_total": 0,
"item_count": 2,
"approver_id": "<string>",
"approved_at": "2022-11-08 19:33:50 UTC",
"confirmation_delivered": true,
"considered_risky": true,
"canceled_at": "<string>",
"canceler_id": "<string>",
"taxable_adjustment_total": 170.9,
"non_taxable_adjustment_total": 10,
"store_owner_notification_delivered": true,
"bill_address_attributes": {
"address": {
"country_id": "224",
"state_id": "516",
"state_name": "New York",
"address1": "5th ave",
"address2": "1st suite",
"city": "NY",
"zipcode": "10001",
"phone": "+1 123 456 789",
"alternative_phone": "<string>",
"firstname": "John",
"lastname": "Snow",
"label": "My home address",
"company": "Vendo Connect Inc",
"user_id": "<string>",
"public_metadata": {
"distance_from_city_in_km": 10,
"location_type": "building"
},
"private_metadata": {
"close_to_shop": true
}
}
},
"ship_address_attributes": {
"address": {
"country_id": "224",
"state_id": "516",
"state_name": "New York",
"address1": "5th ave",
"address2": "1st suite",
"city": "NY",
"zipcode": "10001",
"phone": "+1 123 456 789",
"alternative_phone": "<string>",
"firstname": "John",
"lastname": "Snow",
"label": "My home address",
"company": "Vendo Connect Inc",
"user_id": "<string>",
"public_metadata": {
"distance_from_city_in_km": 10,
"location_type": "building"
},
"private_metadata": {
"close_to_shop": true
}
}
},
"line_items_attributes": [
{
"line_item": {
"variant_id": "1",
"quantity": 2
}
}
],
"public_metadata": {},
"private_metadata": {}
}
}'
{
"data": {
"id": "44",
"type": "order",
"attributes": {
"number": "R304058941",
"item_total": "0.0",
"total": "0.0",
"state": "cart",
"adjustment_total": "0.0",
"completed_at": null,
"payment_total": "0.0",
"shipment_state": null,
"payment_state": null,
"email": null,
"special_instructions": null,
"created_at": "2022-11-08T19:34:37.269Z",
"updated_at": "2022-11-08T19:34:37.289Z",
"currency": "USD",
"last_ip_address": null,
"shipment_total": "0.0",
"additional_tax_total": "0.0",
"promo_total": "0.0",
"channel": "spree",
"included_tax_total": "0.0",
"item_count": 0,
"approved_at": null,
"confirmation_delivered": false,
"canceled_at": null,
"state_lock_version": 0,
"taxable_adjustment_total": "0.0",
"non_taxable_adjustment_total": "0.0",
"store_owner_notification_delivered": null,
"public_metadata": {},
"private_metadata": {},
"internal_note": null,
"display_ship_total": "$0.00",
"display_shipment_total": "$0.00",
"display_outstanding_balance": "$0.00",
"display_item_total": "$0.00",
"display_adjustment_total": "$0.00",
"display_included_tax_total": "$0.00",
"display_additional_tax_total": "$0.00",
"display_tax_total": "$0.00",
"display_promo_total": "$0.00",
"display_total": "$0.00",
"display_cart_promo_total": "$0.00",
"display_pre_tax_item_amount": "$20.00",
"display_pre_tax_total": "$20.00",
"display_total_applicable_store_credit": "$0.00",
"display_total_applied_store_credit": "$0.00",
"display_order_total_after_store_credit": "$0.00",
"display_total_available_store_credit": "$0.00",
"display_store_credit_remaining_after_capture": "$0.00"
},
"relationships": {
"user": {
"data": null
},
"created_by": {
"data": null
},
"approver": {
"data": null
},
"canceler": {
"data": null
},
"bill_address": {
"data": {
"id": "56",
"type": "address"
}
},
"ship_address": {
"data": {
"id": "56",
"type": "address"
}
},
"line_items": {
"data": [
{
"id": "35",
"type": "line_item"
}
]
},
"payments": {
"data": [
{
"id": "1",
"type": "payment"
}
]
},
"shipments": {
"data": []
},
"state_changes": {
"data": []
},
"return_authorizations": {
"data": []
},
"reimbursements": {
"data": []
},
"adjustments": {
"data": []
},
"all_adjustments": {
"data": []
},
"order_promotions": {
"data": []
}
}
}
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Select which associated resources you would like to fetch, see: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>
Record created
The response is of type object
.
Was this page helpful?
curl --request POST \
--url http://{defaultHost}/api/v2/platform/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"order": {
"item_total": 170.9,
"total": 190.9,
"state": "complete",
"adjustment_total": 20,
"user_id": "1",
"completed_at": "2022-11-08 19:33:50 UTC",
"bill_address_id": "1",
"ship_address_id": "1",
"payment_total": 190.9,
"shipment_state": "shipped",
"payment_state": "paid",
"email": "[email protected]",
"special_instructions": "I need it ASAP!",
"currency": "USD",
"last_ip_address": "127.0.0.1",
"created_by_id": "1",
"shipment_total": 10,
"additional_tax_total": 10,
"promo_total": 0,
"channel": "online",
"included_tax_total": 0,
"item_count": 2,
"approver_id": "<string>",
"approved_at": "2022-11-08 19:33:50 UTC",
"confirmation_delivered": true,
"considered_risky": true,
"canceled_at": "<string>",
"canceler_id": "<string>",
"taxable_adjustment_total": 170.9,
"non_taxable_adjustment_total": 10,
"store_owner_notification_delivered": true,
"bill_address_attributes": {
"address": {
"country_id": "224",
"state_id": "516",
"state_name": "New York",
"address1": "5th ave",
"address2": "1st suite",
"city": "NY",
"zipcode": "10001",
"phone": "+1 123 456 789",
"alternative_phone": "<string>",
"firstname": "John",
"lastname": "Snow",
"label": "My home address",
"company": "Vendo Connect Inc",
"user_id": "<string>",
"public_metadata": {
"distance_from_city_in_km": 10,
"location_type": "building"
},
"private_metadata": {
"close_to_shop": true
}
}
},
"ship_address_attributes": {
"address": {
"country_id": "224",
"state_id": "516",
"state_name": "New York",
"address1": "5th ave",
"address2": "1st suite",
"city": "NY",
"zipcode": "10001",
"phone": "+1 123 456 789",
"alternative_phone": "<string>",
"firstname": "John",
"lastname": "Snow",
"label": "My home address",
"company": "Vendo Connect Inc",
"user_id": "<string>",
"public_metadata": {
"distance_from_city_in_km": 10,
"location_type": "building"
},
"private_metadata": {
"close_to_shop": true
}
}
},
"line_items_attributes": [
{
"line_item": {
"variant_id": "1",
"quantity": 2
}
}
],
"public_metadata": {},
"private_metadata": {}
}
}'
{
"data": {
"id": "44",
"type": "order",
"attributes": {
"number": "R304058941",
"item_total": "0.0",
"total": "0.0",
"state": "cart",
"adjustment_total": "0.0",
"completed_at": null,
"payment_total": "0.0",
"shipment_state": null,
"payment_state": null,
"email": null,
"special_instructions": null,
"created_at": "2022-11-08T19:34:37.269Z",
"updated_at": "2022-11-08T19:34:37.289Z",
"currency": "USD",
"last_ip_address": null,
"shipment_total": "0.0",
"additional_tax_total": "0.0",
"promo_total": "0.0",
"channel": "spree",
"included_tax_total": "0.0",
"item_count": 0,
"approved_at": null,
"confirmation_delivered": false,
"canceled_at": null,
"state_lock_version": 0,
"taxable_adjustment_total": "0.0",
"non_taxable_adjustment_total": "0.0",
"store_owner_notification_delivered": null,
"public_metadata": {},
"private_metadata": {},
"internal_note": null,
"display_ship_total": "$0.00",
"display_shipment_total": "$0.00",
"display_outstanding_balance": "$0.00",
"display_item_total": "$0.00",
"display_adjustment_total": "$0.00",
"display_included_tax_total": "$0.00",
"display_additional_tax_total": "$0.00",
"display_tax_total": "$0.00",
"display_promo_total": "$0.00",
"display_total": "$0.00",
"display_cart_promo_total": "$0.00",
"display_pre_tax_item_amount": "$20.00",
"display_pre_tax_total": "$20.00",
"display_total_applicable_store_credit": "$0.00",
"display_total_applied_store_credit": "$0.00",
"display_order_total_after_store_credit": "$0.00",
"display_total_available_store_credit": "$0.00",
"display_store_credit_remaining_after_capture": "$0.00"
},
"relationships": {
"user": {
"data": null
},
"created_by": {
"data": null
},
"approver": {
"data": null
},
"canceler": {
"data": null
},
"bill_address": {
"data": {
"id": "56",
"type": "address"
}
},
"ship_address": {
"data": {
"id": "56",
"type": "address"
}
},
"line_items": {
"data": [
{
"id": "35",
"type": "line_item"
}
]
},
"payments": {
"data": [
{
"id": "1",
"type": "payment"
}
]
},
"shipments": {
"data": []
},
"state_changes": {
"data": []
},
"return_authorizations": {
"data": []
},
"reimbursements": {
"data": []
},
"adjustments": {
"data": []
},
"all_adjustments": {
"data": []
},
"order_promotions": {
"data": []
}
}
}
}