Appearance
Print API — Requests to Canva
Overview
Canva exposes API endpoints to enable print partners to send order status events to Canva.
Although the Print API returns an immediate response to order event requests, the processing of the requests in Canva's order system might be delayed.
If the Print API rejects a request because of rate limits, authentication issues, or other transient issues, print partners are expected to retry sending order updates.
Canva also provides endpoints for generating access tokens and getting signing keys.
API endpoints
Canva provides the following endpoints for print partners to access:
- Generate an access token
- Create order production event
- Create order shipment event
- Create order cost summary event
- Create order error event
- Get signing keys
Authentication and authorization
The order event endpoints use an OAuth 2.0 bearer token to authenticate print partner requests, as part of the OAuth Client Credentials flow.
Print partners must use their partner OAuth client ID and client secret with the Generate an access token endpoint to generate access tokens. The OAuth client ID and client secret are provided to print partners during the onboarding process.
The authentication and authorization process works as follows:
- Print partners generate an access token using the Generate an access token endpoint.
- Print partners use the access token in a request's
Authorizationheader to authenticate to Canva's order event endpoints. - When the access token expires, print partners must generate a new access token using the Generate an access token endpoint.
Keys
Gets a JSON Web Key Set (JWKS) containing public keys that are used to verify the authenticity of requests from the Canva Print API. The JWKS format follows RFC-7517 specifications.
You must use these keys to decrypt request signatures and verify that requests originated from Canva. This helps protect against replay attacks.
Canva might occasionally rotate these keys. We recommend you cache the keys returned from this API, and only access this API when you receive a request signed with an unrecognized key. This lets you verify requests quicker than fetching keys every time you receive a request from Canva.
HTTP method and URL path
GET https://api.canva.com/print/v1/keys
Example request
Examples for using the /v1/keys endpoint:
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request GET 'https://api.canva.com/print/v1/keys' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/print/v1/keys", {
method: "GET",
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/print/v1/keys"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
response = requests.get("https://api.canva.com/print/v1/keys");
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://api.canva.com/print/v1/keys"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.canva.com/print/v1/keys"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/print/v1/keys", CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_RETURNTRANSFER => true, ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/print/v1/keys')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns a 200 response with a JSON body with the following parameters:
<Prop.List> <Prop name="keys" type="EdDsaJwk[]" required mode="output"> A JSON Web Key Set (JWKS) with public keys used for signing requests. You can use this JWKS to verify that a request was sent from Canva.
<PillAccordion title={<>Properties of <strong>keys</strong></>} defaultExpanded={true}>
<Prop.List>
<Prop name="kid" type="string" required mode="output">
The key ID, a unique identifier for the public key. When the keys used to sign requests are rotated, you can use this ID to select the correct key within a JWKS during the key rollover. This value is case-sensitive.
</Prop>
<Prop name="kty" type="string" required mode="output">
The key type, which identifies the cryptographic algorithm family used with the key, such as `RSA` or `EC`. Only Octet Key Pairs (OKPs) are supported.
This value is case-sensitive. For more information, see RFC-8037.
</Prop>
<Prop name="crv" type="string" required mode="output">
The curve property, which identifies the curve used for elliptical curve encryptions. Only `Ed25519` is supported. For more information, see RFC-8037.
</Prop>
<Prop name="x" type="string" required mode="output">
The public key of an elliptical curve encryption. The key
is encoded with `Base64urlUInt`. For more information, see RFC-8037.
</Prop>
</Prop.List>
</PillAccordion>
</Prop> </Prop.List>
Example response
json
{
"keys": [
{
"kid": "a418dc7d-ecc5-5c4b-85ce-e1104a8addbe",
"kty": "OKP",
"crv": "Ed25519",
"x": "aIQtqd0nDfB-ug0DrzZbwTum-1ITdXvKxGFak_1VB2j"
},
{
"kid": "c8de5bec1-1b88-4ddaae04acc-ce415-5d7",
"kty": "OKP",
"crv": "Ed25519",
"x": "m2d1FT-gfBXxIzKwdQVTra0D-aBq_ubZ1jI0GuvkDtn"
}
]
}Oauth Generate Access Token
This endpoint implements the OAuth 2.0 token endpoint, as part of the Client Credentials flow. It lets you generate an access token that is used to authenticate requests to other endpoints in the Canva Print API.
Requests to this endpoint require authentication with your OAuth client ID and client secret, which were provided to you during the print partner onboarding process.
You must use basic access authentication, where the {credentials} string must be a Base64 encoded value of {client id}:{client secret}.
HTTP method and URL path
POST https://api.canva.com/auth/v1/oauth/token
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of basic access authentication. The {credentials} string must be a Base64 encoded value of {client id}:{client secret}.
For example: `Authorization: Basic {credentials}`
</Prop>
<Prop name="Content-Type" type="string" required> Indicates the media type of the information sent in the request. This must be set to application/x-www-form-urlencoded.
For example: `Content-Type: application/x-www-form-urlencoded`
</Prop> </Prop.List>
Body parameters
<Prop.List> <Prop name="grant_type" type="string" required> Must be set to client_credentials. </Prop> </Prop.List>
Example request
Examples for using the /v1/oauth/token endpoint:
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/auth/v1/oauth/token' \ --header 'Authorization: Basic {credentials}' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' </Tab> </Tabs>
Success response
If successful, the endpoint returns a 200 response with a JSON body with the following parameters:
<Prop.List> <Prop name="access_token" type="string" required mode="output"> The bearer access token to use to authenticate to Canva Print API endpoints. </Prop>
<Prop name="token_type" type="string" required mode="output"> The token type returned. This is always Bearer. </Prop>
<Prop name="expires_in" type="integer" required mode="output"> The expiry time (in seconds) for the token. </Prop> </Prop.List>
Example response
json
{
"access_token" : "JagALLazU0i2ld9WW4zTO4kaG0lkvP8Y5sSO206Z",
"token_type" : "Bearer",
"expires_in" : 14400
}Error responses
400 Invalid request. For example, missing parameters.
401 Invalid or unauthorized client ID or secret.
Order Cost Summary Event
Creates an event to notify Canva about the break down of costs and taxes for an order in the print partner's system.
It's expected that partners will send a cost summary after the order is completely shipped or is ready for pickup. Partners can omit shipment cost information for shipments that use Canva-provided shipping accounts.
WARNING: This endpoint isn't a replacement for the established invoicing flow. This endpoint is for tracking purposes only, and isn't associated with any payable account.
HTTP method and URL path
POST https://api.canva.com/print/v1/events/order-cost-summary
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of a Bearer token.
For example: `Authorization: Bearer {token}`
</Prop>
<Prop name="Content-Type" type="string" required> Indicates the media type of the information sent in the request. This must be set to application/json.
For example: `Content-Type: application/json`
</Prop>
<Prop name="X-Canva-Print-Client-Id" type="string" required> Unique ID of the print partner making the request. </Prop> </Prop.List>
Body parameters
<Prop.List> <Prop name="request_type" type="string" required> The type of request.
<Prop.Extras>
**Available values:** The only valid value is `cost_summary_event`.
</Prop.Extras>
</Prop>
<Prop name="order_reference_id" type="string" required> A unique, case-sensitive ID of the order in Canva's system. This must be the same value as the orderReferenceId path parameter.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="pre_tax_total_major_units" type="string" required> Total cost (excluding tax) of the order. This is value must be:
* In major units.
* In the currency provided.
* A numerical value. The currency symbol must be omitted.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="tax_major_units" type="string" required> Total tax of the order. This is value must be:
* In major units.
* In the currency provided.
* A numerical value. The currency symbol must be omitted.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="post_tax_total_major_units" type="string" required> Total cost (including tax) of the order. This is value must be:
* In major units.
* In the currency provided.
* A numerical value. The currency symbol must be omitted.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="currency" type="string" required> ISO 4217 currency code for the values provided in the cost summary.
<Prop.Extras>
**Maximum length:** `3`
</Prop.Extras>
</Prop>
<Prop name="order_cost_items" type="OrderCostItem[]" required> A break down of the cost components included in the cost summary.
<Prop.Extras>
**Minimum items:** `1`
</Prop.Extras>
<PillAccordion title={<>Properties of <strong>order_cost_items</strong></>} defaultExpanded={true}>
<Prop.List>
<Prop name="type" type="string" required>
The type of the cost item.
<Prop.Extras>
**Available values:**
* `product`
* `add_on`
* `packaging`
* `shipment`
</Prop.Extras>
</Prop>
<Prop name="cost_major_units" type="string" required>
Total cost (excluding tax) of the cost item. This is value must be:
* In major units.
* In the currency provided.
* A numerical value. The currency symbol must be omitted.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="tax_major_units" type="string" required>
Total tax of the cost item. This is value must be:
* In major units.
* In the currency provided.
* A numerical value. The currency symbol must be omitted.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="total_major_units" type="string" required>
Total cost (including tax) of the cost item. This is value must be:
* In major units.
* In the currency provided.
* A numerical value. The currency symbol must be omitted.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="currency" type="string" required>
ISO 4217 currency code for the values provided in the cost summary.
<Prop.Extras>
**Maximum length:** `3`
</Prop.Extras>
</Prop>
<Prop name="item_reference_id" type="string">
A unique, case-sensitive ID for an order item that the print partner can use when communicating with Canva. This is only provided when the `OrderCostItem` is a `product`, `add_on`, or `packaging`.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="tracking_number" type="string">
The tracking number provided by the carrier. This is only provided when the `OrderCostItem` is a `shipment`.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="handling_major_units" type="string"> The total cost (excluding tax) of the handling component of the cost item. This is value must be:
* In major units.
* In the currency provided.
* A numerical value. The currency symbol must be omitted.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop> </Prop.List>
Example requests
Delivery order: multiple items, multiple shipments
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/print/v1/events/order-cost-summary' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --header 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=' \ --data '{ "request_type": "cost_summary_event", "order_reference_id": "FB123456789", "handling_major_units": "0.35", "pre_tax_total_major_units": "16.02", "tax_major_units": "1.75", "post_tax_total_major_units": "17.77", "currency": "USD", "order_cost_items": [ { "type": "product", "item_reference_id": "FI123456789", "cost_major_units": "3.60", "tax_major_units": "0.40", "total_major_units": "4.00", "currency": "USD" }, { "type": "packaging", "item_reference_id": "FI123456789", "cost_major_units": "0.40", "tax_major_units": "0.04", "total_major_units": "0.44", "currency": "USD" }, { "type": "product", "item_reference_id": "FI123456788", "cost_major_units": "3.60", "tax_major_units": "0.40", "total_major_units": "4.00", "currency": "USD" }, { "type": "packaging", "item_reference_id": "FI123456788", "cost_major_units": "0.40", "tax_major_units": "0.04", "total_major_units": "0.44", "currency": "USD" }, { "type": "shipment", "tracking_number": "TR12345671", "cost_major_units": "4.55", "tax_major_units": "0.45", "total_major_units": "5.00", "currency": "USD" }, { "type": "shipment", "tracking_number": "TR12345672", "cost_major_units": "3.12", "tax_major_units": "0.42", "total_major_units": "3.54", "currency": "USD" } ] }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/print/v1/events/order-cost-summary", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28=",
},
body: JSON.stringify({
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "product",
"item_reference_id": "FI123456788",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456788",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345671",
"cost_major_units": "4.55",
"tax_major_units": "0.45",
"total_major_units": "5.00",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345672",
"cost_major_units": "3.12",
"tax_major_units": "0.42",
"total_major_units": "3.54",
"currency": "USD"
}
]
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/print/v1/events/order-cost-summary"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.header("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"request_type\": \"cost_summary_event\", \"order_reference_id\": \"FB123456789\", \"handling_major_units\": \"0.35\", \"pre_tax_total_major_units\": \"16.02\", \"tax_major_units\": \"1.75\", \"post_tax_total_major_units\": \"17.77\", \"currency\": \"USD\", \"order_cost_items\": [{\"type\": \"product\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}, {\"type\": \"product\", \"item_reference_id\": \"FI123456788\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456788\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}, {\"type\": \"shipment\", \"tracking_number\": \"TR12345671\", \"cost_major_units\": \"4.55\", \"tax_major_units\": \"0.45\", \"total_major_units\": \"5.00\", \"currency\": \"USD\"}, {\"type\": \"shipment\", \"tracking_number\": \"TR12345672\", \"cost_major_units\": \"3.12\", \"tax_major_units\": \"0.42\", \"total_major_units\": \"3.54\", \"currency\": \"USD\"}]}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28="
}
data = {
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "product",
"item_reference_id": "FI123456788",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456788",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345671",
"cost_major_units": "4.55",
"tax_major_units": "0.45",
"total_major_units": "5.00",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345672",
"cost_major_units": "3.12",
"tax_major_units": "0.42",
"total_major_units": "3.54",
"currency": "USD"
}
]
}
response = requests.post("https://api.canva.com/print/v1/events/order-cost-summary",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/print/v1/events/order-cost-summary"),
Headers =
{
{ "Authorization", "Bearer {token}" },
{ "X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=" },
},
Content = new StringContent(
"{\"request_type\": \"cost_summary_event\", \"order_reference_id\": \"FB123456789\", \"handling_major_units\": \"0.35\", \"pre_tax_total_major_units\": \"16.02\", \"tax_major_units\": \"1.75\", \"post_tax_total_major_units\": \"17.77\", \"currency\": \"USD\", \"order_cost_items\": [{\"type\": \"product\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}, {\"type\": \"product\", \"item_reference_id\": \"FI123456788\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456788\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}, {\"type\": \"shipment\", \"tracking_number\": \"TR12345671\", \"cost_major_units\": \"4.55\", \"tax_major_units\": \"0.45\", \"total_major_units\": \"5.00\", \"currency\": \"USD\"}, {\"type\": \"shipment\", \"tracking_number\": \"TR12345672\", \"cost_major_units\": \"3.12\", \"tax_major_units\": \"0.42\", \"total_major_units\": \"3.54\", \"currency\": \"USD\"}]}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "product",
"item_reference_id": "FI123456788",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456788",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345671",
"cost_major_units": "4.55",
"tax_major_units": "0.45",
"total_major_units": "5.00",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345672",
"cost_major_units": "3.12",
"tax_major_units": "0.42",
"total_major_units": "3.54",
"currency": "USD"
}
]
}`)
url := "https://api.canva.com/print/v1/events/order-cost-summary"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/print/v1/events/order-cost-summary", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=', ), CURLOPT_POSTFIELDS => json_encode([ "request_type" => "cost_summary_event", "order_reference_id" => "FB123456789", "handling_major_units" => "0.35", "pre_tax_total_major_units" => "16.02", "tax_major_units" => "1.75", "post_tax_total_major_units" => "17.77", "currency" => "USD", "order_cost_items" => [ [ "type" => "product", "item_reference_id" => "FI123456789", "cost_major_units" => "3.60", "tax_major_units" => "0.40", "total_major_units" => "4.00", "currency" => "USD" ], [ "type" => "packaging", "item_reference_id" => "FI123456789", "cost_major_units" => "0.40", "tax_major_units" => "0.04", "total_major_units" => "0.44", "currency" => "USD" ], [ "type" => "product", "item_reference_id" => "FI123456788", "cost_major_units" => "3.60", "tax_major_units" => "0.40", "total_major_units" => "4.00", "currency" => "USD" ], [ "type" => "packaging", "item_reference_id" => "FI123456788", "cost_major_units" => "0.40", "tax_major_units" => "0.04", "total_major_units" => "0.44", "currency" => "USD" ], [ "type" => "shipment", "tracking_number" => "TR12345671", "cost_major_units" => "4.55", "tax_major_units" => "0.45", "total_major_units" => "5.00", "currency" => "USD" ], [ "type" => "shipment", "tracking_number" => "TR12345672", "cost_major_units" => "3.12", "tax_major_units" => "0.42", "total_major_units" => "3.54", "currency" => "USD" ] ] ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/print/v1/events/order-cost-summary')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request['X-Canva-Print-Client-Id'] = 'Ym9zY236Ym9zY28='
request.body = <<REQUEST_BODY
{
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "product",
"item_reference_id": "FI123456788",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456788",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345671",
"cost_major_units": "4.55",
"tax_major_units": "0.45",
"total_major_units": "5.00",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345672",
"cost_major_units": "3.12",
"tax_major_units": "0.42",
"total_major_units": "3.54",
"currency": "USD"
}
]
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Delivery order with add on
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/print/v1/events/order-cost-summary' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --header 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=' \ --data '{ "request_type": "cost_summary_event", "order_reference_id": "FB123456789", "handling_major_units": "0.35", "pre_tax_total_major_units": "16.02", "tax_major_units": "1.75", "post_tax_total_major_units": "17.77", "currency": "USD", "order_cost_items": [ { "type": "product", "item_reference_id": "FI123456789", "cost_major_units": "3.60", "tax_major_units": "0.40", "total_major_units": "4.00", "currency": "USD" }, { "type": "packaging", "item_reference_id": "FI123456789", "cost_major_units": "0.40", "tax_major_units": "0.04", "total_major_units": "0.44", "currency": "USD" }, { "type": "add_on", "item_reference_id": "FI123456789", "cost_major_units": "3.60", "tax_major_units": "0.40", "total_major_units": "4.00", "currency": "USD" }, { "type": "packaging", "item_reference_id": "FI123456789", "cost_major_units": "0.40", "tax_major_units": "0.04", "total_major_units": "0.44", "currency": "USD" }, { "type": "shipment", "tracking_number": "TR12345671", "cost_major_units": "4.55", "tax_major_units": "0.45", "total_major_units": "5.00", "currency": "USD" } ] }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/print/v1/events/order-cost-summary", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28=",
},
body: JSON.stringify({
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "add_on",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345671",
"cost_major_units": "4.55",
"tax_major_units": "0.45",
"total_major_units": "5.00",
"currency": "USD"
}
]
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/print/v1/events/order-cost-summary"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.header("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"request_type\": \"cost_summary_event\", \"order_reference_id\": \"FB123456789\", \"handling_major_units\": \"0.35\", \"pre_tax_total_major_units\": \"16.02\", \"tax_major_units\": \"1.75\", \"post_tax_total_major_units\": \"17.77\", \"currency\": \"USD\", \"order_cost_items\": [{\"type\": \"product\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}, {\"type\": \"add_on\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}, {\"type\": \"shipment\", \"tracking_number\": \"TR12345671\", \"cost_major_units\": \"4.55\", \"tax_major_units\": \"0.45\", \"total_major_units\": \"5.00\", \"currency\": \"USD\"}]}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28="
}
data = {
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "add_on",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345671",
"cost_major_units": "4.55",
"tax_major_units": "0.45",
"total_major_units": "5.00",
"currency": "USD"
}
]
}
response = requests.post("https://api.canva.com/print/v1/events/order-cost-summary",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/print/v1/events/order-cost-summary"),
Headers =
{
{ "Authorization", "Bearer {token}" },
{ "X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=" },
},
Content = new StringContent(
"{\"request_type\": \"cost_summary_event\", \"order_reference_id\": \"FB123456789\", \"handling_major_units\": \"0.35\", \"pre_tax_total_major_units\": \"16.02\", \"tax_major_units\": \"1.75\", \"post_tax_total_major_units\": \"17.77\", \"currency\": \"USD\", \"order_cost_items\": [{\"type\": \"product\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}, {\"type\": \"add_on\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}, {\"type\": \"shipment\", \"tracking_number\": \"TR12345671\", \"cost_major_units\": \"4.55\", \"tax_major_units\": \"0.45\", \"total_major_units\": \"5.00\", \"currency\": \"USD\"}]}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "add_on",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345671",
"cost_major_units": "4.55",
"tax_major_units": "0.45",
"total_major_units": "5.00",
"currency": "USD"
}
]
}`)
url := "https://api.canva.com/print/v1/events/order-cost-summary"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/print/v1/events/order-cost-summary", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=', ), CURLOPT_POSTFIELDS => json_encode([ "request_type" => "cost_summary_event", "order_reference_id" => "FB123456789", "handling_major_units" => "0.35", "pre_tax_total_major_units" => "16.02", "tax_major_units" => "1.75", "post_tax_total_major_units" => "17.77", "currency" => "USD", "order_cost_items" => [ [ "type" => "product", "item_reference_id" => "FI123456789", "cost_major_units" => "3.60", "tax_major_units" => "0.40", "total_major_units" => "4.00", "currency" => "USD" ], [ "type" => "packaging", "item_reference_id" => "FI123456789", "cost_major_units" => "0.40", "tax_major_units" => "0.04", "total_major_units" => "0.44", "currency" => "USD" ], [ "type" => "add_on", "item_reference_id" => "FI123456789", "cost_major_units" => "3.60", "tax_major_units" => "0.40", "total_major_units" => "4.00", "currency" => "USD" ], [ "type" => "packaging", "item_reference_id" => "FI123456789", "cost_major_units" => "0.40", "tax_major_units" => "0.04", "total_major_units" => "0.44", "currency" => "USD" ], [ "type" => "shipment", "tracking_number" => "TR12345671", "cost_major_units" => "4.55", "tax_major_units" => "0.45", "total_major_units" => "5.00", "currency" => "USD" ] ] ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/print/v1/events/order-cost-summary')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request['X-Canva-Print-Client-Id'] = 'Ym9zY236Ym9zY28='
request.body = <<REQUEST_BODY
{
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "add_on",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "shipment",
"tracking_number": "TR12345671",
"cost_major_units": "4.55",
"tax_major_units": "0.45",
"total_major_units": "5.00",
"currency": "USD"
}
]
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Pickup order
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/print/v1/events/order-cost-summary' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --header 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=' \ --data '{ "request_type": "cost_summary_event", "order_reference_id": "FB123456789", "handling_major_units": "0.35", "pre_tax_total_major_units": "16.02", "tax_major_units": "1.75", "post_tax_total_major_units": "17.77", "currency": "USD", "order_cost_items": [ { "type": "product", "item_reference_id": "FI123456789", "cost_major_units": "3.60", "tax_major_units": "0.40", "total_major_units": "4.00", "currency": "USD" }, { "type": "packaging", "item_reference_id": "FI123456789", "cost_major_units": "0.40", "tax_major_units": "0.04", "total_major_units": "0.44", "currency": "USD" }, { "type": "add_on", "item_reference_id": "FI123456789", "cost_major_units": "3.60", "tax_major_units": "0.40", "total_major_units": "4.00", "currency": "USD" }, { "type": "packaging", "item_reference_id": "FI123456789", "cost_major_units": "0.40", "tax_major_units": "0.04", "total_major_units": "0.44", "currency": "USD" } ] }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/print/v1/events/order-cost-summary", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28=",
},
body: JSON.stringify({
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "add_on",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
}
]
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/print/v1/events/order-cost-summary"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.header("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"request_type\": \"cost_summary_event\", \"order_reference_id\": \"FB123456789\", \"handling_major_units\": \"0.35\", \"pre_tax_total_major_units\": \"16.02\", \"tax_major_units\": \"1.75\", \"post_tax_total_major_units\": \"17.77\", \"currency\": \"USD\", \"order_cost_items\": [{\"type\": \"product\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}, {\"type\": \"add_on\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}]}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28="
}
data = {
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "add_on",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
}
]
}
response = requests.post("https://api.canva.com/print/v1/events/order-cost-summary",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/print/v1/events/order-cost-summary"),
Headers =
{
{ "Authorization", "Bearer {token}" },
{ "X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=" },
},
Content = new StringContent(
"{\"request_type\": \"cost_summary_event\", \"order_reference_id\": \"FB123456789\", \"handling_major_units\": \"0.35\", \"pre_tax_total_major_units\": \"16.02\", \"tax_major_units\": \"1.75\", \"post_tax_total_major_units\": \"17.77\", \"currency\": \"USD\", \"order_cost_items\": [{\"type\": \"product\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}, {\"type\": \"add_on\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"3.60\", \"tax_major_units\": \"0.40\", \"total_major_units\": \"4.00\", \"currency\": \"USD\"}, {\"type\": \"packaging\", \"item_reference_id\": \"FI123456789\", \"cost_major_units\": \"0.40\", \"tax_major_units\": \"0.04\", \"total_major_units\": \"0.44\", \"currency\": \"USD\"}]}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "add_on",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
}
]
}`)
url := "https://api.canva.com/print/v1/events/order-cost-summary"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/print/v1/events/order-cost-summary", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=', ), CURLOPT_POSTFIELDS => json_encode([ "request_type" => "cost_summary_event", "order_reference_id" => "FB123456789", "handling_major_units" => "0.35", "pre_tax_total_major_units" => "16.02", "tax_major_units" => "1.75", "post_tax_total_major_units" => "17.77", "currency" => "USD", "order_cost_items" => [ [ "type" => "product", "item_reference_id" => "FI123456789", "cost_major_units" => "3.60", "tax_major_units" => "0.40", "total_major_units" => "4.00", "currency" => "USD" ], [ "type" => "packaging", "item_reference_id" => "FI123456789", "cost_major_units" => "0.40", "tax_major_units" => "0.04", "total_major_units" => "0.44", "currency" => "USD" ], [ "type" => "add_on", "item_reference_id" => "FI123456789", "cost_major_units" => "3.60", "tax_major_units" => "0.40", "total_major_units" => "4.00", "currency" => "USD" ], [ "type" => "packaging", "item_reference_id" => "FI123456789", "cost_major_units" => "0.40", "tax_major_units" => "0.04", "total_major_units" => "0.44", "currency" => "USD" ] ] ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/print/v1/events/order-cost-summary')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request['X-Canva-Print-Client-Id'] = 'Ym9zY236Ym9zY28='
request.body = <<REQUEST_BODY
{
"request_type": "cost_summary_event",
"order_reference_id": "FB123456789",
"handling_major_units": "0.35",
"pre_tax_total_major_units": "16.02",
"tax_major_units": "1.75",
"post_tax_total_major_units": "17.77",
"currency": "USD",
"order_cost_items": [
{
"type": "product",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
},
{
"type": "add_on",
"item_reference_id": "FI123456789",
"cost_major_units": "3.60",
"tax_major_units": "0.40",
"total_major_units": "4.00",
"currency": "USD"
},
{
"type": "packaging",
"item_reference_id": "FI123456789",
"cost_major_units": "0.40",
"tax_major_units": "0.04",
"total_major_units": "0.44",
"currency": "USD"
}
]
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns the status code 204 No content without a response body.
Error responses
400 Invalid request. For example, an invalid data format.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "invalid_request",
"message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
}401 Invalid or unauthorized client ID or secret.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "unauthorized_client",
"message": "The client is not authorized for action."
}403 Partner has no access to the order.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "permission_denied",
"message": "The resource owner or authorization server denied the request."
}Order Error Event
Creates an event to notify Canva about errors and issues for an order in the print partner's system.
HTTP method and URL path
POST https://api.canva.com/print/v1/events/order-error
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of a Bearer token.
For example: `Authorization: Bearer {token}`
</Prop>
<Prop name="Content-Type" type="string" required> Indicates the media type of the information sent in the request. This must be set to application/json.
For example: `Content-Type: application/json`
</Prop>
<Prop name="X-Canva-Print-Client-Id" type="string" required> Unique ID of the print partner making the request. </Prop> </Prop.List>
Body parameters
<Prop.List> <Prop name="request_type" type="string" required> <Prop.Extras> Available values: The only valid value is error_event. </Prop.Extras> </Prop>
<Prop name="order_reference_id" type="string" required> A unique, case-sensitive ID of the order in Canva's system. This must be the same value as the orderReferenceId path parameter.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="items" type="ItemErrorEvent[]" required> A list of updates to items in the order.
<Prop.Extras>
**Minimum items:** `1`
</Prop.Extras>
<PillAccordion title={<>Properties of <strong>items</strong></>} defaultExpanded={true}>
<Prop.List>
<Prop name="item_reference_id" type="string" required>
A unique, case-sensitive ID for an order item that the print partner can use when communicating with Canva.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="error_details" type="ErrorDetails" required>
The error details of the item. Errors details should be cleared from an item after it has been resolved.
<PillAccordion title={<>Properties of <strong>error_details</strong></>}>
<Prop.List>
<Prop name="issue_origin" type="string" required>
The origin of the issue.
<Prop.Extras>
**Available values:**
* `production`
* `order_url`
* `user_details`
* `user_address`
* `delivery`
* `unknown`
</Prop.Extras>
</Prop>
<Prop name="description" type="string" required>
A human readable message that describes the cause of the error.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop> </Prop.List>
Example requests
Single item, single error
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/print/v1/events/order-error' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --header 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=' \ --data '{ "request_type": "error_event", "order_reference_id": "FO123456789", "items": [ { "item_reference_id": "FI123456789", "error_details": { "issue_origin": "user_address", "description": "Address cannot be found. Please specify a valid delivery address." } } ] }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/print/v1/events/order-error", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28=",
},
body: JSON.stringify({
"request_type": "error_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
}
]
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/print/v1/events/order-error"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.header("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"request_type\": \"error_event\", \"order_reference_id\": \"FO123456789\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"error_details\": {\"issue_origin\": \"user_address\", \"description\": \"Address cannot be found. Please specify a valid delivery address.\"}}]}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28="
}
data = {
"request_type": "error_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
}
]
}
response = requests.post("https://api.canva.com/print/v1/events/order-error",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/print/v1/events/order-error"),
Headers =
{
{ "Authorization", "Bearer {token}" },
{ "X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=" },
},
Content = new StringContent(
"{\"request_type\": \"error_event\", \"order_reference_id\": \"FO123456789\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"error_details\": {\"issue_origin\": \"user_address\", \"description\": \"Address cannot be found. Please specify a valid delivery address.\"}}]}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"request_type": "error_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
}
]
}`)
url := "https://api.canva.com/print/v1/events/order-error"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/print/v1/events/order-error", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=', ), CURLOPT_POSTFIELDS => json_encode([ "request_type" => "error_event", "order_reference_id" => "FO123456789", "items" => [ [ "item_reference_id" => "FI123456789", "error_details" => [ "issue_origin" => "user_address", "description" => "Address cannot be found. Please specify a valid delivery address." ] ] ] ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/print/v1/events/order-error')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request['X-Canva-Print-Client-Id'] = 'Ym9zY236Ym9zY28='
request.body = <<REQUEST_BODY
{
"request_type": "error_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
}
]
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Multi item, multi error
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/print/v1/events/order-error' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --header 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=' \ --data '{ "request_type": "error_event", "order_reference_id": "FO123456789", "items": [ { "item_reference_id": "FI123456789", "error_details": { "issue_origin": "user_address", "description": "Address cannot be found. Please specify a valid delivery address." } }, { "item_reference_id": "F987654321", "error_details": { "issue_origin": "user_address", "description": "Address cannot be found. Please specify a valid delivery address." } } ] }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/print/v1/events/order-error", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28=",
},
body: JSON.stringify({
"request_type": "error_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
},
{
"item_reference_id": "F987654321",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
}
]
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/print/v1/events/order-error"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.header("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"request_type\": \"error_event\", \"order_reference_id\": \"FO123456789\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"error_details\": {\"issue_origin\": \"user_address\", \"description\": \"Address cannot be found. Please specify a valid delivery address.\"}}, {\"item_reference_id\": \"F987654321\", \"error_details\": {\"issue_origin\": \"user_address\", \"description\": \"Address cannot be found. Please specify a valid delivery address.\"}}]}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28="
}
data = {
"request_type": "error_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
},
{
"item_reference_id": "F987654321",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
}
]
}
response = requests.post("https://api.canva.com/print/v1/events/order-error",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/print/v1/events/order-error"),
Headers =
{
{ "Authorization", "Bearer {token}" },
{ "X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=" },
},
Content = new StringContent(
"{\"request_type\": \"error_event\", \"order_reference_id\": \"FO123456789\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"error_details\": {\"issue_origin\": \"user_address\", \"description\": \"Address cannot be found. Please specify a valid delivery address.\"}}, {\"item_reference_id\": \"F987654321\", \"error_details\": {\"issue_origin\": \"user_address\", \"description\": \"Address cannot be found. Please specify a valid delivery address.\"}}]}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"request_type": "error_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
},
{
"item_reference_id": "F987654321",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
}
]
}`)
url := "https://api.canva.com/print/v1/events/order-error"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/print/v1/events/order-error", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=', ), CURLOPT_POSTFIELDS => json_encode([ "request_type" => "error_event", "order_reference_id" => "FO123456789", "items" => [ [ "item_reference_id" => "FI123456789", "error_details" => [ "issue_origin" => "user_address", "description" => "Address cannot be found. Please specify a valid delivery address." ] ], [ "item_reference_id" => "F987654321", "error_details" => [ "issue_origin" => "user_address", "description" => "Address cannot be found. Please specify a valid delivery address." ] ] ] ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/print/v1/events/order-error')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request['X-Canva-Print-Client-Id'] = 'Ym9zY236Ym9zY28='
request.body = <<REQUEST_BODY
{
"request_type": "error_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
},
{
"item_reference_id": "F987654321",
"error_details": {
"issue_origin": "user_address",
"description": "Address cannot be found. Please specify a valid delivery address."
}
}
]
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns the status code 204 No content without a response body.
Error responses
400 Invalid request. For example, an invalid data format.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "invalid_request",
"message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
}401 Invalid or unauthorized client ID or secret.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "unauthorized_client",
"message": "The client is not authorized for action."
}403 Partner has no access to the order.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "permission_denied",
"message": "The resource owner or authorization server denied the request."
}Order Production Event
Creates an event to notify Canva about a production update for an order in the print partner's system.
HTTP method and URL path
POST https://api.canva.com/print/v1/events/order-production
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of a Bearer token.
For example: `Authorization: Bearer {token}`
</Prop>
<Prop name="Content-Type" type="string" required> Indicates the media type of the information sent in the request. This must be set to application/json.
For example: `Content-Type: application/json`
</Prop>
<Prop name="X-Canva-Print-Client-Id" type="string" required> Unique ID of the print partner making the request. </Prop> </Prop.List>
Body parameters
<Prop.List> <Prop name="request_type" type="string" required> <Prop.Extras> Available values: The only valid value is production_event. </Prop.Extras> </Prop>
<Prop name="order_reference_id" type="string" required> A unique, case-sensitive ID of the order in Canva's system. This must be the same value as the orderReferenceId path parameter.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="items" type="ItemUpdateEvent[]" required> A list of updates to items in the order.
<Prop.Extras>
**Minimum items:** `1`
</Prop.Extras>
<PillAccordion title={<>Properties of <strong>items</strong></>} defaultExpanded={true}>
<Prop.List>
<Prop name="item_reference_id" type="string" required>
A unique, case-sensitive ID for an order item that the print partner can use when communicating with Canva.
<Prop.Extras>
**Maximum length:** `11`
</Prop.Extras>
</Prop>
<Prop name="status" type="string" required>
The updated production status of the item. The values `ready_for_pickup` and `picked_up` are only valid when updating the status of a `PickupOrder`.
<Prop.Extras>
**Available values:**
* `received`
* `producing`
* `produced`
* `packaging`
* `ready_for_pickup`
* `picked_up`
</Prop.Extras>
</Prop>
<Prop name="production_location_reference" type="string" required>
The reference ID for the production location for the order.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
</Prop.List>
</PillAccordion>
</Prop> </Prop.List>
Example requests
Single item
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/print/v1/events/order-production' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --header 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=' \ --data '{ "request_type": "production_event", "order_reference_id": "FO123456789", "items": [ { "item_reference_id": "FI123456789", "status": "producing", "production_location_reference": "partnerLocation1234" } ] }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/print/v1/events/order-production", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28=",
},
body: JSON.stringify({
"request_type": "production_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"status": "producing",
"production_location_reference": "partnerLocation1234"
}
]
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/print/v1/events/order-production"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.header("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"request_type\": \"production_event\", \"order_reference_id\": \"FO123456789\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"status\": \"producing\", \"production_location_reference\": \"partnerLocation1234\"}]}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28="
}
data = {
"request_type": "production_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"status": "producing",
"production_location_reference": "partnerLocation1234"
}
]
}
response = requests.post("https://api.canva.com/print/v1/events/order-production",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/print/v1/events/order-production"),
Headers =
{
{ "Authorization", "Bearer {token}" },
{ "X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=" },
},
Content = new StringContent(
"{\"request_type\": \"production_event\", \"order_reference_id\": \"FO123456789\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"status\": \"producing\", \"production_location_reference\": \"partnerLocation1234\"}]}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"request_type": "production_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"status": "producing",
"production_location_reference": "partnerLocation1234"
}
]
}`)
url := "https://api.canva.com/print/v1/events/order-production"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/print/v1/events/order-production", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=', ), CURLOPT_POSTFIELDS => json_encode([ "request_type" => "production_event", "order_reference_id" => "FO123456789", "items" => [ [ "item_reference_id" => "FI123456789", "status" => "producing", "production_location_reference" => "partnerLocation1234" ] ] ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/print/v1/events/order-production')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request['X-Canva-Print-Client-Id'] = 'Ym9zY236Ym9zY28='
request.body = <<REQUEST_BODY
{
"request_type": "production_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"status": "producing",
"production_location_reference": "partnerLocation1234"
}
]
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Multi item
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/print/v1/events/order-production' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --header 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=' \ --data '{ "request_type": "production_event", "order_reference_id": "FO123456789", "items": [ { "item_reference_id": "FI123456789", "status": "producing", "production_location_reference": "partnerLocation1234" }, { "item_reference_id": "FI987654321", "status": "producing", "production_location_reference": "partnerLocation1234" } ] }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/print/v1/events/order-production", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28=",
},
body: JSON.stringify({
"request_type": "production_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"status": "producing",
"production_location_reference": "partnerLocation1234"
},
{
"item_reference_id": "FI987654321",
"status": "producing",
"production_location_reference": "partnerLocation1234"
}
]
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/print/v1/events/order-production"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.header("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"request_type\": \"production_event\", \"order_reference_id\": \"FO123456789\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"status\": \"producing\", \"production_location_reference\": \"partnerLocation1234\"}, {\"item_reference_id\": \"FI987654321\", \"status\": \"producing\", \"production_location_reference\": \"partnerLocation1234\"}]}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28="
}
data = {
"request_type": "production_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"status": "producing",
"production_location_reference": "partnerLocation1234"
},
{
"item_reference_id": "FI987654321",
"status": "producing",
"production_location_reference": "partnerLocation1234"
}
]
}
response = requests.post("https://api.canva.com/print/v1/events/order-production",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/print/v1/events/order-production"),
Headers =
{
{ "Authorization", "Bearer {token}" },
{ "X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=" },
},
Content = new StringContent(
"{\"request_type\": \"production_event\", \"order_reference_id\": \"FO123456789\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"status\": \"producing\", \"production_location_reference\": \"partnerLocation1234\"}, {\"item_reference_id\": \"FI987654321\", \"status\": \"producing\", \"production_location_reference\": \"partnerLocation1234\"}]}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"request_type": "production_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"status": "producing",
"production_location_reference": "partnerLocation1234"
},
{
"item_reference_id": "FI987654321",
"status": "producing",
"production_location_reference": "partnerLocation1234"
}
]
}`)
url := "https://api.canva.com/print/v1/events/order-production"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/print/v1/events/order-production", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=', ), CURLOPT_POSTFIELDS => json_encode([ "request_type" => "production_event", "order_reference_id" => "FO123456789", "items" => [ [ "item_reference_id" => "FI123456789", "status" => "producing", "production_location_reference" => "partnerLocation1234" ], [ "item_reference_id" => "FI987654321", "status" => "producing", "production_location_reference" => "partnerLocation1234" ] ] ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/print/v1/events/order-production')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request['X-Canva-Print-Client-Id'] = 'Ym9zY236Ym9zY28='
request.body = <<REQUEST_BODY
{
"request_type": "production_event",
"order_reference_id": "FO123456789",
"items": [
{
"item_reference_id": "FI123456789",
"status": "producing",
"production_location_reference": "partnerLocation1234"
},
{
"item_reference_id": "FI987654321",
"status": "producing",
"production_location_reference": "partnerLocation1234"
}
]
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns the status code 204 No content without a response body.
Error responses
400 Invalid request. For example, an invalid data format.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "invalid_request",
"message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
}401 Invalid or unauthorized client ID or secret.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "unauthorized_client",
"message": "The client is not authorized for action."
}403 Partner has no access to the order.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "permission_denied",
"message": "The resource owner or authorization server denied the request."
}Order Shipment Event
Creates an event to notify Canva about a shipment for an order in the print partner's system.
HTTP method and URL path
POST https://api.canva.com/print/v1/events/order-shipment
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of a Bearer token.
For example: `Authorization: Bearer {token}`
</Prop>
<Prop name="Content-Type" type="string" required> Indicates the media type of the information sent in the request. This must be set to application/json.
For example: `Content-Type: application/json`
</Prop>
<Prop name="X-Canva-Print-Client-Id" type="string" required> Unique ID of the print partner making the request. </Prop> </Prop.List>
Body parameters
<Prop.List> <Prop name="request_type" type="string" required> <Prop.Extras> Available values: The only valid value is shipment_event. </Prop.Extras> </Prop>
<Prop name="order_reference_id" type="string" required> A unique, case-sensitive ID of the order in Canva's system. This must be the same value as the orderReferenceId path parameter.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="shipments" type="ShipmentEvent[]" required> A list of shipments for the order.
<Prop.Extras>
**Minimum items:** `1`
</Prop.Extras>
<PillAccordion title={<>Properties of <strong>shipments</strong></>} defaultExpanded={true}>
<Prop.List>
<Prop name="tracking_number" type="string" required>
The tracking number provided by the carrier.
<Prop.Extras>
**Minimum length:** `1`
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="carrier" type="string" required>
The Canva-supported carrier delivering the shipment.
<Prop.Extras>
**Available values:**
* `allied_express`
* `allwayex`
* `amazon`
* `ams`
* `asendia`
* `aus_post`
* `b2c`
* `blue_dart`
* `bpost`
* `bring_no`
* `canada_post`
* `carriers`
* `chitchats`
* `chronopost`
* `correios`
* `correos`
* `correos_express`
* `couriers_please`
* `deutsche_post`
* `dhl`
* `dpd`
* `dpd_uk`
* `estafeta`
* `evri`
* `fastway`
* `fedex`
* `fleet_optics`
* `gls`
* `hunter_express`
* `ics`
* `icumulus`
* `india_post`
* `japan_post`
* `landmark_global`
* `laposte`
* `loomis_express`
* `lotte`
* `newzealand_couriers`
* `norsk_global`
* `paquetexpress`
* `parcel_force`
* `pitney_bowes`
* `post_nl`
* `post_nord`
* `purolator`
* `qxpress`
* `royal_mail`
* `sagawa`
* `sda`
* `seur`
* `spring_gds`
* `star_track`
* `swiss_post`
* `tnt`
* `toll`
* `uniuni`
* `ups`
* `usps`
* `yamato`
</Prop.Extras>
</Prop>
<Prop name="items" type="ShipmentItem[]" required>
The items included in the shipment.
<Prop.Extras>
**Minimum items:** `1`
</Prop.Extras>
<PillAccordion title={<>Properties of <strong>items</strong></>}>
<Prop.List>
<Prop name="item_reference_id" type="string" required>
A unique, case-sensitive ID for an order item that the partner can use when communicating with Canva.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="quantity" type="integer" required>
The number of copies of an item that were shipped.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="dispatch_location_reference" type="string" required>
The location reference ID of where the shipment was dispatched.
<Prop.Extras>
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="dispatched_at" type="integer" required>
When the shipment was dispatched, as a Unix timestamp (in seconds since the Unix Epoch).
</Prop>
</Prop.List>
</PillAccordion>
</Prop> </Prop.List>
Example requests
Single item, single shipment
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/print/v1/events/order-shipment' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --header 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=' \ --data '{ "request_type": "shipment_event", "order_reference_id": "FO123456789", "shipments": [ { "tracking_number": "123456789", "carrier": "fedex", "items": [ { "item_reference_id": "FI123456789", "quantity": 50 } ], "dispatched_at": 1726448251, "dispatch_location_reference": "partnerLocation1234" } ] }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/print/v1/events/order-shipment", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28=",
},
body: JSON.stringify({
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 50
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/print/v1/events/order-shipment"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.header("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"request_type\": \"shipment_event\", \"order_reference_id\": \"FO123456789\", \"shipments\": [{\"tracking_number\": \"123456789\", \"carrier\": \"fedex\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"quantity\": 50}], \"dispatched_at\": 1726448251, \"dispatch_location_reference\": \"partnerLocation1234\"}]}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28="
}
data = {
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 50
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}
response = requests.post("https://api.canva.com/print/v1/events/order-shipment",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/print/v1/events/order-shipment"),
Headers =
{
{ "Authorization", "Bearer {token}" },
{ "X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=" },
},
Content = new StringContent(
"{\"request_type\": \"shipment_event\", \"order_reference_id\": \"FO123456789\", \"shipments\": [{\"tracking_number\": \"123456789\", \"carrier\": \"fedex\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"quantity\": 50}], \"dispatched_at\": 1726448251, \"dispatch_location_reference\": \"partnerLocation1234\"}]}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 50
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}`)
url := "https://api.canva.com/print/v1/events/order-shipment"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/print/v1/events/order-shipment", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=', ), CURLOPT_POSTFIELDS => json_encode([ "request_type" => "shipment_event", "order_reference_id" => "FO123456789", "shipments" => [ [ "tracking_number" => "123456789", "carrier" => "fedex", "items" => [ [ "item_reference_id" => "FI123456789", "quantity" => 50 ] ], "dispatched_at" => 1726448251, "dispatch_location_reference" => "partnerLocation1234" ] ] ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/print/v1/events/order-shipment')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request['X-Canva-Print-Client-Id'] = 'Ym9zY236Ym9zY28='
request.body = <<REQUEST_BODY
{
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 50
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Multiple items, single shipment
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/print/v1/events/order-shipment' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --header 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=' \ --data '{ "request_type": "shipment_event", "order_reference_id": "FO123456789", "shipments": [ { "tracking_number": "123456789", "carrier": "fedex", "items": [ { "item_reference_id": "FI123456789", "quantity": 50 }, { "item_reference_id": "FI987654321", "quantity": 10 } ], "dispatched_at": 1726448251, "dispatch_location_reference": "partnerLocation1234" } ] }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/print/v1/events/order-shipment", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28=",
},
body: JSON.stringify({
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 50
},
{
"item_reference_id": "FI987654321",
"quantity": 10
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/print/v1/events/order-shipment"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.header("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"request_type\": \"shipment_event\", \"order_reference_id\": \"FO123456789\", \"shipments\": [{\"tracking_number\": \"123456789\", \"carrier\": \"fedex\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"quantity\": 50}, {\"item_reference_id\": \"FI987654321\", \"quantity\": 10}], \"dispatched_at\": 1726448251, \"dispatch_location_reference\": \"partnerLocation1234\"}]}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28="
}
data = {
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 50
},
{
"item_reference_id": "FI987654321",
"quantity": 10
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}
response = requests.post("https://api.canva.com/print/v1/events/order-shipment",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/print/v1/events/order-shipment"),
Headers =
{
{ "Authorization", "Bearer {token}" },
{ "X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=" },
},
Content = new StringContent(
"{\"request_type\": \"shipment_event\", \"order_reference_id\": \"FO123456789\", \"shipments\": [{\"tracking_number\": \"123456789\", \"carrier\": \"fedex\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"quantity\": 50}, {\"item_reference_id\": \"FI987654321\", \"quantity\": 10}], \"dispatched_at\": 1726448251, \"dispatch_location_reference\": \"partnerLocation1234\"}]}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 50
},
{
"item_reference_id": "FI987654321",
"quantity": 10
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}`)
url := "https://api.canva.com/print/v1/events/order-shipment"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/print/v1/events/order-shipment", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=', ), CURLOPT_POSTFIELDS => json_encode([ "request_type" => "shipment_event", "order_reference_id" => "FO123456789", "shipments" => [ [ "tracking_number" => "123456789", "carrier" => "fedex", "items" => [ [ "item_reference_id" => "FI123456789", "quantity" => 50 ], [ "item_reference_id" => "FI987654321", "quantity" => 10 ] ], "dispatched_at" => 1726448251, "dispatch_location_reference" => "partnerLocation1234" ] ] ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/print/v1/events/order-shipment')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request['X-Canva-Print-Client-Id'] = 'Ym9zY236Ym9zY28='
request.body = <<REQUEST_BODY
{
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 50
},
{
"item_reference_id": "FI987654321",
"quantity": 10
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Single item, multi shipment
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/print/v1/events/order-shipment' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --header 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=' \ --data '{ "request_type": "shipment_event", "order_reference_id": "FO123456789", "shipments": [ { "tracking_number": "123456789", "carrier": "fedex", "items": [ { "item_reference_id": "FI123456789", "quantity": 25 } ], "dispatched_at": 1726448251, "dispatch_location_reference": "partnerLocation1234" }, { "tracking_number": "987654321", "carrier": "fedex", "items": [ { "item_reference_id": "FI123456789", "quantity": 25 } ], "dispatched_at": 1726448251, "dispatch_location_reference": "partnerLocation1234" } ] }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/print/v1/events/order-shipment", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28=",
},
body: JSON.stringify({
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 25
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
},
{
"tracking_number": "987654321",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 25
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/print/v1/events/order-shipment"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.header("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"request_type\": \"shipment_event\", \"order_reference_id\": \"FO123456789\", \"shipments\": [{\"tracking_number\": \"123456789\", \"carrier\": \"fedex\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"quantity\": 25}], \"dispatched_at\": 1726448251, \"dispatch_location_reference\": \"partnerLocation1234\"}, {\"tracking_number\": \"987654321\", \"carrier\": \"fedex\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"quantity\": 25}], \"dispatched_at\": 1726448251, \"dispatch_location_reference\": \"partnerLocation1234\"}]}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"X-Canva-Print-Client-Id": "Ym9zY236Ym9zY28="
}
data = {
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 25
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
},
{
"tracking_number": "987654321",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 25
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}
response = requests.post("https://api.canva.com/print/v1/events/order-shipment",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/print/v1/events/order-shipment"),
Headers =
{
{ "Authorization", "Bearer {token}" },
{ "X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=" },
},
Content = new StringContent(
"{\"request_type\": \"shipment_event\", \"order_reference_id\": \"FO123456789\", \"shipments\": [{\"tracking_number\": \"123456789\", \"carrier\": \"fedex\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"quantity\": 25}], \"dispatched_at\": 1726448251, \"dispatch_location_reference\": \"partnerLocation1234\"}, {\"tracking_number\": \"987654321\", \"carrier\": \"fedex\", \"items\": [{\"item_reference_id\": \"FI123456789\", \"quantity\": 25}], \"dispatched_at\": 1726448251, \"dispatch_location_reference\": \"partnerLocation1234\"}]}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 25
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
},
{
"tracking_number": "987654321",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 25
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}`)
url := "https://api.canva.com/print/v1/events/order-shipment"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Canva-Print-Client-Id", "Ym9zY236Ym9zY28=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/print/v1/events/order-shipment", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', 'X-Canva-Print-Client-Id: Ym9zY236Ym9zY28=', ), CURLOPT_POSTFIELDS => json_encode([ "request_type" => "shipment_event", "order_reference_id" => "FO123456789", "shipments" => [ [ "tracking_number" => "123456789", "carrier" => "fedex", "items" => [ [ "item_reference_id" => "FI123456789", "quantity" => 25 ] ], "dispatched_at" => 1726448251, "dispatch_location_reference" => "partnerLocation1234" ], [ "tracking_number" => "987654321", "carrier" => "fedex", "items" => [ [ "item_reference_id" => "FI123456789", "quantity" => 25 ] ], "dispatched_at" => 1726448251, "dispatch_location_reference" => "partnerLocation1234" ] ] ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/print/v1/events/order-shipment')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request['X-Canva-Print-Client-Id'] = 'Ym9zY236Ym9zY28='
request.body = <<REQUEST_BODY
{
"request_type": "shipment_event",
"order_reference_id": "FO123456789",
"shipments": [
{
"tracking_number": "123456789",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 25
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
},
{
"tracking_number": "987654321",
"carrier": "fedex",
"items": [
{
"item_reference_id": "FI123456789",
"quantity": 25
}
],
"dispatched_at": 1726448251,
"dispatch_location_reference": "partnerLocation1234"
}
]
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns the status code 204 No content without a response body.
Error responses
400 Invalid request. For example, an invalid data format.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "invalid_request",
"message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
}401 Invalid or unauthorized client ID or secret.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "unauthorized_client",
"message": "The client is not authorized for action."
}403 Partner has no access to the order.
<Prop.List> <Prop name="code" type="string" required mode="output"> A short string indicating what failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `invalid_field`
* `invalid_header_value`
* `invalid_request`
* `permission_denied`
* `too_many_requests`
* `not_found`
* `bad_request_body`
* `bad_http_method`
* `bad_request_params`
* `bad_query_params`
* `endpoint_not_found`
* `unsupported_version`
* `invalid_access_token`
* `revoked_access_token`
* `invalid_client`
* `unauthorized_client`
* `invalid_basic_header`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output"> A human-readable description of what went wrong. </Prop> </Prop.List>
Example error response
json
{
"code": "permission_denied",
"message": "The resource owner or authorization server denied the request."
}