Skip to main content
POST
/
open-api
/
v1.0
/
promotions
Create a promotion
curl --request POST \
  --url https://api.fourthwall.com/open-api/v1.0/promotions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "<string>",
  "discount": {
    "percentage": 123,
    "type": "<string>",
    "money": {
      "value": 10,
      "currency": "USD"
    },
    "freeShipping": true
  },
  "type": "<string>",
  "codes": [
    "<string>"
  ],
  "subscriptionType": {
    "type": "<string>"
  },
  "tiers": {
    "type": "<string>"
  }
}
'
import requests

url = "https://api.fourthwall.com/open-api/v1.0/promotions"

payload = {
"code": "<string>",
"discount": {
"percentage": 123,
"type": "<string>",
"money": {
"value": 10,
"currency": "USD"
},
"freeShipping": True
},
"type": "<string>",
"codes": ["<string>"],
"subscriptionType": { "type": "<string>" },
"tiers": { "type": "<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({
code: '<string>',
discount: {
percentage: 123,
type: '<string>',
money: {value: 10, currency: 'USD'},
freeShipping: true
},
type: '<string>',
codes: ['<string>'],
subscriptionType: {type: '<string>'},
tiers: {type: '<string>'}
})
};

fetch('https://api.fourthwall.com/open-api/v1.0/promotions', 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.fourthwall.com/open-api/v1.0/promotions",
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([
'code' => '<string>',
'discount' => [
'percentage' => 123,
'type' => '<string>',
'money' => [
'value' => 10,
'currency' => 'USD'
],
'freeShipping' => true
],
'type' => '<string>',
'codes' => [
'<string>'
],
'subscriptionType' => [
'type' => '<string>'
],
'tiers' => [
'type' => '<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.fourthwall.com/open-api/v1.0/promotions"

payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"discount\": {\n \"percentage\": 123,\n \"type\": \"<string>\",\n \"money\": {\n \"value\": 10,\n \"currency\": \"USD\"\n },\n \"freeShipping\": true\n },\n \"type\": \"<string>\",\n \"codes\": [\n \"<string>\"\n ],\n \"subscriptionType\": {\n \"type\": \"<string>\"\n },\n \"tiers\": {\n \"type\": \"<string>\"\n }\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.fourthwall.com/open-api/v1.0/promotions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\",\n \"discount\": {\n \"percentage\": 123,\n \"type\": \"<string>\",\n \"money\": {\n \"value\": 10,\n \"currency\": \"USD\"\n },\n \"freeShipping\": true\n },\n \"type\": \"<string>\",\n \"codes\": [\n \"<string>\"\n ],\n \"subscriptionType\": {\n \"type\": \"<string>\"\n },\n \"tiers\": {\n \"type\": \"<string>\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.fourthwall.com/open-api/v1.0/promotions")

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 \"code\": \"<string>\",\n \"discount\": {\n \"percentage\": 123,\n \"type\": \"<string>\",\n \"money\": {\n \"value\": 10,\n \"currency\": \"USD\"\n },\n \"freeShipping\": true\n },\n \"type\": \"<string>\",\n \"codes\": [\n \"<string>\"\n ],\n \"subscriptionType\": {\n \"type\": \"<string>\"\n },\n \"tiers\": {\n \"type\": \"<string>\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "code": "<string>",
  "discount": {
    "percentage": 123,
    "type": "<string>",
    "money": {
      "value": 10,
      "currency": "USD"
    },
    "freeShipping": true
  },
  "requirements": {
    "minimumOrderValue": {
      "value": 10,
      "currency": "USD"
    }
  },
  "usageCount": 123,
  "limits": {
    "maximumUsesNumber": 123,
    "oneUsePerCustomer": true
  },
  "appliesTo": {
    "type": "<string>"
  },
  "type": "<string>",
  "title": "<string>"
}
OAuth scope: promotions_writeAPI keys have full access to this endpoint.

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json
code
string
required
discount
Percentage · object
required
type
string
required
Allowed value: "MEMBERSHIPS_MULTI"
codes
string[]
required
requirements
Memberships · object
appliesToProducts
Open Api Promotion Selected Products · object
limits
Open Api Promotion Limits · object
subscriptionType
All Members · object
tiers
All Tiers · object

Response

OK

id
string
required
code
string
required
discount
Fixed Amount · object
required
status
enum<string>
required
Available options:
Live,
Ended,
Archived,
AllUsed
requirements
Shop · object
required
usageCount
integer<int32>
required
limits
Promotion Limits · object
required
appliesTo
Entire Order · object
required
type
string
required
Allowed value: "SHOP_AUTO_APPLYING"
title
string
required