Create a draft order from offering/custom selections.
curl --request POST \
--url https://dash.dmly.io/api/v1/orders \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"contact_id": "9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e",
"currency": "USD",
"notes": "Rush order, ship by Friday.",
"coupon_code": "WELCOME10",
"items": [
{
"type": "product",
"id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"quantity": 2
},
{
"type": "service",
"id": "7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f",
"quantity": 1
},
{
"type": "custom",
"name": "Gift wrapping",
"unit_price": 5,
"quantity": 1,
"tax_rate": 20,
"tax_inclusive": false
}
]
}
'import requests
url = "https://dash.dmly.io/api/v1/orders"
payload = {
"contact_id": "9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e",
"currency": "USD",
"notes": "Rush order, ship by Friday.",
"coupon_code": "WELCOME10",
"items": [
{
"type": "product",
"id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"quantity": 2
},
{
"type": "service",
"id": "7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f",
"quantity": 1
},
{
"type": "custom",
"name": "Gift wrapping",
"unit_price": 5,
"quantity": 1,
"tax_rate": 20,
"tax_inclusive": False
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contact_id: '9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e',
currency: 'USD',
notes: 'Rush order, ship by Friday.',
coupon_code: 'WELCOME10',
items: [
{type: 'product', id: '1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d', quantity: 2},
{type: 'service', id: '7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f', quantity: 1},
{
type: 'custom',
name: 'Gift wrapping',
unit_price: 5,
quantity: 1,
tax_rate: 20,
tax_inclusive: false
}
]
})
};
fetch('https://dash.dmly.io/api/v1/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dash.dmly.io/api/v1/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contact_id' => '9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e',
'currency' => 'USD',
'notes' => 'Rush order, ship by Friday.',
'coupon_code' => 'WELCOME10',
'items' => [
[
'type' => 'product',
'id' => '1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d',
'quantity' => 2
],
[
'type' => 'service',
'id' => '7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f',
'quantity' => 1
],
[
'type' => 'custom',
'name' => 'Gift wrapping',
'unit_price' => 5,
'quantity' => 1,
'tax_rate' => 20,
'tax_inclusive' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dash.dmly.io/api/v1/orders"
payload := strings.NewReader("{\n \"contact_id\": \"9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e\",\n \"currency\": \"USD\",\n \"notes\": \"Rush order, ship by Friday.\",\n \"coupon_code\": \"WELCOME10\",\n \"items\": [\n {\n \"type\": \"product\",\n \"id\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n \"quantity\": 2\n },\n {\n \"type\": \"service\",\n \"id\": \"7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f\",\n \"quantity\": 1\n },\n {\n \"type\": \"custom\",\n \"name\": \"Gift wrapping\",\n \"unit_price\": 5,\n \"quantity\": 1,\n \"tax_rate\": 20,\n \"tax_inclusive\": false\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://dash.dmly.io/api/v1/orders")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"contact_id\": \"9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e\",\n \"currency\": \"USD\",\n \"notes\": \"Rush order, ship by Friday.\",\n \"coupon_code\": \"WELCOME10\",\n \"items\": [\n {\n \"type\": \"product\",\n \"id\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n \"quantity\": 2\n },\n {\n \"type\": \"service\",\n \"id\": \"7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f\",\n \"quantity\": 1\n },\n {\n \"type\": \"custom\",\n \"name\": \"Gift wrapping\",\n \"unit_price\": 5,\n \"quantity\": 1,\n \"tax_rate\": 20,\n \"tax_inclusive\": false\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dash.dmly.io/api/v1/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact_id\": \"9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e\",\n \"currency\": \"USD\",\n \"notes\": \"Rush order, ship by Friday.\",\n \"coupon_code\": \"WELCOME10\",\n \"items\": [\n {\n \"type\": \"product\",\n \"id\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n \"quantity\": 2\n },\n {\n \"type\": \"service\",\n \"id\": \"7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f\",\n \"quantity\": 1\n },\n {\n \"type\": \"custom\",\n \"name\": \"Gift wrapping\",\n \"unit_price\": 5,\n \"quantity\": 1,\n \"tax_rate\": 20,\n \"tax_inclusive\": false\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Builds a new draft order via OrderService::createFromOfferings. Each item is a selection: type service|product|plan resolves the offering by its uuid (catalogue price/tax, optionally overridden), or type custom for a free-form line. Prices, tax and totals are computed server-side; an optional coupon_code is validated and applied. Returns the created order with embedded contact and items. A 422 is returned if the items resolve to mixed currencies.
POST
/
orders
Create a draft order from offering/custom selections.
curl --request POST \
--url https://dash.dmly.io/api/v1/orders \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"contact_id": "9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e",
"currency": "USD",
"notes": "Rush order, ship by Friday.",
"coupon_code": "WELCOME10",
"items": [
{
"type": "product",
"id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"quantity": 2
},
{
"type": "service",
"id": "7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f",
"quantity": 1
},
{
"type": "custom",
"name": "Gift wrapping",
"unit_price": 5,
"quantity": 1,
"tax_rate": 20,
"tax_inclusive": false
}
]
}
'import requests
url = "https://dash.dmly.io/api/v1/orders"
payload = {
"contact_id": "9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e",
"currency": "USD",
"notes": "Rush order, ship by Friday.",
"coupon_code": "WELCOME10",
"items": [
{
"type": "product",
"id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"quantity": 2
},
{
"type": "service",
"id": "7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f",
"quantity": 1
},
{
"type": "custom",
"name": "Gift wrapping",
"unit_price": 5,
"quantity": 1,
"tax_rate": 20,
"tax_inclusive": False
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contact_id: '9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e',
currency: 'USD',
notes: 'Rush order, ship by Friday.',
coupon_code: 'WELCOME10',
items: [
{type: 'product', id: '1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d', quantity: 2},
{type: 'service', id: '7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f', quantity: 1},
{
type: 'custom',
name: 'Gift wrapping',
unit_price: 5,
quantity: 1,
tax_rate: 20,
tax_inclusive: false
}
]
})
};
fetch('https://dash.dmly.io/api/v1/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dash.dmly.io/api/v1/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contact_id' => '9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e',
'currency' => 'USD',
'notes' => 'Rush order, ship by Friday.',
'coupon_code' => 'WELCOME10',
'items' => [
[
'type' => 'product',
'id' => '1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d',
'quantity' => 2
],
[
'type' => 'service',
'id' => '7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f',
'quantity' => 1
],
[
'type' => 'custom',
'name' => 'Gift wrapping',
'unit_price' => 5,
'quantity' => 1,
'tax_rate' => 20,
'tax_inclusive' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dash.dmly.io/api/v1/orders"
payload := strings.NewReader("{\n \"contact_id\": \"9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e\",\n \"currency\": \"USD\",\n \"notes\": \"Rush order, ship by Friday.\",\n \"coupon_code\": \"WELCOME10\",\n \"items\": [\n {\n \"type\": \"product\",\n \"id\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n \"quantity\": 2\n },\n {\n \"type\": \"service\",\n \"id\": \"7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f\",\n \"quantity\": 1\n },\n {\n \"type\": \"custom\",\n \"name\": \"Gift wrapping\",\n \"unit_price\": 5,\n \"quantity\": 1,\n \"tax_rate\": 20,\n \"tax_inclusive\": false\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://dash.dmly.io/api/v1/orders")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"contact_id\": \"9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e\",\n \"currency\": \"USD\",\n \"notes\": \"Rush order, ship by Friday.\",\n \"coupon_code\": \"WELCOME10\",\n \"items\": [\n {\n \"type\": \"product\",\n \"id\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n \"quantity\": 2\n },\n {\n \"type\": \"service\",\n \"id\": \"7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f\",\n \"quantity\": 1\n },\n {\n \"type\": \"custom\",\n \"name\": \"Gift wrapping\",\n \"unit_price\": 5,\n \"quantity\": 1,\n \"tax_rate\": 20,\n \"tax_inclusive\": false\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dash.dmly.io/api/v1/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact_id\": \"9b1d4f2a-3c7e-4a1b-8e5d-2f6a9c0b1d3e\",\n \"currency\": \"USD\",\n \"notes\": \"Rush order, ship by Friday.\",\n \"coupon_code\": \"WELCOME10\",\n \"items\": [\n {\n \"type\": \"product\",\n \"id\": \"1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d\",\n \"quantity\": 2\n },\n {\n \"type\": \"service\",\n \"id\": \"7f8e9d0c-1b2a-4c3d-9e8f-7a6b5c4d3e2f\",\n \"quantity\": 1\n },\n {\n \"type\": \"custom\",\n \"name\": \"Gift wrapping\",\n \"unit_price\": 5,\n \"quantity\": 1,\n \"tax_rate\": 20,\n \"tax_inclusive\": false\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Was this page helpful?
⌘I

