Subir archivos

POST /v1/media sube una imagen, un vídeo o un PDF a la biblioteca de medios. Tres formas: multipart con un campo file, JSON con una url pública, o JSON con el archivo en base64. La respuesta contiene el ID del medio para usarlo en newsletters, plantillas, seguimientos y la landing page. Los documentos para la respuesta de IA van a POST /v1/knowledge/documents de las mismas tres formas.

Cambia datosPermiso: 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"
CampoTipoObligatorioDescripción
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

Cambia datosPermiso: 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"}'

¿Preguntas?

Escríbenos a support@smartchat.marketing