Subir Archivo
curl --request POST \
--url https://api.tess.im/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"process": true
}
'import requests
url = "https://api.tess.im/files"
payload = { "process": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({process: true})
};
fetch('https://api.tess.im/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tess.im/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'process' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tess.im/files"
payload := strings.NewReader("{\n \"process\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tess.im/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"process\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tess.im/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"process\": true\n}"
response = http.request(request)
puts response.read_bodyArchivos
Subir Archivo
Sube un nuevo archivo al sistema y opcionalmente lo procesa.
POST
/
files
Subir Archivo
curl --request POST \
--url https://api.tess.im/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"process": true
}
'import requests
url = "https://api.tess.im/files"
payload = { "process": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({process: true})
};
fetch('https://api.tess.im/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tess.im/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'process' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tess.im/files"
payload := strings.NewReader("{\n \"process\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tess.im/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"process\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tess.im/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"process\": true\n}"
response = http.request(request)
puts response.read_bodyMáximo de 32 MB por archivo en este endpoint. Esta llamada single-shot
POST /files envía el cuerpo del archivo a través del servidor de la API, que tiene un límite estricto de 32 MB en el tamaño del cuerpo de las solicitudes HTTP entrantes. Los archivos mayores a 32 MB son rechazados antes de llegar a la capa de la aplicación.Para archivos mayores a 32 MB, utilice el flujo de carga firmada v2. Sube el cuerpo del archivo directamente desde su cliente a Google Cloud Storage (el servidor de la API queda fuera de la ruta de los bytes) y admite archivos de hasta 200 MB.Archivos soportados
| Etiqueta | Patrones de Archivo |
|---|---|
| Texto | *.txt |
| Word | *.{doc,docx} |
| Hoja de cálculo | *.csv |
*.pdf | |
| Excel | *.xls,*.xlsx |
| Power Point | *.{ppt,pptx} |
| Imagen | *.{jpg,jpeg,png,gif,bmp,svg,tiff,webp} |
| Video | *.{mp4,avi,mov,mkv,wmv,flv} |
| Audio | *.{mp3,wav,aac,ogg,flac,m4a} |
| Código | *.bas, *.bat, *.xml, *.css, *.dart, *.{html,htm}, *.inc, *.js, *.json, *.kt, *.lua, *.pas, *.php, *.pl, *.ps1, *.py, *.r, *.sh, *.vsd, *.sql, *.swift, *.ts, *.vb, *.vba, *.{yml,yaml}, *.md |
Límites
- Tamaño máximo de archivo por carga en este endpoint: 32 MB (límite de tamaño de solicitud HTTP de la plataforma). Para archivos de hasta 200 MB, utilice el flujo de carga firmada v2.
- Este punto final acepta un archivo por solicitud (se pueden usar varias solicitudes para varios archivos).
- Límite de almacenamiento de archivos: 30 archivos
- Algunas funciones tienen límites diferentes:
- Adjuntos de chat: hasta 200 MB por archivo a través del flujo de carga firmada v2; hasta 5 archivos por envío
- Transcripción de audio: hasta 10 MB por archivo
Ejemplos de Código
curl --request POST \
--url 'https://api.tess.im/files' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: multipart/form-data' \
--form 'file=@/path/to/file' \
--form 'process=false'
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const form = new FormData();
form.append('file', fs.createReadStream('/path/to/file'));
form.append('process', 'false');
const config = {
method: 'post',
url: 'https://api.tess.im/files',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
...form.getHeaders()
},
data: form
};
try {
const response = await axios(config);
console.log(response.data);
} catch (error) {
console.error(error);
}
import requests
url = "https://api.tess.im/files"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
files = {
'file': open('/path/to/file', 'rb')
}
data = {
'process': 'false'
}
response = requests.post(url, headers=headers, files=files, data=data)
print(response.json())
<?php
$curl = curl_init();
$file = new CURLFile('/path/to/file');
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tess.im/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => [
'file' => $file,
'process' => 'false'
],
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: multipart/form-data"
]
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Error: " . $err;
} else {
echo $response;
}
import java.io.File;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Path;
String boundary = "---boundary" + System.currentTimeMillis();
File file = new File("/path/to/file");
HttpClient client = HttpClient.newBuilder().build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.tess.im/files"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "multipart/form-data;boundary=" + boundary)
.POST(HttpRequest.BodyPublishers.ofFile(file.toPath()))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"os"
)
func main() {
file, err := os.Open("/path/to/file")
if err != nil {
fmt.Println(err)
return
}
defer file.Close()
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
part, err := writer.CreateFormFile("file", "filename")
if err != nil {
fmt.Println(err)
return
}
io.Copy(part, file)
writer.WriteField("process", "false")
writer.Close()
client := &http.Client{}
req, err := http.NewRequest("POST", "https://api.tess.im/files", body)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer YOUR_API_KEY")
req.Header.Add("Content-Type", writer.FormDataContentType())
resp, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
respBody, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(respBody))
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
using (var formData = new MultipartFormDataContent())
{
var fileContent = new ByteArrayContent(File.ReadAllBytes("/path/to/file"));
formData.Add(fileContent, "file", "filename");
formData.Add(new StringContent("false"), "process");
try
{
var response = await client.PostAsync("https://api.tess.im/files", formData);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch(HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ",e.Message);
}
}
}
}
}
require 'uri'
require 'net/http'
require 'json'
uri = URI('https://api.tess.im/files')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer YOUR_API_KEY'
form_data = [
['file', File.open('/path/to/file')],
['process', 'false']
]
request.set_form form_data, 'multipart/form-data'
response = http.request(request)
puts response.read_body
Encabezados
ID del espacio de trabajo. Si no se proporciona, se utilizará el espacio de trabajo seleccionado del usuario.
Nota: Este campo será requerido en una futura versión de la API. Se recomienda encarecidamente configurarlo ahora para asegurar la compatibilidad con futuras actualizaciones.
Parámetros del Cuerpo
El playground no soporta uploads
multipart/form-data directamente. Use los Ejemplos de Código anteriores (cURL, Python, Node.js, etc.) para enviar el archivo. Los campos a continuación se muestran solo con fines de documentación.El archivo a subir (multipart/form-data)
Si debe procesar el archivo después de subirlo (predeterminado: false). El procesamiento consume créditos (true).
Respuesta
{
"id": 123,
"filename": "documento.pdf",
"size": 1024000,
"content_type": "application/pdf",
"status": "subido",
"created_at": "2025-01-05T22:39:57+00:00",
"updated_at": "2025-01-05T22:39:57+00:00"
}
⌘I