Ativar ou desativar um cupom
curl --request PATCH \
--url https://api.ephra.io/v1/coupons/{couponId}/active \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"active": false
}
'import requests
url = "https://api.ephra.io/v1/coupons/{couponId}/active"
payload = { "active": False }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({active: false})
};
fetch('https://api.ephra.io/v1/coupons/{couponId}/active', 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.ephra.io/v1/coupons/{couponId}/active",
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([
'active' => false
]),
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.ephra.io/v1/coupons/{couponId}/active"
payload := strings.NewReader("{\n \"active\": false\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.ephra.io/v1/coupons/{couponId}/active")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"active\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ephra.io/v1/coupons/{couponId}/active")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"active\": false\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": 3120,
"code": "BLACK50",
"discountType": "percent",
"discountPercent": 50,
"discountAmountInCents": null,
"appliesTo": "selected",
"paymentMethods": [
"pix",
"credit_card"
],
"startAt": "2026-11-20T03:00:00.000Z",
"expiresAt": "2026-12-01T02:59:59.000Z",
"active": false,
"maxRedemptions": 500,
"autoApply": false,
"triggerProductId": null,
"triggerOfferId": null,
"lookbackPeriod": null,
"createdAt": "2026-09-05T14:00:00.000Z",
"updatedAt": "2026-09-11T11:30:00.000Z"
}
}{
"success": false,
"message": "Token inválido ou expirado"
}{
"success": false,
"message": "Recurso não encontrado"
}{
"success": false,
"message": "name: Nome é obrigatório"
}{
"success": false,
"message": "Muitas requisições. Tente novamente em breve."
}{
"success": false,
"message": "Erro interno do servidor"
}Catálogo
Ativar ou desativar um cupom
Liga ou desliga o cupom na hora, parando ou retomando os descontos sem apagar o histórico de uso. Informe active para uma escrita idempotente, ou mande o corpo vazio para inverter o estado atual.
PATCH
/
v1
/
coupons
/
{couponId}
/
active
Ativar ou desativar um cupom
curl --request PATCH \
--url https://api.ephra.io/v1/coupons/{couponId}/active \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"active": false
}
'import requests
url = "https://api.ephra.io/v1/coupons/{couponId}/active"
payload = { "active": False }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({active: false})
};
fetch('https://api.ephra.io/v1/coupons/{couponId}/active', 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.ephra.io/v1/coupons/{couponId}/active",
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([
'active' => false
]),
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.ephra.io/v1/coupons/{couponId}/active"
payload := strings.NewReader("{\n \"active\": false\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.ephra.io/v1/coupons/{couponId}/active")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"active\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ephra.io/v1/coupons/{couponId}/active")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"active\": false\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": 3120,
"code": "BLACK50",
"discountType": "percent",
"discountPercent": 50,
"discountAmountInCents": null,
"appliesTo": "selected",
"paymentMethods": [
"pix",
"credit_card"
],
"startAt": "2026-11-20T03:00:00.000Z",
"expiresAt": "2026-12-01T02:59:59.000Z",
"active": false,
"maxRedemptions": 500,
"autoApply": false,
"triggerProductId": null,
"triggerOfferId": null,
"lookbackPeriod": null,
"createdAt": "2026-09-05T14:00:00.000Z",
"updatedAt": "2026-09-11T11:30:00.000Z"
}
}{
"success": false,
"message": "Token inválido ou expirado"
}{
"success": false,
"message": "Recurso não encontrado"
}{
"success": false,
"message": "name: Nome é obrigatório"
}{
"success": false,
"message": "Muitas requisições. Tente novamente em breve."
}{
"success": false,
"message": "Erro interno do servidor"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identificador do cupom.
Required range:
x > 0Body
application/json
Estado desejado; omita para inverter o atual.
⌘I
