Create Return (Admin)
curl --request POST \
--url https://api.headlesscommerce.io/v1/admin/orders/{id}/returns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"lines": [
{
"order_line_id": "<string>",
"quantity": 2,
"reason": "<string>",
"condition": "<string>",
"exchange_variant_id": "<string>"
}
],
"reason": "<string>",
"customer_notes": "<string>"
}
'import requests
url = "https://api.headlesscommerce.io/v1/admin/orders/{id}/returns"
payload = {
"lines": [
{
"order_line_id": "<string>",
"quantity": 2,
"reason": "<string>",
"condition": "<string>",
"exchange_variant_id": "<string>"
}
],
"reason": "<string>",
"customer_notes": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
lines: [
{
order_line_id: '<string>',
quantity: 2,
reason: '<string>',
condition: '<string>',
exchange_variant_id: '<string>'
}
],
reason: '<string>',
customer_notes: '<string>'
})
};
fetch('https://api.headlesscommerce.io/v1/admin/orders/{id}/returns', 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.headlesscommerce.io/v1/admin/orders/{id}/returns",
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([
'lines' => [
[
'order_line_id' => '<string>',
'quantity' => 2,
'reason' => '<string>',
'condition' => '<string>',
'exchange_variant_id' => '<string>'
]
],
'reason' => '<string>',
'customer_notes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.headlesscommerce.io/v1/admin/orders/{id}/returns"
payload := strings.NewReader("{\n \"lines\": [\n {\n \"order_line_id\": \"<string>\",\n \"quantity\": 2,\n \"reason\": \"<string>\",\n \"condition\": \"<string>\",\n \"exchange_variant_id\": \"<string>\"\n }\n ],\n \"reason\": \"<string>\",\n \"customer_notes\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.headlesscommerce.io/v1/admin/orders/{id}/returns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"lines\": [\n {\n \"order_line_id\": \"<string>\",\n \"quantity\": 2,\n \"reason\": \"<string>\",\n \"condition\": \"<string>\",\n \"exchange_variant_id\": \"<string>\"\n }\n ],\n \"reason\": \"<string>\",\n \"customer_notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.headlesscommerce.io/v1/admin/orders/{id}/returns")
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.body = "{\n \"lines\": [\n {\n \"order_line_id\": \"<string>\",\n \"quantity\": 2,\n \"reason\": \"<string>\",\n \"condition\": \"<string>\",\n \"exchange_variant_id\": \"<string>\"\n }\n ],\n \"reason\": \"<string>\",\n \"customer_notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"order_id": "<string>",
"customer_id": "<string>",
"return_type": "refund",
"status": "requested",
"reason": "<string>",
"reason_category": "defective",
"customer_notes": "<string>",
"admin_notes": "<string>",
"lines": [
{
"id": "<string>",
"order_line_id": "<string>",
"quantity": 123,
"reason": "<string>",
"condition": "<string>",
"exchange_variant_id": "<string>"
}
],
"refund": {
"id": "<string>",
"order_id": "<string>",
"amount": {
"amount": 123,
"currency": "<string>"
},
"reason": "<string>",
"restock": true,
"status": "pending",
"lines": [
{
"order_line_id": "<string>",
"quantity": 123
}
],
"created_at": "2023-11-07T05:31:56Z"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Admin - Returns
Create Return (Admin)
POST
/
admin
/
orders
/
{id}
/
returns
Create Return (Admin)
curl --request POST \
--url https://api.headlesscommerce.io/v1/admin/orders/{id}/returns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"lines": [
{
"order_line_id": "<string>",
"quantity": 2,
"reason": "<string>",
"condition": "<string>",
"exchange_variant_id": "<string>"
}
],
"reason": "<string>",
"customer_notes": "<string>"
}
'import requests
url = "https://api.headlesscommerce.io/v1/admin/orders/{id}/returns"
payload = {
"lines": [
{
"order_line_id": "<string>",
"quantity": 2,
"reason": "<string>",
"condition": "<string>",
"exchange_variant_id": "<string>"
}
],
"reason": "<string>",
"customer_notes": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
lines: [
{
order_line_id: '<string>',
quantity: 2,
reason: '<string>',
condition: '<string>',
exchange_variant_id: '<string>'
}
],
reason: '<string>',
customer_notes: '<string>'
})
};
fetch('https://api.headlesscommerce.io/v1/admin/orders/{id}/returns', 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.headlesscommerce.io/v1/admin/orders/{id}/returns",
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([
'lines' => [
[
'order_line_id' => '<string>',
'quantity' => 2,
'reason' => '<string>',
'condition' => '<string>',
'exchange_variant_id' => '<string>'
]
],
'reason' => '<string>',
'customer_notes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.headlesscommerce.io/v1/admin/orders/{id}/returns"
payload := strings.NewReader("{\n \"lines\": [\n {\n \"order_line_id\": \"<string>\",\n \"quantity\": 2,\n \"reason\": \"<string>\",\n \"condition\": \"<string>\",\n \"exchange_variant_id\": \"<string>\"\n }\n ],\n \"reason\": \"<string>\",\n \"customer_notes\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.headlesscommerce.io/v1/admin/orders/{id}/returns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"lines\": [\n {\n \"order_line_id\": \"<string>\",\n \"quantity\": 2,\n \"reason\": \"<string>\",\n \"condition\": \"<string>\",\n \"exchange_variant_id\": \"<string>\"\n }\n ],\n \"reason\": \"<string>\",\n \"customer_notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.headlesscommerce.io/v1/admin/orders/{id}/returns")
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.body = "{\n \"lines\": [\n {\n \"order_line_id\": \"<string>\",\n \"quantity\": 2,\n \"reason\": \"<string>\",\n \"condition\": \"<string>\",\n \"exchange_variant_id\": \"<string>\"\n }\n ],\n \"reason\": \"<string>\",\n \"customer_notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"order_id": "<string>",
"customer_id": "<string>",
"return_type": "refund",
"status": "requested",
"reason": "<string>",
"reason_category": "defective",
"customer_notes": "<string>",
"admin_notes": "<string>",
"lines": [
{
"id": "<string>",
"order_line_id": "<string>",
"quantity": 123,
"reason": "<string>",
"condition": "<string>",
"exchange_variant_id": "<string>"
}
],
"refund": {
"id": "<string>",
"order_id": "<string>",
"amount": {
"amount": 123,
"currency": "<string>"
},
"reason": "<string>",
"restock": true,
"status": "pending",
"lines": [
{
"order_line_id": "<string>",
"quantity": 123
}
],
"created_at": "2023-11-07T05:31:56Z"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Authorizations
API Key. Example: sk_live_xxxxx or pk_live_xxxxx
Path Parameters
Resource ID
Body
application/json
Response
201 - application/json
Created
Available options:
refund, exchange Available options:
requested, approved, rejected, received, completed, cancelled Available options:
defective, wrong_item, changed_mind, damaged, other Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I