Uploading files

POST /v1/media uploads an image, video or PDF to the media library. Three ways: multipart with a file field, JSON with a public url, or JSON with the file as base64. The answer contains the media id you can use in newsletters, templates, follow-ups and the landing page. Documents for the AI reply go to POST /v1/knowledge/documents in the same three ways.

Changes dataPermission: media:write

1. URL

curl -X POST https://api.smartchat.marketing/v1/media \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/photo.jpg", "usage": "newsletter"}'

2. Base64

curl -X POST https://api.smartchat.marketing/v1/media \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"data_base64": "iVBORw0KGgo...", "filename": "photo.png", "mime": "image/png"}'

3. Multipart

curl -X POST https://api.smartchat.marketing/v1/media \
  -H "Authorization: Bearer sk_live_..." \
  -F "file=@photo.jpg" -F "usage=landing"
FieldTypeRequiredDescription
urlstringnoPublic https address. SmartChat downloads the file (max 100 MB).
data_base64stringnoThe file as base64 (alternative to url).
filenamestringnoFile name with extension. Required with data_base64.
mimestringnoFile type, for example image/jpeg.
usagestringnogeneric, landing, newsletter, template, logo, avatar, blog.
{"media": {"id": "fac5ba3e-...", "kind": "image", "usage": "newsletter", "url": "https://..."}}

Knowledge documents

Changes dataPermission: knowledge:write
curl -X POST https://api.smartchat.marketing/v1/knowledge/documents \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/prices.pdf"}'

Questions?

Email us at support@smartchat.marketing