File Upload

Use to upload your local files to Kayzen CDN

Returns presigned_url and public_url.

  • Usepresigned_urlto upload your file via a PUT request with the file content as the request body and with Content-Type header equal tocontent-typeparameter you sent to this API.
  • Once you're done uploading, the file will be publicly available under public_url

For .csv files you must use content_type text/csv. CSVs can be used to white/blacklist IPs in Create Campaign API.

Below is an example bash script uploading an image:

#!/bin/bash
set -e # Stop on error

OAUTH_TOKEN=your_oauth_token_here

file_path="./128x128b.jpg"
content_type="image/jpeg"

if ! [ -x "$(command -v jq)" ]; then
  echo 'Error: "jq" is not installed.' >&2
  exit 1
fi

response=$(curl -s \
    -H 'Accept: application/json' \
    -H "Authorization: Bearer ${OAUTH_TOKEN}" \
    "https://api.kayzen.io/v1/file_uploads/new?content_type=${content_type}")

presigned_url=$(echo "$response" | jq -r '.presigned_url')
public_url=$(echo "$response" | jq -r '.public_url')

curl -H "Content-Type: $content_type" --upload-file "$file_path" "$presigned_url"

echo "Public URL of the uploaded file: $public_url"

Language
Credentials
OAuth2
Click Try It! to start a request and see the response here!