Create Return Deep Link
curl --request POST \
--url https://api.loopreturns.com/api/v1/order/link \
--header 'Content-Type: application/json' \
--header 'X-Authorization: <api-key>' \
--data '
{
"name": "Shopify Order Name",
"zip": "43215",
"gift": false
}
'import requests
url = "https://api.loopreturns.com/api/v1/order/link"
payload = {
"name": "Shopify Order Name",
"zip": "43215",
"gift": False
}
headers = {
"X-Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Authorization': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Shopify Order Name', zip: '43215', gift: false})
};
fetch('https://api.loopreturns.com/api/v1/order/link', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.loopreturns.com/api/v1/order/link",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Shopify Order Name',
'zip' => '43215',
'gift' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.loopreturns.com/api/v1/order/link"
payload := strings.NewReader("{\n \"name\": \"Shopify Order Name\",\n \"zip\": \"43215\",\n \"gift\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.loopreturns.com/api/v1/order/link")
.header("X-Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Shopify Order Name\",\n \"zip\": \"43215\",\n \"gift\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.loopreturns.com/api/v1/order/link")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Shopify Order Name\",\n \"zip\": \"43215\",\n \"gift\": false\n}"
response = http.request(request)
puts response.read_body{
"url": "https://test-shop.loopreturns.com/#/link/examp1e-uu1d-h3r3"
}{
"errors": [
"errorCode1"
]
}{
"errors": "Unauthorized."
}{
"errors": {
"message": "Missing fields - \"name\" and \"zip\" are required."
},
"data": {
"name": "<string>",
"zip": "<string>",
"size": 123,
"type": "<string>",
"gift": true
}
}Return Actions
Create Return Deep Link
Create a deep link URL.
Depending on a shop’s settings, the zip value could be an email, phone number, or postal
code. All use the key zip.
Required API key scope
- Orders
POST
/
order
/
link
Create Return Deep Link
curl --request POST \
--url https://api.loopreturns.com/api/v1/order/link \
--header 'Content-Type: application/json' \
--header 'X-Authorization: <api-key>' \
--data '
{
"name": "Shopify Order Name",
"zip": "43215",
"gift": false
}
'import requests
url = "https://api.loopreturns.com/api/v1/order/link"
payload = {
"name": "Shopify Order Name",
"zip": "43215",
"gift": False
}
headers = {
"X-Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Authorization': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Shopify Order Name', zip: '43215', gift: false})
};
fetch('https://api.loopreturns.com/api/v1/order/link', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.loopreturns.com/api/v1/order/link",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Shopify Order Name',
'zip' => '43215',
'gift' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.loopreturns.com/api/v1/order/link"
payload := strings.NewReader("{\n \"name\": \"Shopify Order Name\",\n \"zip\": \"43215\",\n \"gift\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.loopreturns.com/api/v1/order/link")
.header("X-Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Shopify Order Name\",\n \"zip\": \"43215\",\n \"gift\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.loopreturns.com/api/v1/order/link")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Shopify Order Name\",\n \"zip\": \"43215\",\n \"gift\": false\n}"
response = http.request(request)
puts response.read_body{
"url": "https://test-shop.loopreturns.com/#/link/examp1e-uu1d-h3r3"
}{
"errors": [
"errorCode1"
]
}{
"errors": "Unauthorized."
}{
"errors": {
"message": "Missing fields - \"name\" and \"zip\" are required."
},
"data": {
"name": "<string>",
"zip": "<string>",
"size": 123,
"type": "<string>",
"gift": true
}
}Authorizations
Body
application/json
The name of the order in the commerce provider (e.g. Shopify).
Example:
"Shopify Order Name"
The order detail used to identify the order. Often the customer's shipping ZIP code, but depending on the merchant's shop settings, could also be the customer's email or phone number. A phone number matches the shipping address phone, or the billing address or customer phone when the order has no shipping address (for example, a local pickup order).
Example:
"43215"
Whether or not the return will use Loop's Gift flow. For details, see Gift Returns.
Example:
false
Response
Success
Example:
"https://test-shop.loopreturns.com/#/link/examp1e-uu1d-h3r3"