curl --request PATCH \
--url https://api.scrip.dev/v1/programs/{programId}/rewards/{rewardId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"available_from": "2024-01-01T00:00:00Z",
"available_until": "2024-12-31T23:59:59Z",
"category": "Gift Cards",
"description": "Redeemable for a $10 gift card",
"max_per_participant": 2,
"max_total": 100,
"metadata": {},
"name": "$10 Gift Card",
"status": "ACTIVE",
"unit_cost": "1000.00"
}
'import requests
url = "https://api.scrip.dev/v1/programs/{programId}/rewards/{rewardId}"
payload = {
"available_from": "2024-01-01T00:00:00Z",
"available_until": "2024-12-31T23:59:59Z",
"category": "Gift Cards",
"description": "Redeemable for a $10 gift card",
"max_per_participant": 2,
"max_total": 100,
"metadata": {},
"name": "$10 Gift Card",
"status": "ACTIVE",
"unit_cost": "1000.00"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
available_from: '2024-01-01T00:00:00Z',
available_until: '2024-12-31T23:59:59Z',
category: 'Gift Cards',
description: 'Redeemable for a $10 gift card',
max_per_participant: 2,
max_total: 100,
metadata: {},
name: '$10 Gift Card',
status: 'ACTIVE',
unit_cost: '1000.00'
})
};
fetch('https://api.scrip.dev/v1/programs/{programId}/rewards/{rewardId}', 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.scrip.dev/v1/programs/{programId}/rewards/{rewardId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'available_from' => '2024-01-01T00:00:00Z',
'available_until' => '2024-12-31T23:59:59Z',
'category' => 'Gift Cards',
'description' => 'Redeemable for a $10 gift card',
'max_per_participant' => 2,
'max_total' => 100,
'metadata' => [
],
'name' => '$10 Gift Card',
'status' => 'ACTIVE',
'unit_cost' => '1000.00'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <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.scrip.dev/v1/programs/{programId}/rewards/{rewardId}"
payload := strings.NewReader("{\n \"available_from\": \"2024-01-01T00:00:00Z\",\n \"available_until\": \"2024-12-31T23:59:59Z\",\n \"category\": \"Gift Cards\",\n \"description\": \"Redeemable for a $10 gift card\",\n \"max_per_participant\": 2,\n \"max_total\": 100,\n \"metadata\": {},\n \"name\": \"$10 Gift Card\",\n \"status\": \"ACTIVE\",\n \"unit_cost\": \"1000.00\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<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.patch("https://api.scrip.dev/v1/programs/{programId}/rewards/{rewardId}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"available_from\": \"2024-01-01T00:00:00Z\",\n \"available_until\": \"2024-12-31T23:59:59Z\",\n \"category\": \"Gift Cards\",\n \"description\": \"Redeemable for a $10 gift card\",\n \"max_per_participant\": 2,\n \"max_total\": 100,\n \"metadata\": {},\n \"name\": \"$10 Gift Card\",\n \"status\": \"ACTIVE\",\n \"unit_cost\": \"1000.00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/programs/{programId}/rewards/{rewardId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"available_from\": \"2024-01-01T00:00:00Z\",\n \"available_until\": \"2024-12-31T23:59:59Z\",\n \"category\": \"Gift Cards\",\n \"description\": \"Redeemable for a $10 gift card\",\n \"max_per_participant\": 2,\n \"max_total\": 100,\n \"metadata\": {},\n \"name\": \"$10 Gift Card\",\n \"status\": \"ACTIVE\",\n \"unit_cost\": \"1000.00\"\n}"
response = http.request(request)
puts response.read_body{
"asset_id": "550e8400-e29b-41d4-a716-446655440002",
"auto_managed": false,
"available_from": "2024-01-01T00:00:00Z",
"available_until": "2024-12-31T23:59:59Z",
"category": "Gift Cards",
"committed_units": 42,
"created_at": "2024-01-15T10:30:00Z",
"delivered_units": 39,
"description": "Redeemable for a $10 gift card",
"display": {
"description_html": "<p>Use this gift card online or in store.</p>",
"disclosure_html": "<p>Valid in the United States.</p>",
"image_url": "https://images.example.com/gift-card.png",
"instructions_html": "<p>Present the gift card at checkout.</p>"
},
"face_currency": "USD",
"face_value_minor": 1000,
"fulfillment": {
"account_status": "ACTIVE",
"asset_scale": 2,
"countries": [
"US"
],
"currencies": [
"USD"
],
"delivery_method": "claim_link",
"denominations_minor": [
1000,
2500
],
"rate": "1.5",
"value_max_minor": 10000,
"value_min_minor": 500
},
"fulfillment_product_id": "550e8400-e29b-41d4-a716-446655440004",
"id": "550e8400-e29b-41d4-a716-446655440000",
"kind": "CUSTOM",
"max_per_participant": 2,
"max_total": 100,
"metadata": {},
"name": "$10 Gift Card",
"pending_units": 3,
"program_id": "550e8400-e29b-41d4-a716-446655440001",
"redemption_type": "UNIT_BASED",
"reward_source_id": "550e8400-e29b-41d4-a716-446655440003",
"status": "ACTIVE",
"unit_cost": "1000.00",
"updated_at": "2024-01-15T10:30:00Z"
}{
"code": "bad_request",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Invalid request parameters"
}{
"code": "unauthorized",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Missing or invalid credentials"
}{
"code": "not_found",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Resource not found"
}{
"code": "conflict",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Resource already exists or state conflict"
}{
"code": "unsupported_media_type",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Content-Type must be application/json"
}{
"code": "internal_error",
"message": "An internal error occurred"
}Update a reward
Partially update a reward.
curl --request PATCH \
--url https://api.scrip.dev/v1/programs/{programId}/rewards/{rewardId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"available_from": "2024-01-01T00:00:00Z",
"available_until": "2024-12-31T23:59:59Z",
"category": "Gift Cards",
"description": "Redeemable for a $10 gift card",
"max_per_participant": 2,
"max_total": 100,
"metadata": {},
"name": "$10 Gift Card",
"status": "ACTIVE",
"unit_cost": "1000.00"
}
'import requests
url = "https://api.scrip.dev/v1/programs/{programId}/rewards/{rewardId}"
payload = {
"available_from": "2024-01-01T00:00:00Z",
"available_until": "2024-12-31T23:59:59Z",
"category": "Gift Cards",
"description": "Redeemable for a $10 gift card",
"max_per_participant": 2,
"max_total": 100,
"metadata": {},
"name": "$10 Gift Card",
"status": "ACTIVE",
"unit_cost": "1000.00"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
available_from: '2024-01-01T00:00:00Z',
available_until: '2024-12-31T23:59:59Z',
category: 'Gift Cards',
description: 'Redeemable for a $10 gift card',
max_per_participant: 2,
max_total: 100,
metadata: {},
name: '$10 Gift Card',
status: 'ACTIVE',
unit_cost: '1000.00'
})
};
fetch('https://api.scrip.dev/v1/programs/{programId}/rewards/{rewardId}', 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.scrip.dev/v1/programs/{programId}/rewards/{rewardId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'available_from' => '2024-01-01T00:00:00Z',
'available_until' => '2024-12-31T23:59:59Z',
'category' => 'Gift Cards',
'description' => 'Redeemable for a $10 gift card',
'max_per_participant' => 2,
'max_total' => 100,
'metadata' => [
],
'name' => '$10 Gift Card',
'status' => 'ACTIVE',
'unit_cost' => '1000.00'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <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.scrip.dev/v1/programs/{programId}/rewards/{rewardId}"
payload := strings.NewReader("{\n \"available_from\": \"2024-01-01T00:00:00Z\",\n \"available_until\": \"2024-12-31T23:59:59Z\",\n \"category\": \"Gift Cards\",\n \"description\": \"Redeemable for a $10 gift card\",\n \"max_per_participant\": 2,\n \"max_total\": 100,\n \"metadata\": {},\n \"name\": \"$10 Gift Card\",\n \"status\": \"ACTIVE\",\n \"unit_cost\": \"1000.00\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<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.patch("https://api.scrip.dev/v1/programs/{programId}/rewards/{rewardId}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"available_from\": \"2024-01-01T00:00:00Z\",\n \"available_until\": \"2024-12-31T23:59:59Z\",\n \"category\": \"Gift Cards\",\n \"description\": \"Redeemable for a $10 gift card\",\n \"max_per_participant\": 2,\n \"max_total\": 100,\n \"metadata\": {},\n \"name\": \"$10 Gift Card\",\n \"status\": \"ACTIVE\",\n \"unit_cost\": \"1000.00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/programs/{programId}/rewards/{rewardId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"available_from\": \"2024-01-01T00:00:00Z\",\n \"available_until\": \"2024-12-31T23:59:59Z\",\n \"category\": \"Gift Cards\",\n \"description\": \"Redeemable for a $10 gift card\",\n \"max_per_participant\": 2,\n \"max_total\": 100,\n \"metadata\": {},\n \"name\": \"$10 Gift Card\",\n \"status\": \"ACTIVE\",\n \"unit_cost\": \"1000.00\"\n}"
response = http.request(request)
puts response.read_body{
"asset_id": "550e8400-e29b-41d4-a716-446655440002",
"auto_managed": false,
"available_from": "2024-01-01T00:00:00Z",
"available_until": "2024-12-31T23:59:59Z",
"category": "Gift Cards",
"committed_units": 42,
"created_at": "2024-01-15T10:30:00Z",
"delivered_units": 39,
"description": "Redeemable for a $10 gift card",
"display": {
"description_html": "<p>Use this gift card online or in store.</p>",
"disclosure_html": "<p>Valid in the United States.</p>",
"image_url": "https://images.example.com/gift-card.png",
"instructions_html": "<p>Present the gift card at checkout.</p>"
},
"face_currency": "USD",
"face_value_minor": 1000,
"fulfillment": {
"account_status": "ACTIVE",
"asset_scale": 2,
"countries": [
"US"
],
"currencies": [
"USD"
],
"delivery_method": "claim_link",
"denominations_minor": [
1000,
2500
],
"rate": "1.5",
"value_max_minor": 10000,
"value_min_minor": 500
},
"fulfillment_product_id": "550e8400-e29b-41d4-a716-446655440004",
"id": "550e8400-e29b-41d4-a716-446655440000",
"kind": "CUSTOM",
"max_per_participant": 2,
"max_total": 100,
"metadata": {},
"name": "$10 Gift Card",
"pending_units": 3,
"program_id": "550e8400-e29b-41d4-a716-446655440001",
"redemption_type": "UNIT_BASED",
"reward_source_id": "550e8400-e29b-41d4-a716-446655440003",
"status": "ACTIVE",
"unit_cost": "1000.00",
"updated_at": "2024-01-15T10:30:00Z"
}{
"code": "bad_request",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Invalid request parameters"
}{
"code": "unauthorized",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Missing or invalid credentials"
}{
"code": "not_found",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Resource not found"
}{
"code": "conflict",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Resource already exists or state conflict"
}{
"code": "unsupported_media_type",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Content-Type must be application/json"
}{
"code": "internal_error",
"message": "An internal error occurred"
}name, description, category, unit_cost, max_total, max_per_participant, status, available_from, available_until, and metadata. The redemption_type and asset_id fields are immutable and cannot be updated.
Reward names must be unique within a program. A 409 is returned with code name_exists if the name conflicts with another reward.
To archive a reward, set status to ARCHIVED.
Managed rewards (auto_managed: true) return 409 auto_managed_item. Update their reward source or product settings to change selection and pricing or remove them from the catalog.
Authorizations
API key passed in the X-API-Key header.
Body
Reward updates
Start of the availability window (RFC 3339, null if always available)
"2024-01-01T00:00:00Z"
End of the availability window (RFC 3339, null if no end date)
"2024-12-31T23:59:59Z"
Grouping label for organizing rewards in the catalog
100"Gift Cards"
Details about the reward
1000"Redeemable for a $10 gift card"
Per-participant redemption limit (UNIT_BASED only, null = unlimited)
2
Global inventory limit (UNIT_BASED only, null = unlimited)
100
Custom key-value data attached to this reward
Display name for the reward
1 - 255"$10 Gift Card"
Lifecycle status: DRAFT, ACTIVE, OUT_OF_STOCK, or ARCHIVED
DRAFT, ACTIVE, OUT_OF_STOCK, ARCHIVED "ACTIVE"
Cost per unit in the reward's asset (decimal string for precision, must be positive)
"1000.00"
Response
Reward updated
A reward with its pricing, inventory, availability, and metadata
Asset used to price this reward
"550e8400-e29b-41d4-a716-446655440002"
Whether the catalog sync manages this item's lifecycle automatically
false
Start of the availability window (RFC 3339, null if always available)
"2024-01-01T00:00:00Z"
End of the availability window (RFC 3339, null if no end date)
"2024-12-31T23:59:59Z"
Grouping label for organizing rewards in the catalog
"Gift Cards"
UNIT_BASED units currently consuming inventory. Includes delivered and pending units. Null for AMOUNT_BASED rewards.
42
When this reward was created (RFC 3339)
"2024-01-15T10:30:00Z"
UNIT_BASED units whose redemption has been captured. Null for AMOUNT_BASED rewards.
39
Details about the reward
"Redeemable for a $10 gift card"
Product content for displaying a managed reward
Show child attributes
Show child attributes
ISO 4217 currency of the face value (PROVIDER items only)
"USD"
Pinned face value in minor units (fixed-denomination PROVIDER items only)
1000
Supported values, currencies, delivery, and pricing for managed rewards
Show child attributes
Show child attributes
Product ordered when this reward is redeemed. Present for managed rewards (kind PROVIDER).
"550e8400-e29b-41d4-a716-446655440004"
Unique identifier for this reward
"550e8400-e29b-41d4-a716-446655440000"
Whether you created the reward directly (CUSTOM) or Scrip manages it through a reward source (PROVIDER)
"CUSTOM"
Per-participant redemption limit (UNIT_BASED only, null = unlimited)
2
Global inventory limit (UNIT_BASED only, null = unlimited)
100
Custom key-value data attached to this reward
Display name for this reward
"$10 Gift Card"
UNIT_BASED units awaiting fulfillment. Null for AMOUNT_BASED rewards.
3
Program this reward belongs to
"550e8400-e29b-41d4-a716-446655440001"
How the reward is redeemed: UNIT_BASED (discrete quantities) or AMOUNT_BASED (variable amounts)
"UNIT_BASED"
Reward source that supplies this managed reward
"550e8400-e29b-41d4-a716-446655440003"
Lifecycle status: DRAFT, ACTIVE, OUT_OF_STOCK, or ARCHIVED
"ACTIVE"
Fixed price per unit. For variable-value managed rewards, use fulfillment.rate to calculate the charge.
"1000.00"
When this reward was last modified (RFC 3339)
"2024-01-15T10:30:00Z"