Skip to main content
POST
/
v1
/
businesses
/
{businessId}
/
assets
Create Asset
curl --request POST \
  --url https://api.example.com/v1/businesses/{businessId}/assets \
  --header 'Content-Type: application/json' \
  --data '
{
  "uri": "<string>",
  "id": "<string>",
  "metadata": {
    "metadata.accessControlType": "<string>"
  }
}
'
import requests

url = "https://api.example.com/v1/businesses/{businessId}/assets"

payload = {
"uri": "<string>",
"id": "<string>",
"metadata": { "metadata.accessControlType": "<string>" }
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
uri: '<string>',
id: '<string>',
metadata: {'metadata.accessControlType': '<string>'}
})
};

fetch('https://api.example.com/v1/businesses/{businessId}/assets', 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.example.com/v1/businesses/{businessId}/assets",
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([
'uri' => '<string>',
'id' => '<string>',
'metadata' => [
'metadata.accessControlType' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/businesses/{businessId}/assets"

payload := strings.NewReader("{\n \"uri\": \"<string>\",\n \"id\": \"<string>\",\n \"metadata\": {\n \"metadata.accessControlType\": \"<string>\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

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.example.com/v1/businesses/{businessId}/assets")
.header("Content-Type", "application/json")
.body("{\n \"uri\": \"<string>\",\n \"id\": \"<string>\",\n \"metadata\": {\n \"metadata.accessControlType\": \"<string>\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/businesses/{businessId}/assets")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"uri\": \"<string>\",\n \"id\": \"<string>\",\n \"metadata\": {\n \"metadata.accessControlType\": \"<string>\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "asset": {
    "asset.id": "<string>",
    "asset.ownerId": "<string>",
    "asset.uri": "<string>",
    "asset.source.uri": "<string>",
    "asset.metadata.accessControlType": "<string>"
  }
}
Upload a media file to Connectly’s CDN by providing a publicly accessible source URL. Connectly fetches the file from your URL and stores it, returning a stable CDN URL you can reference in templates, campaigns, and messages.

Endpoint

POST https://api.connectly.ai/v1/businesses/{businessId}/assets
Rate limit: 100 requests/second. Exceeding this returns 429 Too Many Requests.

Request body

uri
string
required
Publicly accessible source URL of the file to upload. Must be reachable from Connectly’s servers — private or authenticated URLs will fail with a 400 error.
id
string
Optional custom identifier for the asset. If omitted, Connectly generates a UUID automatically. Useful for associating assets with your own records (e.g. a product SKU or internal asset key).
metadata
object
Optional metadata to attach to the asset.

Response

asset
object

Examples

curl -X POST "https://api.connectly.ai/v1/businesses/{businessId}/assets" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "uri": "https://example.com/images/product-photo.png" }'
{
  "asset": {
    "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
    "ownerId": "550e8400-e29b-41d4-a716-446655440000",
    "uri": "https://cdn.connectly.ai/assets/6ba7b810-9dad-11d1-80b4-00c04fd430c8",
    "source": { "uri": "https://example.com/images/product-photo.png" },
    "metadata": { "accessControlType": "ASSET_ACCESS_CONTROL_TYPE_PUBLIC" }
  }
}
curl -X POST "https://api.connectly.ai/v1/businesses/{businessId}/assets" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "uri": "https://example.com/images/product-photo.png",
    "id": "product-sku-12345-main-image"
  }'
curl -X POST "https://api.connectly.ai/v1/businesses/{businessId}/assets" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "uri": "https://example.com/documents/invoice.pdf",
    "metadata": { "accessControlType": "ASSET_ACCESS_CONTROL_TYPE_CDN_PRIVATE" }
  }'

Error responses

StatusMeaning
400Missing or invalid uri, or source URL unreachable by Connectly’s servers.
401Missing or invalid X-API-Key.
429Rate limit exceeded (100 req/s).