curl --request POST \
--url https://payments.coinbase.com/api/v1/campaigns \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"chainId": 123,
"ownerAddress": "<string>",
"rewardBps": 123,
"campaignType": "CAMPAIGN_TYPE_CASHBACK_REWARDS",
"maxRewardAmounts": [
{
"tokenAddress": "<string>",
"amount": "<string>"
}
],
"maxRewardBps": 123
}
'import requests
url = "https://payments.coinbase.com/api/v1/campaigns"
payload = {
"chainId": 123,
"ownerAddress": "<string>",
"rewardBps": 123,
"campaignType": "CAMPAIGN_TYPE_CASHBACK_REWARDS",
"maxRewardAmounts": [
{
"tokenAddress": "<string>",
"amount": "<string>"
}
],
"maxRewardBps": 123
}
headers = {
"x-idempotency-key": "<x-idempotency-key>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency-key': '<x-idempotency-key>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
chainId: 123,
ownerAddress: '<string>',
rewardBps: 123,
campaignType: 'CAMPAIGN_TYPE_CASHBACK_REWARDS',
maxRewardAmounts: [{tokenAddress: '<string>', amount: '<string>'}],
maxRewardBps: 123
})
};
fetch('https://payments.coinbase.com/api/v1/campaigns', 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://payments.coinbase.com/api/v1/campaigns",
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([
'chainId' => 123,
'ownerAddress' => '<string>',
'rewardBps' => 123,
'campaignType' => 'CAMPAIGN_TYPE_CASHBACK_REWARDS',
'maxRewardAmounts' => [
[
'tokenAddress' => '<string>',
'amount' => '<string>'
]
],
'maxRewardBps' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-idempotency-key: <x-idempotency-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://payments.coinbase.com/api/v1/campaigns"
payload := strings.NewReader("{\n \"chainId\": 123,\n \"ownerAddress\": \"<string>\",\n \"rewardBps\": 123,\n \"campaignType\": \"CAMPAIGN_TYPE_CASHBACK_REWARDS\",\n \"maxRewardAmounts\": [\n {\n \"tokenAddress\": \"<string>\",\n \"amount\": \"<string>\"\n }\n ],\n \"maxRewardBps\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency-key", "<x-idempotency-key>")
req.Header.Add("Authorization", "<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.post("https://payments.coinbase.com/api/v1/campaigns")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chainId\": 123,\n \"ownerAddress\": \"<string>\",\n \"rewardBps\": 123,\n \"campaignType\": \"CAMPAIGN_TYPE_CASHBACK_REWARDS\",\n \"maxRewardAmounts\": [\n {\n \"tokenAddress\": \"<string>\",\n \"amount\": \"<string>\"\n }\n ],\n \"maxRewardBps\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://payments.coinbase.com/api/v1/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency-key"] = '<x-idempotency-key>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chainId\": 123,\n \"ownerAddress\": \"<string>\",\n \"rewardBps\": 123,\n \"campaignType\": \"CAMPAIGN_TYPE_CASHBACK_REWARDS\",\n \"maxRewardAmounts\": [\n {\n \"tokenAddress\": \"<string>\",\n \"amount\": \"<string>\"\n }\n ],\n \"maxRewardBps\": 123\n}"
response = http.request(request)
puts response.read_body{
"campaignAddress": "<string>"
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Create campaign
Create a new campaign and deploy it onchain
curl --request POST \
--url https://payments.coinbase.com/api/v1/campaigns \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"chainId": 123,
"ownerAddress": "<string>",
"rewardBps": 123,
"campaignType": "CAMPAIGN_TYPE_CASHBACK_REWARDS",
"maxRewardAmounts": [
{
"tokenAddress": "<string>",
"amount": "<string>"
}
],
"maxRewardBps": 123
}
'import requests
url = "https://payments.coinbase.com/api/v1/campaigns"
payload = {
"chainId": 123,
"ownerAddress": "<string>",
"rewardBps": 123,
"campaignType": "CAMPAIGN_TYPE_CASHBACK_REWARDS",
"maxRewardAmounts": [
{
"tokenAddress": "<string>",
"amount": "<string>"
}
],
"maxRewardBps": 123
}
headers = {
"x-idempotency-key": "<x-idempotency-key>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency-key': '<x-idempotency-key>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
chainId: 123,
ownerAddress: '<string>',
rewardBps: 123,
campaignType: 'CAMPAIGN_TYPE_CASHBACK_REWARDS',
maxRewardAmounts: [{tokenAddress: '<string>', amount: '<string>'}],
maxRewardBps: 123
})
};
fetch('https://payments.coinbase.com/api/v1/campaigns', 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://payments.coinbase.com/api/v1/campaigns",
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([
'chainId' => 123,
'ownerAddress' => '<string>',
'rewardBps' => 123,
'campaignType' => 'CAMPAIGN_TYPE_CASHBACK_REWARDS',
'maxRewardAmounts' => [
[
'tokenAddress' => '<string>',
'amount' => '<string>'
]
],
'maxRewardBps' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-idempotency-key: <x-idempotency-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://payments.coinbase.com/api/v1/campaigns"
payload := strings.NewReader("{\n \"chainId\": 123,\n \"ownerAddress\": \"<string>\",\n \"rewardBps\": 123,\n \"campaignType\": \"CAMPAIGN_TYPE_CASHBACK_REWARDS\",\n \"maxRewardAmounts\": [\n {\n \"tokenAddress\": \"<string>\",\n \"amount\": \"<string>\"\n }\n ],\n \"maxRewardBps\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency-key", "<x-idempotency-key>")
req.Header.Add("Authorization", "<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.post("https://payments.coinbase.com/api/v1/campaigns")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chainId\": 123,\n \"ownerAddress\": \"<string>\",\n \"rewardBps\": 123,\n \"campaignType\": \"CAMPAIGN_TYPE_CASHBACK_REWARDS\",\n \"maxRewardAmounts\": [\n {\n \"tokenAddress\": \"<string>\",\n \"amount\": \"<string>\"\n }\n ],\n \"maxRewardBps\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://payments.coinbase.com/api/v1/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency-key"] = '<x-idempotency-key>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chainId\": 123,\n \"ownerAddress\": \"<string>\",\n \"rewardBps\": 123,\n \"campaignType\": \"CAMPAIGN_TYPE_CASHBACK_REWARDS\",\n \"maxRewardAmounts\": [\n {\n \"tokenAddress\": \"<string>\",\n \"amount\": \"<string>\"\n }\n ],\n \"maxRewardBps\": 123\n}"
response = http.request(request)
puts response.read_body{
"campaignAddress": "<string>"
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Authorizations
Authorization header using the Bearer scheme. Learn more about JWT tokens in the Coinbase Developer Portal.
Headers
Unique identifier to ensure request idempotency
Body
Blockchain network identifier
8453
Address that will own the campaign
"0x1234567890123456789012345678901234567890"
Reward percentage applied to the reward operations (1-10000, cannot be 0). Only applicable for CAMPAIGN_TYPE_CASHBACK_REWARDS.
500
Type of campaign. Defaults to CAMPAIGN_TYPE_CASHBACK_REWARDS if not provided.
CAMPAIGN_TYPE_CASHBACK_REWARDS "CAMPAIGN_TYPE_CASHBACK_REWARDS"
Optional list of maximum reward amounts for specific tokens. Only applicable for CAMPAIGN_TYPE_CASHBACK_REWARDS.
Show child attributes
Show child attributes
[
{
"tokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount": "100.00"
}
]
Optional immutable maximum reward percentage applied to the smart contract (0-10000). Defaults to 10000 (no cap) if not provided. Only applicable for CAMPAIGN_TYPE_CASHBACK_REWARDS.
1000
Response
A successful response.
The deployed campaign contract address
"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd"
Was this page helpful?