Subir un adjunto
curl --request POST \
--url https://api.revem.ai/webchat/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file'const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.revem.ai/webchat/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.revem.ai/webchat/media"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text){
"mediaId": "d4c3b2a1-6f5e-4d7c-8b9a-0f1e2d3c4b5a"
}{
"ok": false,
"error": "unsupported_media_type",
"message": "El formato image/gif no está permitido."
}{
"error": "Unauthorized",
"message": "Invalid API key"
}{
"ok": false,
"error": "<string>",
"message": "<string>"
}{
"ok": false,
"error": "Too many requests. Retry in 1 minute."
}Webchat
Subir un adjunto
Sube un archivo para adjuntarlo después a un mensaje con POST /webchat/messages. El cuerpo es multipart/form-data con un único archivo; el formato se valida por el Content-Type de la parte, no por la extensión del nombre.
| Formato | Límite |
|---|---|
image/png, image/jpeg | 5 MB |
video/mp4, video/3gpp | 16 MB |
application/pdf, Word (.doc, .docx), Excel (.xls, .xlsx), text/plain | 25 MB |
POST
/
webchat
/
media
Subir un adjunto
curl --request POST \
--url https://api.revem.ai/webchat/media \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file'const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.revem.ai/webchat/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.revem.ai/webchat/media"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text){
"mediaId": "d4c3b2a1-6f5e-4d7c-8b9a-0f1e2d3c4b5a"
}{
"ok": false,
"error": "unsupported_media_type",
"message": "El formato image/gif no está permitido."
}{
"error": "Unauthorized",
"message": "Invalid API key"
}{
"ok": false,
"error": "<string>",
"message": "<string>"
}{
"ok": false,
"error": "Too many requests. Retry in 1 minute."
}Authorizations
La API key de tu organización, con la forma rvm_<prefijo>.<secreto>, enviada como Authorization: Bearer rvm_…. Revem la emite y sólo se muestra una vez; si la pierdes se reemplaza, no se recupera.
Body
multipart/form-data
El archivo. Se lee la primera parte de tipo archivo, cualquiera sea el nombre del campo.
Response
Archivo guardado.
Identificador del archivo. Úsalo en attachments[].mediaId de POST /webchat/messages.
