Attach a downloadable file
curl --request POST \
--url https://api.cope.com/v1/commerce/products/{product_id}/attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"upload_token": "<string>"
}
'import requests
url = "https://api.cope.com/v1/commerce/products/{product_id}/attachments"
payload = { "upload_token": "<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({upload_token: '<string>'})
};
fetch('https://api.cope.com/v1/commerce/products/{product_id}/attachments', 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/{product_id}/attachments",
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([
'upload_token' => '<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/{product_id}/attachments"
payload := strings.NewReader("{\n \"upload_token\": \"<string>\"\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/{product_id}/attachments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"upload_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cope.com/v1/commerce/products/{product_id}/attachments")
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 \"upload_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"access_pending": true,
"access_trial": true,
"byte_size": 123,
"content_type": "<string>",
"filename": "<string>",
"id": "att_A1b2C3d4E5f6G7h8",
"kind": "<string>",
"url": "<string>"
}
}{
"data": {
"access_pending": true,
"access_trial": true,
"byte_size": 123,
"content_type": "<string>",
"filename": "<string>",
"id": "att_A1b2C3d4E5f6G7h8",
"kind": "<string>",
"url": "<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": "<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"
}Attach a downloadable file
POST
/
v1
/
commerce
/
products
/
{product_id}
/
attachments
Attach a downloadable file
curl --request POST \
--url https://api.cope.com/v1/commerce/products/{product_id}/attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"upload_token": "<string>"
}
'import requests
url = "https://api.cope.com/v1/commerce/products/{product_id}/attachments"
payload = { "upload_token": "<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({upload_token: '<string>'})
};
fetch('https://api.cope.com/v1/commerce/products/{product_id}/attachments', 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/{product_id}/attachments",
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([
'upload_token' => '<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/{product_id}/attachments"
payload := strings.NewReader("{\n \"upload_token\": \"<string>\"\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/{product_id}/attachments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"upload_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cope.com/v1/commerce/products/{product_id}/attachments")
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 \"upload_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"access_pending": true,
"access_trial": true,
"byte_size": 123,
"content_type": "<string>",
"filename": "<string>",
"id": "att_A1b2C3d4E5f6G7h8",
"kind": "<string>",
"url": "<string>"
}
}{
"data": {
"access_pending": true,
"access_trial": true,
"byte_size": 123,
"content_type": "<string>",
"filename": "<string>",
"id": "att_A1b2C3d4E5f6G7h8",
"kind": "<string>",
"url": "<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": "<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.
Path Parameters
product_id public identifier.
Pattern:
^prd_[A-Za-z0-9]{16}$Example:
"prd_A1b2C3d4E5f6G7h8"
Body
application/json
Response
Successful response
Show child attributes
Show child attributes
Was this page helpful?
⌘I