Caricare file
POST /v1/media carica un'immagine, un video o un PDF nella libreria media. Tre modi: multipart con un campo file, JSON con un url pubblico, oppure JSON con il file in base64. La risposta contiene l'ID del media da usare in newsletter, modelli, follow-up e landing page. I documenti per la risposta AI vanno a POST /v1/knowledge/documents negli stessi tre modi.
Modifica datiPermesso:
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"
| Campo | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
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
Modifica datiPermesso:
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"}'
Domande?
Scrivici a support@smartchat.marketing