Validate a non-authorizing prepared-media print order
Accepts exactly one JSON object up to 2 MiB and rejects unknown fields. environment is used only for structural preflight and cannot quote, create, pay for, upload media for, or submit an order. Authenticated quote and submission routes derive their fulfillment lane from the API credential. Clients must fetch the catalog and use the selected product revision’s asset requirements, text requirements, and options.
curl --request POST \
--url https://api.batchrelay.com/v1/print-orders/validate \
--header 'Content-Type: application/json' \
--data '
{
"external_order_id": "<string>",
"items": [
{
"assets": [
{
"url": "<string>",
"asset_id": "<string>",
"file_size_bytes": 2,
"hash": "<string>",
"origin": {
"design_id": "<string>",
"design_version": 2
},
"pixel_height": 2,
"pixel_width": 2,
"printed_file_name": "<string>",
"template_render_id": "<string>"
}
],
"product": {
"id": "<string>",
"revision": 2
},
"quantity": 2,
"options": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"texts": [
{
"value": "<string>"
}
]
}
],
"schema_version": 1,
"ship_from": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"ship_to": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"customer": {
"email": "jsmith@example.com",
"external_id": "<string>",
"name": "<string>",
"phone": "<string>"
}
}
'import requests
url = "https://api.batchrelay.com/v1/print-orders/validate"
payload = {
"external_order_id": "<string>",
"items": [
{
"assets": [
{
"url": "<string>",
"asset_id": "<string>",
"file_size_bytes": 2,
"hash": "<string>",
"origin": {
"design_id": "<string>",
"design_version": 2
},
"pixel_height": 2,
"pixel_width": 2,
"printed_file_name": "<string>",
"template_render_id": "<string>"
}
],
"product": {
"id": "<string>",
"revision": 2
},
"quantity": 2,
"options": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"texts": [{ "value": "<string>" }]
}
],
"schema_version": 1,
"ship_from": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"ship_to": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"customer": {
"email": "jsmith@example.com",
"external_id": "<string>",
"name": "<string>",
"phone": "<string>"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
external_order_id: '<string>',
items: [
{
assets: [
{
url: '<string>',
asset_id: '<string>',
file_size_bytes: 2,
hash: '<string>',
origin: {design_id: '<string>', design_version: 2},
pixel_height: 2,
pixel_width: 2,
printed_file_name: '<string>',
template_render_id: '<string>'
}
],
product: {id: '<string>', revision: 2},
quantity: 2,
options: [{option_id: '<string>', value: '<string>'}],
texts: [{value: '<string>'}]
}
],
schema_version: 1,
ship_from: {
address_1: '<string>',
city: '<string>',
country: '<string>',
name: '<string>',
phone: '<string>',
postal_code: '<string>',
state: '<string>',
address_2: '<string>'
},
ship_to: {
address_1: '<string>',
city: '<string>',
country: '<string>',
name: '<string>',
phone: '<string>',
postal_code: '<string>',
state: '<string>',
address_2: '<string>'
},
customer: {
email: 'jsmith@example.com',
external_id: '<string>',
name: '<string>',
phone: '<string>'
}
})
};
fetch('https://api.batchrelay.com/v1/print-orders/validate', 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://api.batchrelay.com/v1/print-orders/validate",
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([
'external_order_id' => '<string>',
'items' => [
[
'assets' => [
[
'url' => '<string>',
'asset_id' => '<string>',
'file_size_bytes' => 2,
'hash' => '<string>',
'origin' => [
'design_id' => '<string>',
'design_version' => 2
],
'pixel_height' => 2,
'pixel_width' => 2,
'printed_file_name' => '<string>',
'template_render_id' => '<string>'
]
],
'product' => [
'id' => '<string>',
'revision' => 2
],
'quantity' => 2,
'options' => [
[
'option_id' => '<string>',
'value' => '<string>'
]
],
'texts' => [
[
'value' => '<string>'
]
]
]
],
'schema_version' => 1,
'ship_from' => [
'address_1' => '<string>',
'city' => '<string>',
'country' => '<string>',
'name' => '<string>',
'phone' => '<string>',
'postal_code' => '<string>',
'state' => '<string>',
'address_2' => '<string>'
],
'ship_to' => [
'address_1' => '<string>',
'city' => '<string>',
'country' => '<string>',
'name' => '<string>',
'phone' => '<string>',
'postal_code' => '<string>',
'state' => '<string>',
'address_2' => '<string>'
],
'customer' => [
'email' => 'jsmith@example.com',
'external_id' => '<string>',
'name' => '<string>',
'phone' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.batchrelay.com/v1/print-orders/validate"
payload := strings.NewReader("{\n \"external_order_id\": \"<string>\",\n \"items\": [\n {\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n },\n \"pixel_height\": 2,\n \"pixel_width\": 2,\n \"printed_file_name\": \"<string>\",\n \"template_render_id\": \"<string>\"\n }\n ],\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"schema_version\": 1,\n \"ship_from\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_to\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"customer\": {\n \"email\": \"jsmith@example.com\",\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.batchrelay.com/v1/print-orders/validate")
.header("Content-Type", "application/json")
.body("{\n \"external_order_id\": \"<string>\",\n \"items\": [\n {\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n },\n \"pixel_height\": 2,\n \"pixel_width\": 2,\n \"printed_file_name\": \"<string>\",\n \"template_render_id\": \"<string>\"\n }\n ],\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"schema_version\": 1,\n \"ship_from\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_to\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"customer\": {\n \"email\": \"jsmith@example.com\",\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.batchrelay.com/v1/print-orders/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_order_id\": \"<string>\",\n \"items\": [\n {\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n },\n \"pixel_height\": 2,\n \"pixel_width\": 2,\n \"printed_file_name\": \"<string>\",\n \"template_render_id\": \"<string>\"\n }\n ],\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"schema_version\": 1,\n \"ship_from\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_to\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"customer\": {\n \"email\": \"jsmith@example.com\",\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"plan": {
"environment": "sandbox",
"external_order_id": "<string>",
"lines": [
{
"product": {
"fulfillment_type": "print",
"tax_category": "physical_print",
"asset_requirements": [
{
"aspect_ratio": {
"height": 2,
"width": 2
},
"required": true,
"role": "artwork",
"rotation_policy": "fixed"
}
],
"category": "prints",
"description": "<string>",
"family": {
"id": "<string>",
"name": "<string>"
},
"id": "<string>",
"lifecycle": {
"status": "active",
"replacement_product_id": "<string>"
},
"name": "<string>",
"options": [
{
"affects_price": true,
"default_value": "<string>",
"id": "<string>",
"name": "<string>",
"values": [
"<string>"
]
}
],
"physical_output": {
"height": 123,
"unit": "inches",
"width": 123
},
"revision": 2,
"template_requirement": "required",
"unit_costs": [
{
"option_values": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"pricing_status": "unverified",
"unit_cost_cents": 1
}
],
"units_per_quantity": 2,
"variant_attributes": {},
"consumer_quantity": {
"unit_plural": "<string>",
"unit_singular": "<string>",
"container_plural": "<string>",
"container_singular": "<string>"
},
"fulfillment_target": {
"id": "<string>",
"revision": 2
},
"prepared_artwork": {
"finished_area": {
"kind": "rectangle",
"center_in": {
"x": 1,
"y": 1
},
"diameter_in": 123,
"inset_in": {
"bottom": 1,
"left": 1,
"right": 1,
"top": 1
}
},
"important_content_area": {
"kind": "rectangle",
"center_in": {
"x": 1,
"y": 1
},
"diameter_in": 123,
"inset_in": {
"bottom": 1,
"left": 1,
"right": 1,
"top": 1
}
},
"output_bounds_in": {
"height": 123,
"width": 123
},
"output_dpi": 636
},
"print_safety_profile": {
"expected_trim_fraction_per_edge": 1,
"id": "<string>",
"important_content_inset_in": 1,
"minimum_border_inset_in": 1,
"trim_bottom_in": 1,
"trim_left_in": 1,
"trim_right_in": 1,
"trim_top_in": 1,
"version": 2,
"mounted": true
},
"text_requirements": [
{
"allow_blank": true,
"name": "<string>",
"slot": "text-1"
}
]
},
"request": {
"assets": [
{
"role": "artwork",
"url": "<string>",
"asset_id": "<string>",
"file_size_bytes": 2,
"format": "jpeg",
"hash": "<string>",
"origin": {
"design_id": "<string>",
"design_version": 2,
"kind": "whcc-preset",
"template_render_id": "<string>",
"template_revision_id": "<string>"
},
"pixel_height": 2,
"pixel_width": 2,
"printed_file_name": "<string>",
"template_render_id": "<string>"
}
],
"product": {
"id": "<string>",
"revision": 2
},
"quantity": 2,
"options": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"texts": [
{
"slot": "text-1",
"value": "<string>"
}
]
}
}
],
"schema_version": 1,
"ship_from": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"ship_to": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"shipping_service": "economy_untracked"
}
}{
"code": "<string>",
"docs_url": "<string>",
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}{
"code": "<string>",
"docs_url": "<string>",
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}{
"code": "<string>",
"docs_url": "<string>",
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}Headers
Untrusted optional analytics hint naming the calling client surface. It never affects authorization, routing, pricing, or behavior.
1 - 100Untrusted optional analytics hint naming the calling client version. It never affects authorization, routing, pricing, or behavior.
1 - 100Untrusted optional analytics hint naming the invocation mode. It never affects authorization, routing, pricing, or behavior.
1 - 100Body
Used only for this non-authorizing structural validation request.
sandbox, production 11Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Required domestic US delivery service. The server freezes the exact deterministic provider shipping quote before payment; a service can be unavailable when provider eligibility, a one-day zone result, or required provider cost evidence is unavailable.
economy_untracked, economy, expedited, standard_one_day, priority_one_day For quote and submit API routes, at least email or phone is required.
Show child attributes
Show child attributes
Response
Validated, immutable fulfillment plan
Show child attributes
Show child attributes
curl --request POST \
--url https://api.batchrelay.com/v1/print-orders/validate \
--header 'Content-Type: application/json' \
--data '
{
"external_order_id": "<string>",
"items": [
{
"assets": [
{
"url": "<string>",
"asset_id": "<string>",
"file_size_bytes": 2,
"hash": "<string>",
"origin": {
"design_id": "<string>",
"design_version": 2
},
"pixel_height": 2,
"pixel_width": 2,
"printed_file_name": "<string>",
"template_render_id": "<string>"
}
],
"product": {
"id": "<string>",
"revision": 2
},
"quantity": 2,
"options": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"texts": [
{
"value": "<string>"
}
]
}
],
"schema_version": 1,
"ship_from": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"ship_to": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"customer": {
"email": "jsmith@example.com",
"external_id": "<string>",
"name": "<string>",
"phone": "<string>"
}
}
'import requests
url = "https://api.batchrelay.com/v1/print-orders/validate"
payload = {
"external_order_id": "<string>",
"items": [
{
"assets": [
{
"url": "<string>",
"asset_id": "<string>",
"file_size_bytes": 2,
"hash": "<string>",
"origin": {
"design_id": "<string>",
"design_version": 2
},
"pixel_height": 2,
"pixel_width": 2,
"printed_file_name": "<string>",
"template_render_id": "<string>"
}
],
"product": {
"id": "<string>",
"revision": 2
},
"quantity": 2,
"options": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"texts": [{ "value": "<string>" }]
}
],
"schema_version": 1,
"ship_from": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"ship_to": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"customer": {
"email": "jsmith@example.com",
"external_id": "<string>",
"name": "<string>",
"phone": "<string>"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
external_order_id: '<string>',
items: [
{
assets: [
{
url: '<string>',
asset_id: '<string>',
file_size_bytes: 2,
hash: '<string>',
origin: {design_id: '<string>', design_version: 2},
pixel_height: 2,
pixel_width: 2,
printed_file_name: '<string>',
template_render_id: '<string>'
}
],
product: {id: '<string>', revision: 2},
quantity: 2,
options: [{option_id: '<string>', value: '<string>'}],
texts: [{value: '<string>'}]
}
],
schema_version: 1,
ship_from: {
address_1: '<string>',
city: '<string>',
country: '<string>',
name: '<string>',
phone: '<string>',
postal_code: '<string>',
state: '<string>',
address_2: '<string>'
},
ship_to: {
address_1: '<string>',
city: '<string>',
country: '<string>',
name: '<string>',
phone: '<string>',
postal_code: '<string>',
state: '<string>',
address_2: '<string>'
},
customer: {
email: 'jsmith@example.com',
external_id: '<string>',
name: '<string>',
phone: '<string>'
}
})
};
fetch('https://api.batchrelay.com/v1/print-orders/validate', 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://api.batchrelay.com/v1/print-orders/validate",
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([
'external_order_id' => '<string>',
'items' => [
[
'assets' => [
[
'url' => '<string>',
'asset_id' => '<string>',
'file_size_bytes' => 2,
'hash' => '<string>',
'origin' => [
'design_id' => '<string>',
'design_version' => 2
],
'pixel_height' => 2,
'pixel_width' => 2,
'printed_file_name' => '<string>',
'template_render_id' => '<string>'
]
],
'product' => [
'id' => '<string>',
'revision' => 2
],
'quantity' => 2,
'options' => [
[
'option_id' => '<string>',
'value' => '<string>'
]
],
'texts' => [
[
'value' => '<string>'
]
]
]
],
'schema_version' => 1,
'ship_from' => [
'address_1' => '<string>',
'city' => '<string>',
'country' => '<string>',
'name' => '<string>',
'phone' => '<string>',
'postal_code' => '<string>',
'state' => '<string>',
'address_2' => '<string>'
],
'ship_to' => [
'address_1' => '<string>',
'city' => '<string>',
'country' => '<string>',
'name' => '<string>',
'phone' => '<string>',
'postal_code' => '<string>',
'state' => '<string>',
'address_2' => '<string>'
],
'customer' => [
'email' => 'jsmith@example.com',
'external_id' => '<string>',
'name' => '<string>',
'phone' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.batchrelay.com/v1/print-orders/validate"
payload := strings.NewReader("{\n \"external_order_id\": \"<string>\",\n \"items\": [\n {\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n },\n \"pixel_height\": 2,\n \"pixel_width\": 2,\n \"printed_file_name\": \"<string>\",\n \"template_render_id\": \"<string>\"\n }\n ],\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"schema_version\": 1,\n \"ship_from\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_to\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"customer\": {\n \"email\": \"jsmith@example.com\",\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.batchrelay.com/v1/print-orders/validate")
.header("Content-Type", "application/json")
.body("{\n \"external_order_id\": \"<string>\",\n \"items\": [\n {\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n },\n \"pixel_height\": 2,\n \"pixel_width\": 2,\n \"printed_file_name\": \"<string>\",\n \"template_render_id\": \"<string>\"\n }\n ],\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"schema_version\": 1,\n \"ship_from\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_to\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"customer\": {\n \"email\": \"jsmith@example.com\",\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.batchrelay.com/v1/print-orders/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_order_id\": \"<string>\",\n \"items\": [\n {\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n },\n \"pixel_height\": 2,\n \"pixel_width\": 2,\n \"printed_file_name\": \"<string>\",\n \"template_render_id\": \"<string>\"\n }\n ],\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"schema_version\": 1,\n \"ship_from\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_to\": {\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"country\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"state\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"customer\": {\n \"email\": \"jsmith@example.com\",\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"phone\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"plan": {
"environment": "sandbox",
"external_order_id": "<string>",
"lines": [
{
"product": {
"fulfillment_type": "print",
"tax_category": "physical_print",
"asset_requirements": [
{
"aspect_ratio": {
"height": 2,
"width": 2
},
"required": true,
"role": "artwork",
"rotation_policy": "fixed"
}
],
"category": "prints",
"description": "<string>",
"family": {
"id": "<string>",
"name": "<string>"
},
"id": "<string>",
"lifecycle": {
"status": "active",
"replacement_product_id": "<string>"
},
"name": "<string>",
"options": [
{
"affects_price": true,
"default_value": "<string>",
"id": "<string>",
"name": "<string>",
"values": [
"<string>"
]
}
],
"physical_output": {
"height": 123,
"unit": "inches",
"width": 123
},
"revision": 2,
"template_requirement": "required",
"unit_costs": [
{
"option_values": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"pricing_status": "unverified",
"unit_cost_cents": 1
}
],
"units_per_quantity": 2,
"variant_attributes": {},
"consumer_quantity": {
"unit_plural": "<string>",
"unit_singular": "<string>",
"container_plural": "<string>",
"container_singular": "<string>"
},
"fulfillment_target": {
"id": "<string>",
"revision": 2
},
"prepared_artwork": {
"finished_area": {
"kind": "rectangle",
"center_in": {
"x": 1,
"y": 1
},
"diameter_in": 123,
"inset_in": {
"bottom": 1,
"left": 1,
"right": 1,
"top": 1
}
},
"important_content_area": {
"kind": "rectangle",
"center_in": {
"x": 1,
"y": 1
},
"diameter_in": 123,
"inset_in": {
"bottom": 1,
"left": 1,
"right": 1,
"top": 1
}
},
"output_bounds_in": {
"height": 123,
"width": 123
},
"output_dpi": 636
},
"print_safety_profile": {
"expected_trim_fraction_per_edge": 1,
"id": "<string>",
"important_content_inset_in": 1,
"minimum_border_inset_in": 1,
"trim_bottom_in": 1,
"trim_left_in": 1,
"trim_right_in": 1,
"trim_top_in": 1,
"version": 2,
"mounted": true
},
"text_requirements": [
{
"allow_blank": true,
"name": "<string>",
"slot": "text-1"
}
]
},
"request": {
"assets": [
{
"role": "artwork",
"url": "<string>",
"asset_id": "<string>",
"file_size_bytes": 2,
"format": "jpeg",
"hash": "<string>",
"origin": {
"design_id": "<string>",
"design_version": 2,
"kind": "whcc-preset",
"template_render_id": "<string>",
"template_revision_id": "<string>"
},
"pixel_height": 2,
"pixel_width": 2,
"printed_file_name": "<string>",
"template_render_id": "<string>"
}
],
"product": {
"id": "<string>",
"revision": 2
},
"quantity": 2,
"options": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"texts": [
{
"slot": "text-1",
"value": "<string>"
}
]
}
}
],
"schema_version": 1,
"ship_from": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"ship_to": {
"address_1": "<string>",
"city": "<string>",
"country": "<string>",
"name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"state": "<string>",
"address_2": "<string>"
},
"shipping_service": "economy_untracked"
}
}{
"code": "<string>",
"docs_url": "<string>",
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}{
"code": "<string>",
"docs_url": "<string>",
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}{
"code": "<string>",
"docs_url": "<string>",
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}