Upload a file
curl --request POST \
--url https://api.creem.io/v1/files \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"purpose": "product_file",
"filename": "ebook.epub",
"content_type": "application/epub+zip",
"size": 52000,
"sha256": "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg="
}
'import requests
url = "https://api.creem.io/v1/files"
payload = {
"purpose": "product_file",
"filename": "ebook.epub",
"content_type": "application/epub+zip",
"size": 52000,
"sha256": "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg="
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
purpose: 'product_file',
filename: 'ebook.epub',
content_type: 'application/epub+zip',
size: 52000,
sha256: 'n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg='
})
};
fetch('https://api.creem.io/v1/files', 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.creem.io/v1/files",
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([
'purpose' => 'product_file',
'filename' => 'ebook.epub',
'content_type' => 'application/epub+zip',
'size' => 52000,
'sha256' => 'n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg='
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-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://api.creem.io/v1/files"
payload := strings.NewReader("{\n \"purpose\": \"product_file\",\n \"filename\": \"ebook.epub\",\n \"content_type\": \"application/epub+zip\",\n \"size\": 52000,\n \"sha256\": \"n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://api.creem.io/v1/files")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"purpose\": \"product_file\",\n \"filename\": \"ebook.epub\",\n \"content_type\": \"application/epub+zip\",\n \"size\": 52000,\n \"sha256\": \"n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.creem.io/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"purpose\": \"product_file\",\n \"filename\": \"ebook.epub\",\n \"content_type\": \"application/epub+zip\",\n \"size\": 52000,\n \"sha256\": \"n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=\"\n}"
response = http.request(request)
puts response.read_body{
"id": "file_4dGTkmBdnTnU9vV3KZ2Hcz",
"upload_url": "https://creem-files.s3.eu-west-1.amazonaws.com/",
"upload_fields": {
"key": "store/sto_1/0b6f2c1e-ebook.epub",
"Content-Type": "application/epub+zip"
},
"expires_at": "2026-11-17T11:00:00.000Z"
}Files
Upload a file
Request an upload for a file of any type up to 5 GB, with its SHA-256. Post the file to upload_url with upload_fields before expires_at, then confirm it with POST /v1/files/{id}/confirm. Storage refuses bytes that do not match sha256, files are private, and buyers always download them as attachments.
POST
/
v1
/
files
Upload a file
curl --request POST \
--url https://api.creem.io/v1/files \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"purpose": "product_file",
"filename": "ebook.epub",
"content_type": "application/epub+zip",
"size": 52000,
"sha256": "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg="
}
'import requests
url = "https://api.creem.io/v1/files"
payload = {
"purpose": "product_file",
"filename": "ebook.epub",
"content_type": "application/epub+zip",
"size": 52000,
"sha256": "n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg="
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
purpose: 'product_file',
filename: 'ebook.epub',
content_type: 'application/epub+zip',
size: 52000,
sha256: 'n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg='
})
};
fetch('https://api.creem.io/v1/files', 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.creem.io/v1/files",
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([
'purpose' => 'product_file',
'filename' => 'ebook.epub',
'content_type' => 'application/epub+zip',
'size' => 52000,
'sha256' => 'n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg='
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-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://api.creem.io/v1/files"
payload := strings.NewReader("{\n \"purpose\": \"product_file\",\n \"filename\": \"ebook.epub\",\n \"content_type\": \"application/epub+zip\",\n \"size\": 52000,\n \"sha256\": \"n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://api.creem.io/v1/files")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"purpose\": \"product_file\",\n \"filename\": \"ebook.epub\",\n \"content_type\": \"application/epub+zip\",\n \"size\": 52000,\n \"sha256\": \"n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.creem.io/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"purpose\": \"product_file\",\n \"filename\": \"ebook.epub\",\n \"content_type\": \"application/epub+zip\",\n \"size\": 52000,\n \"sha256\": \"n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=\"\n}"
response = http.request(request)
puts response.read_body{
"id": "file_4dGTkmBdnTnU9vV3KZ2Hcz",
"upload_url": "https://creem-files.s3.eu-west-1.amazonaws.com/",
"upload_fields": {
"key": "store/sto_1/0b6f2c1e-ebook.epub",
"Content-Type": "application/epub+zip"
},
"expires_at": "2026-11-17T11:00:00.000Z"
}Authorizations
Body
application/json
Response
Where and until when to upload the file