Update a promotion code
curl --request PUT \
--url https://platform.tolt.dev/v2/promotion-codes/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "SAM20",
"type": "percentage",
"value": "20"
}
'import requests
url = "https://platform.tolt.dev/v2/promotion-codes/{id}"
payload = {
"code": "SAM20",
"type": "percentage",
"value": "20"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: 'SAM20', type: 'percentage', value: '20'})
};
fetch('https://platform.tolt.dev/v2/promotion-codes/{id}', 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://platform.tolt.dev/v2/promotion-codes/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'code' => 'SAM20',
'type' => 'percentage',
'value' => '20'
]),
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://platform.tolt.dev/v2/promotion-codes/{id}"
payload := strings.NewReader("{\n \"code\": \"SAM20\",\n \"type\": \"percentage\",\n \"value\": \"20\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://platform.tolt.dev/v2/promotion-codes/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"SAM20\",\n \"type\": \"percentage\",\n \"value\": \"20\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.tolt.dev/v2/promotion-codes/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"SAM20\",\n \"type\": \"percentage\",\n \"value\": \"20\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Successfully updated promotion code",
"data": {
"id": "promo_gTCAUsWfdmN2GuCVRaHWNRan",
"code": "SAM20",
"type": "percentage",
"value": "20",
"duration": "forever",
"duration_in_months": null,
"active": true,
"entity_type": "partner",
"external_id": null,
"partner_id": "part_NLYzgNKuSuASvrvoxNtau6SY",
"program_id": "prg_T6z8aRW3XCmvFWP972RKxpAd",
"group_id": null,
"created_at": "2026-10-01T12:00:00Z",
"updated_at": "2026-10-01T12:00:00Z"
}
}{
"success": false,
"message": "request: Invalid input: expected object, received null",
"code": "validation_error",
"doc_url": "https://docs.tolt.com/errors#validation_error",
"errors": [
{
"field": "request",
"message": "Invalid input: expected object, received null"
}
]
}{
"success": false,
"message": "Unauthorized",
"code": "unauthorized",
"doc_url": "https://docs.tolt.com/errors#unauthorized"
}{
"success": false,
"message": "Promotion code not found",
"code": "not_found",
"doc_url": "https://docs.tolt.com/errors#not_found"
}{
"success": false,
"message": "The partner already has this promotion code",
"code": "already_exists",
"doc_url": "https://docs.tolt.com/errors#already_exists",
"errors": [
{
"field": "code",
"message": "The partner already has this promotion code"
}
]
}{
"success": false,
"message": "Request body exceeds 1 MB",
"code": "payload_too_large",
"doc_url": "https://docs.tolt.com/errors#payload_too_large"
}{
"success": false,
"message": "Too many requests. Retry after the window resets.",
"code": "rate_limited",
"doc_url": "https://docs.tolt.com/errors#rate_limited"
}Promotion codes
Update a promotion code
Updates a promotion code’s code, discount type or value.
PUT
/
v2
/
promotion-codes
/
{id}
Update a promotion code
curl --request PUT \
--url https://platform.tolt.dev/v2/promotion-codes/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "SAM20",
"type": "percentage",
"value": "20"
}
'import requests
url = "https://platform.tolt.dev/v2/promotion-codes/{id}"
payload = {
"code": "SAM20",
"type": "percentage",
"value": "20"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: 'SAM20', type: 'percentage', value: '20'})
};
fetch('https://platform.tolt.dev/v2/promotion-codes/{id}', 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://platform.tolt.dev/v2/promotion-codes/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'code' => 'SAM20',
'type' => 'percentage',
'value' => '20'
]),
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://platform.tolt.dev/v2/promotion-codes/{id}"
payload := strings.NewReader("{\n \"code\": \"SAM20\",\n \"type\": \"percentage\",\n \"value\": \"20\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://platform.tolt.dev/v2/promotion-codes/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"SAM20\",\n \"type\": \"percentage\",\n \"value\": \"20\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.tolt.dev/v2/promotion-codes/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"SAM20\",\n \"type\": \"percentage\",\n \"value\": \"20\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Successfully updated promotion code",
"data": {
"id": "promo_gTCAUsWfdmN2GuCVRaHWNRan",
"code": "SAM20",
"type": "percentage",
"value": "20",
"duration": "forever",
"duration_in_months": null,
"active": true,
"entity_type": "partner",
"external_id": null,
"partner_id": "part_NLYzgNKuSuASvrvoxNtau6SY",
"program_id": "prg_T6z8aRW3XCmvFWP972RKxpAd",
"group_id": null,
"created_at": "2026-10-01T12:00:00Z",
"updated_at": "2026-10-01T12:00:00Z"
}
}{
"success": false,
"message": "request: Invalid input: expected object, received null",
"code": "validation_error",
"doc_url": "https://docs.tolt.com/errors#validation_error",
"errors": [
{
"field": "request",
"message": "Invalid input: expected object, received null"
}
]
}{
"success": false,
"message": "Unauthorized",
"code": "unauthorized",
"doc_url": "https://docs.tolt.com/errors#unauthorized"
}{
"success": false,
"message": "Promotion code not found",
"code": "not_found",
"doc_url": "https://docs.tolt.com/errors#not_found"
}{
"success": false,
"message": "The partner already has this promotion code",
"code": "already_exists",
"doc_url": "https://docs.tolt.com/errors#already_exists",
"errors": [
{
"field": "code",
"message": "The partner already has this promotion code"
}
]
}{
"success": false,
"message": "Request body exceeds 1 MB",
"code": "payload_too_large",
"doc_url": "https://docs.tolt.com/errors#payload_too_large"
}{
"success": false,
"message": "Too many requests. Retry after the window resets.",
"code": "rate_limited",
"doc_url": "https://docs.tolt.com/errors#rate_limited"
}Authorizations
Tolt API key sent as a bearer token.
Path Parameters
Example:
"promo_gTCAUsWfdmN2GuCVRaHWNRan"
Body
application/json
The discount code as customers enter it at checkout. Customers and payments that use it are attributed to the code's partner. A partner cannot have the same code twice, ignoring case.
Required string length:
1 - 255Whether value is a percent off or a fixed amount off.
Available options:
fixed, percentage, null Size of the discount as a plain decimal: a percent from 0 to 100 for percentage codes ("20" is 20%), or an amount from 0 to 1,000,000 in major units of the program currency for fixed codes ("20" is 20.00). null clears it.
Maximum string length:
255
