Téléverser des fichiers
POST /v1/media téléverse une image, une vidéo ou un PDF dans la médiathèque. Trois façons : multipart avec un champ file, JSON avec une url publique, ou JSON avec le fichier en base64. La réponse contient l'ID du média à utiliser dans les newsletters, modèles, relances et la landing page. Les documents pour la réponse IA vont à POST /v1/knowledge/documents de la même façon.
Modifie des donnéesDroit:
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"
| Champ | Type | Obligatoire | Description |
|---|---|---|---|
url | string | non | Public https address. SmartChat downloads the file (max 100 MB). |
data_base64 | string | non | The file as base64 (alternative to url). |
filename | string | non | File name with extension. Required with data_base64. |
mime | string | non | File type, for example image/jpeg. |
usage | string | non | generic, landing, newsletter, template, logo, avatar, blog. |
{"media": {"id": "fac5ba3e-...", "kind": "image", "usage": "newsletter", "url": "https://..."}}
Knowledge documents
Modifie des donnéesDroit:
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"}'
Des questions ?
Écris-nous à support@smartchat.marketing