Create a product
curl --request POST \
--url https://api.cope.com/v1/commerce/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product": {
"description": "<string>",
"name": "<string>",
"payment_methods": [
"<string>"
],
"payment_plans_attributes": [
{
"display_name": "<string>",
"first_payment_amount_cents": 123,
"plan_type": "<string>",
"position": 123,
"interval": "<string>",
"interval_count": 123,
"next_payments_amount_cents": 123,
"next_payments_count": 123
}
],
"product_type": "<string>",
"tax_code": "<string>",
"tax_group": "<string>"
}
}
'import requests
url = "https://api.cope.com/v1/commerce/products"
payload = { "product": {
"description": "<string>",
"name": "<string>",
"payment_methods": ["<string>"],
"payment_plans_attributes": [
{
"display_name": "<string>",
"first_payment_amount_cents": 123,
"plan_type": "<string>",
"position": 123,
"interval": "<string>",
"interval_count": 123,
"next_payments_amount_cents": 123,
"next_payments_count": 123
}
],
"product_type": "<string>",
"tax_code": "<string>",
"tax_group": "<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({
product: {
description: '<string>',
name: '<string>',
payment_methods: ['<string>'],
payment_plans_attributes: [
{
display_name: '<string>',
first_payment_amount_cents: 123,
plan_type: '<string>',
position: 123,
interval: '<string>',
interval_count: 123,
next_payments_amount_cents: 123,
next_payments_count: 123
}
],
product_type: '<string>',
tax_code: '<string>',
tax_group: '<string>'
}
})
};
fetch('https://api.cope.com/v1/commerce/products', 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.cope.com/v1/commerce/products",
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([
'product' => [
'description' => '<string>',
'name' => '<string>',
'payment_methods' => [
'<string>'
],
'payment_plans_attributes' => [
[
'display_name' => '<string>',
'first_payment_amount_cents' => 123,
'plan_type' => '<string>',
'position' => 123,
'interval' => '<string>',
'interval_count' => 123,
'next_payments_amount_cents' => 123,
'next_payments_count' => 123
]
],
'product_type' => '<string>',
'tax_code' => '<string>',
'tax_group' => '<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.cope.com/v1/commerce/products"
payload := strings.NewReader("{\n \"product\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"payment_methods\": [\n \"<string>\"\n ],\n \"payment_plans_attributes\": [\n {\n \"display_name\": \"<string>\",\n \"first_payment_amount_cents\": 123,\n \"plan_type\": \"<string>\",\n \"position\": 123,\n \"interval\": \"<string>\",\n \"interval_count\": 123,\n \"next_payments_amount_cents\": 123,\n \"next_payments_count\": 123\n }\n ],\n \"product_type\": \"<string>\",\n \"tax_code\": \"<string>\",\n \"tax_group\": \"<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.cope.com/v1/commerce/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"payment_methods\": [\n \"<string>\"\n ],\n \"payment_plans_attributes\": [\n {\n \"display_name\": \"<string>\",\n \"first_payment_amount_cents\": 123,\n \"plan_type\": \"<string>\",\n \"position\": 123,\n \"interval\": \"<string>\",\n \"interval_count\": 123,\n \"next_payments_amount_cents\": 123,\n \"next_payments_count\": 123\n }\n ],\n \"product_type\": \"<string>\",\n \"tax_code\": \"<string>\",\n \"tax_group\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cope.com/v1/commerce/products")
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 \"product\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"payment_methods\": [\n \"<string>\"\n ],\n \"payment_plans_attributes\": [\n {\n \"display_name\": \"<string>\",\n \"first_payment_amount_cents\": 123,\n \"plan_type\": \"<string>\",\n \"position\": 123,\n \"interval\": \"<string>\",\n \"interval_count\": 123,\n \"next_payments_amount_cents\": 123,\n \"next_payments_count\": 123\n }\n ],\n \"product_type\": \"<string>\",\n \"tax_code\": \"<string>\",\n \"tax_group\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"attachments": [
{
"access_pending": true,
"access_trial": true,
"byte_size": 123,
"content_type": "<string>",
"filename": "<string>",
"id": "att_A1b2C3d4E5f6G7h8",
"kind": "<string>",
"url": "<string>"
}
],
"created_at": "<string>",
"description": "<string>",
"headline": "<string>",
"id": "prd_A1b2C3d4E5f6G7h8",
"images": [
{
"byte_size": 123,
"content_type": "<string>",
"filename": "<string>",
"id": "img_A1b2C3d4E5f6G7h8",
"kind": "<string>",
"thumbnail_url": "<string>",
"url": "<string>"
}
],
"name": "<string>",
"payment_plans": [
{
"currency": "<string>",
"display_name": "<string>",
"first_payment_amount_cents": 123,
"interval": "<string>",
"interval_count": 123,
"next_payments_amount_cents": 123,
"next_payments_count": 123,
"plan_type": "<string>",
"position": 123,
"shipping_price_cents": 123
}
],
"product_type": "<string>",
"product_url": "<string>",
"quantity": 123,
"quantity_selection_enabled": true,
"requires_shipping": true,
"stock_level": {
"available_stock": 123,
"visibility": "<string>"
},
"stock_level_settings_enabled": true,
"tags": [
"<string>"
],
"trial_period_days": 123,
"updated_at": "<string>"
}
}{
"code": "invalid_request",
"detail": null,
"errors": [
{
"code": "missing",
"detail": "param is missing or the value is empty: product_id",
"param": "product_id"
}
],
"request_id": "req_123",
"status": 400,
"title": "Invalid Request",
"type": "https://docs.cope.com/errors/invalid_request"
}{
"code": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"errors": [
{
"code": "<string>",
"detail": "<string>",
"param": "<string>"
}
]
}{
"code": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"errors": [
{
"code": "<string>",
"detail": "<string>",
"param": "<string>"
}
]
}{
"code": "validation_failed",
"detail": null,
"errors": [
{
"code": "blank",
"detail": "Name can't be blank",
"param": "name"
}
],
"request_id": "req_123",
"status": 422,
"title": "Validation Failed",
"type": "https://docs.cope.com/errors/validation_failed"
}Create a product
POST
/
v1
/
commerce
/
products
Create a product
curl --request POST \
--url https://api.cope.com/v1/commerce/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product": {
"description": "<string>",
"name": "<string>",
"payment_methods": [
"<string>"
],
"payment_plans_attributes": [
{
"display_name": "<string>",
"first_payment_amount_cents": 123,
"plan_type": "<string>",
"position": 123,
"interval": "<string>",
"interval_count": 123,
"next_payments_amount_cents": 123,
"next_payments_count": 123
}
],
"product_type": "<string>",
"tax_code": "<string>",
"tax_group": "<string>"
}
}
'import requests
url = "https://api.cope.com/v1/commerce/products"
payload = { "product": {
"description": "<string>",
"name": "<string>",
"payment_methods": ["<string>"],
"payment_plans_attributes": [
{
"display_name": "<string>",
"first_payment_amount_cents": 123,
"plan_type": "<string>",
"position": 123,
"interval": "<string>",
"interval_count": 123,
"next_payments_amount_cents": 123,
"next_payments_count": 123
}
],
"product_type": "<string>",
"tax_code": "<string>",
"tax_group": "<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({
product: {
description: '<string>',
name: '<string>',
payment_methods: ['<string>'],
payment_plans_attributes: [
{
display_name: '<string>',
first_payment_amount_cents: 123,
plan_type: '<string>',
position: 123,
interval: '<string>',
interval_count: 123,
next_payments_amount_cents: 123,
next_payments_count: 123
}
],
product_type: '<string>',
tax_code: '<string>',
tax_group: '<string>'
}
})
};
fetch('https://api.cope.com/v1/commerce/products', 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.cope.com/v1/commerce/products",
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([
'product' => [
'description' => '<string>',
'name' => '<string>',
'payment_methods' => [
'<string>'
],
'payment_plans_attributes' => [
[
'display_name' => '<string>',
'first_payment_amount_cents' => 123,
'plan_type' => '<string>',
'position' => 123,
'interval' => '<string>',
'interval_count' => 123,
'next_payments_amount_cents' => 123,
'next_payments_count' => 123
]
],
'product_type' => '<string>',
'tax_code' => '<string>',
'tax_group' => '<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.cope.com/v1/commerce/products"
payload := strings.NewReader("{\n \"product\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"payment_methods\": [\n \"<string>\"\n ],\n \"payment_plans_attributes\": [\n {\n \"display_name\": \"<string>\",\n \"first_payment_amount_cents\": 123,\n \"plan_type\": \"<string>\",\n \"position\": 123,\n \"interval\": \"<string>\",\n \"interval_count\": 123,\n \"next_payments_amount_cents\": 123,\n \"next_payments_count\": 123\n }\n ],\n \"product_type\": \"<string>\",\n \"tax_code\": \"<string>\",\n \"tax_group\": \"<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.cope.com/v1/commerce/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"payment_methods\": [\n \"<string>\"\n ],\n \"payment_plans_attributes\": [\n {\n \"display_name\": \"<string>\",\n \"first_payment_amount_cents\": 123,\n \"plan_type\": \"<string>\",\n \"position\": 123,\n \"interval\": \"<string>\",\n \"interval_count\": 123,\n \"next_payments_amount_cents\": 123,\n \"next_payments_count\": 123\n }\n ],\n \"product_type\": \"<string>\",\n \"tax_code\": \"<string>\",\n \"tax_group\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cope.com/v1/commerce/products")
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 \"product\": {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"payment_methods\": [\n \"<string>\"\n ],\n \"payment_plans_attributes\": [\n {\n \"display_name\": \"<string>\",\n \"first_payment_amount_cents\": 123,\n \"plan_type\": \"<string>\",\n \"position\": 123,\n \"interval\": \"<string>\",\n \"interval_count\": 123,\n \"next_payments_amount_cents\": 123,\n \"next_payments_count\": 123\n }\n ],\n \"product_type\": \"<string>\",\n \"tax_code\": \"<string>\",\n \"tax_group\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"attachments": [
{
"access_pending": true,
"access_trial": true,
"byte_size": 123,
"content_type": "<string>",
"filename": "<string>",
"id": "att_A1b2C3d4E5f6G7h8",
"kind": "<string>",
"url": "<string>"
}
],
"created_at": "<string>",
"description": "<string>",
"headline": "<string>",
"id": "prd_A1b2C3d4E5f6G7h8",
"images": [
{
"byte_size": 123,
"content_type": "<string>",
"filename": "<string>",
"id": "img_A1b2C3d4E5f6G7h8",
"kind": "<string>",
"thumbnail_url": "<string>",
"url": "<string>"
}
],
"name": "<string>",
"payment_plans": [
{
"currency": "<string>",
"display_name": "<string>",
"first_payment_amount_cents": 123,
"interval": "<string>",
"interval_count": 123,
"next_payments_amount_cents": 123,
"next_payments_count": 123,
"plan_type": "<string>",
"position": 123,
"shipping_price_cents": 123
}
],
"product_type": "<string>",
"product_url": "<string>",
"quantity": 123,
"quantity_selection_enabled": true,
"requires_shipping": true,
"stock_level": {
"available_stock": 123,
"visibility": "<string>"
},
"stock_level_settings_enabled": true,
"tags": [
"<string>"
],
"trial_period_days": 123,
"updated_at": "<string>"
}
}{
"code": "invalid_request",
"detail": null,
"errors": [
{
"code": "missing",
"detail": "param is missing or the value is empty: product_id",
"param": "product_id"
}
],
"request_id": "req_123",
"status": 400,
"title": "Invalid Request",
"type": "https://docs.cope.com/errors/invalid_request"
}{
"code": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"errors": [
{
"code": "<string>",
"detail": "<string>",
"param": "<string>"
}
]
}{
"code": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"errors": [
{
"code": "<string>",
"detail": "<string>",
"param": "<string>"
}
]
}{
"code": "validation_failed",
"detail": null,
"errors": [
{
"code": "blank",
"detail": "Name can't be blank",
"param": "name"
}
],
"request_id": "req_123",
"status": 422,
"title": "Validation Failed",
"type": "https://docs.cope.com/errors/validation_failed"
}Authorizations
Bearer credential for the public API. Vendor integrations should send a live COPE API key (cope_sk_live_*). Clerk bearer tokens are also accepted when paired with X-Cope-Business-Id.
Body
application/json
Show child attributes
Show child attributes
Response
Successful response
Show child attributes
Show child attributes
Was this page helpful?
⌘I