Skip to main content
POST
/
webhooks
Create Webhook
curl --request POST \
  --url https://api.loopreturns.com/api/v1/webhooks \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "<string>",
  "status": "inactive"
}
'
import requests

url = "https://api.loopreturns.com/api/v1/webhooks"

payload = {
"url": "<string>",
"status": "inactive"
}
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({url: '<string>', status: 'inactive'})
};

fetch('https://api.loopreturns.com/api/v1/webhooks', 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/webhooks",
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([
'url' => '<string>',
'status' => 'inactive'
]),
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.loopreturns.com/api/v1/webhooks"

payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"status\": \"inactive\"\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.loopreturns.com/api/v1/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"status\": \"inactive\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.loopreturns.com/api/v1/webhooks")

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 \"url\": \"<string>\",\n \"status\": \"inactive\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": 123,
  "shop_id": 123,
  "url": "<string>"
}
{
"errors": {
"code": "<string>",
"message": "<string>"
}
}
{
"errors": "<string>"
}
{
"message": "<string>",
"errors": {}
}

Authorizations

Authorization
string
header
required

OAuth 2.0 authorization

Body

application/json
topic
enum<string>
required

The webhook's topic.

Available options:
return,
label,
restock,
label.request,
giftcard,
happy.returns.shipment
Example:

"return"

trigger
enum<string>
required

The condition which triggers the webhook.

Available options:
return.created,
return.updated,
return.closed,
label.created,
label.updated,
restock.requested,
label.request.issued,
label.request.cancelled,
giftcard.requested,
shipment.processed
Example:

"return.created"

url
string
required

The webhook's URL.

Example:

"https://example.com/webhook"

status
enum<string>
default:inactive

The webhook's status.

Available options:
active,
inactive

Response

Created

id
integer

The webhook's unique identifier.

Example:

12345

shop_id
integer

The unique identifier of the shop that created the webhook.

Example:

65432

topic
enum<string>

The webhook's topic.

Available options:
return,
label,
restock,
label.request,
giftcard,
happy.returns.shipment
Example:

"return"

trigger
enum<string>

The condition which triggers the webhook.

Available options:
return.created,
return.updated,
return.closed,
label.created,
label.updated,
restock.requested,
label.request.issued,
label.request.cancelled,
giftcard.requested,
shipment.processed
Example:

"return.created"

url
string

The webhook's URL.

Example:

"https://example.com/webhook"

status
enum<string>

The webhook's status.

Available options:
active,
inactive