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:write1. 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"
| Field | Type | Required | Description |
|---|---|---|---|
url | string | no | Public https address. SmartChat downloads the file (max 100 MB). |
data_base64 | string | no | The file as base64 (alternative to url). |
filename | string | no | File name with extension. Required with data_base64. |
mime | string | no | File type, for example image/jpeg. |
usage | string | no | generic, landing, newsletter, template, logo, avatar, blog. |
{"media": {"id": "fac5ba3e-...", "kind": "image", "usage": "newsletter", "url": "https://..."}}
Knowledge documents
Changes dataPermission:
knowledge:writecurl -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