Start a file upload for a custom field
curl --request POST \
--url https://app.supercycle.com/api/v1/custom_field_uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"definition_id": 123,
"blob": {
"filename": "condition-front.jpg",
"byte_size": 123,
"checksum": "<string>",
"content_type": "image/jpeg"
}
}
'import requests
url = "https://app.supercycle.com/api/v1/custom_field_uploads"
payload = {
"definition_id": 123,
"blob": {
"filename": "condition-front.jpg",
"byte_size": 123,
"checksum": "<string>",
"content_type": "image/jpeg"
}
}
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({
definition_id: 123,
blob: {
filename: 'condition-front.jpg',
byte_size: 123,
checksum: '<string>',
content_type: 'image/jpeg'
}
})
};
fetch('https://app.supercycle.com/api/v1/custom_field_uploads', 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://app.supercycle.com/api/v1/custom_field_uploads",
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([
'definition_id' => 123,
'blob' => [
'filename' => 'condition-front.jpg',
'byte_size' => 123,
'checksum' => '<string>',
'content_type' => 'image/jpeg'
]
]),
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://app.supercycle.com/api/v1/custom_field_uploads"
payload := strings.NewReader("{\n \"definition_id\": 123,\n \"blob\": {\n \"filename\": \"condition-front.jpg\",\n \"byte_size\": 123,\n \"checksum\": \"<string>\",\n \"content_type\": \"image/jpeg\"\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://app.supercycle.com/api/v1/custom_field_uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"definition_id\": 123,\n \"blob\": {\n \"filename\": \"condition-front.jpg\",\n \"byte_size\": 123,\n \"checksum\": \"<string>\",\n \"content_type\": \"image/jpeg\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.supercycle.com/api/v1/custom_field_uploads")
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 \"definition_id\": 123,\n \"blob\": {\n \"filename\": \"condition-front.jpg\",\n \"byte_size\": 123,\n \"checksum\": \"<string>\",\n \"content_type\": \"image/jpeg\"\n }\n}"
response = http.request(request)
puts response.read_body{
"signedId": "<string>",
"filename": "<string>",
"contentType": "<string>",
"byteSize": 123,
"checksum": "<string>",
"directUpload": {
"url": "<string>",
"headers": {}
}
}{
"errors": [
"Custom field uploads are not enabled for this shop"
]
}{
"errors": [
"Invalid request body"
]
}{
"error": "Rate limit exceeded. Retry after 42 seconds."
}CustomFields
Start a file upload for a custom field
Reserve a direct upload for one file on a file-type custom field (such as an image). PUT the file’s bytes to directUpload.url with directUpload.headers, then create or update the custom field with the returned signedId as its value. The file is checked against the definition’s allowed types and maximum size before the upload is allowed.
Beta: file custom fields are part of the improved custom fields, which are enabled per shop. For a shop without them this endpoint responds 403.
POST
/
custom_field_uploads
Start a file upload for a custom field
curl --request POST \
--url https://app.supercycle.com/api/v1/custom_field_uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"definition_id": 123,
"blob": {
"filename": "condition-front.jpg",
"byte_size": 123,
"checksum": "<string>",
"content_type": "image/jpeg"
}
}
'import requests
url = "https://app.supercycle.com/api/v1/custom_field_uploads"
payload = {
"definition_id": 123,
"blob": {
"filename": "condition-front.jpg",
"byte_size": 123,
"checksum": "<string>",
"content_type": "image/jpeg"
}
}
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({
definition_id: 123,
blob: {
filename: 'condition-front.jpg',
byte_size: 123,
checksum: '<string>',
content_type: 'image/jpeg'
}
})
};
fetch('https://app.supercycle.com/api/v1/custom_field_uploads', 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://app.supercycle.com/api/v1/custom_field_uploads",
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([
'definition_id' => 123,
'blob' => [
'filename' => 'condition-front.jpg',
'byte_size' => 123,
'checksum' => '<string>',
'content_type' => 'image/jpeg'
]
]),
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://app.supercycle.com/api/v1/custom_field_uploads"
payload := strings.NewReader("{\n \"definition_id\": 123,\n \"blob\": {\n \"filename\": \"condition-front.jpg\",\n \"byte_size\": 123,\n \"checksum\": \"<string>\",\n \"content_type\": \"image/jpeg\"\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://app.supercycle.com/api/v1/custom_field_uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"definition_id\": 123,\n \"blob\": {\n \"filename\": \"condition-front.jpg\",\n \"byte_size\": 123,\n \"checksum\": \"<string>\",\n \"content_type\": \"image/jpeg\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.supercycle.com/api/v1/custom_field_uploads")
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 \"definition_id\": 123,\n \"blob\": {\n \"filename\": \"condition-front.jpg\",\n \"byte_size\": 123,\n \"checksum\": \"<string>\",\n \"content_type\": \"image/jpeg\"\n }\n}"
response = http.request(request)
puts response.read_body{
"signedId": "<string>",
"filename": "<string>",
"contentType": "<string>",
"byteSize": 123,
"checksum": "<string>",
"directUpload": {
"url": "<string>",
"headers": {}
}
}{
"errors": [
"Custom field uploads are not enabled for this shop"
]
}{
"errors": [
"Invalid request body"
]
}{
"error": "Rate limit exceeded. Retry after 42 seconds."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Was this page helpful?