Crear credenciales en lote
curl --request POST \
--url https://api.tupana.ai/v1/credentials/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"credentials": [
{
"master_entity_rut": "76.123.456-0",
"credential_type": "sii_company",
"user_rut": "12.345.678-5",
"password": "mi_password_segura"
},
{
"master_entity_rut": "77.698.843-K",
"credential_type": "SII",
"user_rut": "11.111.111-1",
"password": "otra_password"
}
]
}
'import requests
url = "https://api.tupana.ai/v1/credentials/batch"
payload = { "credentials": [
{
"master_entity_rut": "76.123.456-0",
"credential_type": "sii_company",
"user_rut": "12.345.678-5",
"password": "mi_password_segura"
},
{
"master_entity_rut": "77.698.843-K",
"credential_type": "SII",
"user_rut": "11.111.111-1",
"password": "otra_password"
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credentials: [
{
master_entity_rut: '76.123.456-0',
credential_type: 'sii_company',
user_rut: '12.345.678-5',
password: 'mi_password_segura'
},
{
master_entity_rut: '77.698.843-K',
credential_type: 'SII',
user_rut: '11.111.111-1',
password: 'otra_password'
}
]
})
};
fetch('https://api.tupana.ai/v1/credentials/batch', 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.tupana.ai/v1/credentials/batch",
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([
'credentials' => [
[
'master_entity_rut' => '76.123.456-0',
'credential_type' => 'sii_company',
'user_rut' => '12.345.678-5',
'password' => 'mi_password_segura'
],
[
'master_entity_rut' => '77.698.843-K',
'credential_type' => 'SII',
'user_rut' => '11.111.111-1',
'password' => 'otra_password'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.tupana.ai/v1/credentials/batch"
payload := strings.NewReader("{\n \"credentials\": [\n {\n \"master_entity_rut\": \"76.123.456-0\",\n \"credential_type\": \"sii_company\",\n \"user_rut\": \"12.345.678-5\",\n \"password\": \"mi_password_segura\"\n },\n {\n \"master_entity_rut\": \"77.698.843-K\",\n \"credential_type\": \"SII\",\n \"user_rut\": \"11.111.111-1\",\n \"password\": \"otra_password\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.tupana.ai/v1/credentials/batch")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"credentials\": [\n {\n \"master_entity_rut\": \"76.123.456-0\",\n \"credential_type\": \"sii_company\",\n \"user_rut\": \"12.345.678-5\",\n \"password\": \"mi_password_segura\"\n },\n {\n \"master_entity_rut\": \"77.698.843-K\",\n \"credential_type\": \"SII\",\n \"user_rut\": \"11.111.111-1\",\n \"password\": \"otra_password\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tupana.ai/v1/credentials/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credentials\": [\n {\n \"master_entity_rut\": \"76.123.456-0\",\n \"credential_type\": \"sii_company\",\n \"user_rut\": \"12.345.678-5\",\n \"password\": \"mi_password_segura\"\n },\n {\n \"master_entity_rut\": \"77.698.843-K\",\n \"credential_type\": \"SII\",\n \"user_rut\": \"11.111.111-1\",\n \"password\": \"otra_password\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"batch_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "processing",
"items": [
{
"item_id": "6b1f3c2e-9a4d-4e7a-8e2a-1a2b3c4d5e6f",
"index": 0
},
{
"item_id": "8c2d4b1a-3f5e-4a6b-9c7d-2e3f4a5b6c7d",
"index": 1
}
]
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"credentials": [
{},
{
"master_entity_rut": [
"RUT de la entidad inválido."
]
}
]
}Credenciales
Crear Credenciales en Lote
Crea hasta 200 credenciales SII en una sola llamada. La respuesta confirma de inmediato que el formato de la solicitud es válido y devuelve un batch_id; la validación real contra el SII ocurre de forma asíncrona y el resultado final de cada credencial se notifica por webhook (credential.validated / credential.invalid).
POST
/
credentials
/
batch
Crear credenciales en lote
curl --request POST \
--url https://api.tupana.ai/v1/credentials/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"credentials": [
{
"master_entity_rut": "76.123.456-0",
"credential_type": "sii_company",
"user_rut": "12.345.678-5",
"password": "mi_password_segura"
},
{
"master_entity_rut": "77.698.843-K",
"credential_type": "SII",
"user_rut": "11.111.111-1",
"password": "otra_password"
}
]
}
'import requests
url = "https://api.tupana.ai/v1/credentials/batch"
payload = { "credentials": [
{
"master_entity_rut": "76.123.456-0",
"credential_type": "sii_company",
"user_rut": "12.345.678-5",
"password": "mi_password_segura"
},
{
"master_entity_rut": "77.698.843-K",
"credential_type": "SII",
"user_rut": "11.111.111-1",
"password": "otra_password"
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credentials: [
{
master_entity_rut: '76.123.456-0',
credential_type: 'sii_company',
user_rut: '12.345.678-5',
password: 'mi_password_segura'
},
{
master_entity_rut: '77.698.843-K',
credential_type: 'SII',
user_rut: '11.111.111-1',
password: 'otra_password'
}
]
})
};
fetch('https://api.tupana.ai/v1/credentials/batch', 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.tupana.ai/v1/credentials/batch",
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([
'credentials' => [
[
'master_entity_rut' => '76.123.456-0',
'credential_type' => 'sii_company',
'user_rut' => '12.345.678-5',
'password' => 'mi_password_segura'
],
[
'master_entity_rut' => '77.698.843-K',
'credential_type' => 'SII',
'user_rut' => '11.111.111-1',
'password' => 'otra_password'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.tupana.ai/v1/credentials/batch"
payload := strings.NewReader("{\n \"credentials\": [\n {\n \"master_entity_rut\": \"76.123.456-0\",\n \"credential_type\": \"sii_company\",\n \"user_rut\": \"12.345.678-5\",\n \"password\": \"mi_password_segura\"\n },\n {\n \"master_entity_rut\": \"77.698.843-K\",\n \"credential_type\": \"SII\",\n \"user_rut\": \"11.111.111-1\",\n \"password\": \"otra_password\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.tupana.ai/v1/credentials/batch")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"credentials\": [\n {\n \"master_entity_rut\": \"76.123.456-0\",\n \"credential_type\": \"sii_company\",\n \"user_rut\": \"12.345.678-5\",\n \"password\": \"mi_password_segura\"\n },\n {\n \"master_entity_rut\": \"77.698.843-K\",\n \"credential_type\": \"SII\",\n \"user_rut\": \"11.111.111-1\",\n \"password\": \"otra_password\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tupana.ai/v1/credentials/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credentials\": [\n {\n \"master_entity_rut\": \"76.123.456-0\",\n \"credential_type\": \"sii_company\",\n \"user_rut\": \"12.345.678-5\",\n \"password\": \"mi_password_segura\"\n },\n {\n \"master_entity_rut\": \"77.698.843-K\",\n \"credential_type\": \"SII\",\n \"user_rut\": \"11.111.111-1\",\n \"password\": \"otra_password\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"batch_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "processing",
"items": [
{
"item_id": "6b1f3c2e-9a4d-4e7a-8e2a-1a2b3c4d5e6f",
"index": 0
},
{
"item_id": "8c2d4b1a-3f5e-4a6b-9c7d-2e3f4a5b6c7d",
"index": 1
}
]
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"error": "VALIDATION_ERROR",
"message": "<string>"
}{
"credentials": [
{},
{
"master_entity_rut": [
"RUT de la entidad inválido."
]
}
]
}Estás viendo la API v1 (legacy). Para integraciones nuevas usa la versión v2 de esta página.
Que hace
- Crea hasta 200 credenciales SII en una sola llamada
- Valida el formato de cada credencial de inmediato (RUTs, tipo de credencial soportado, contraseña no vacia) y responde con el
batch_idapenas el formato es correcto - Valida cada credencial contra el SII de forma asincrona, sin bloquear la respuesta
- Notifica el resultado final de cada credencial por webhook (
credential.validatedocredential.invalid) - Crea automaticamente la entidad maestra (
master_entity_rut) si aun no existe en Tupana
Ejemplos de uso
- Migrar o dar de alta el portafolio completo de un contador/gestora de una sola vez
- Reintentar credenciales que quedaron invalidas para varios clientes
- Integrar un onboarding masivo de empresas sin esperar la validacion SII en el mismo request
Tipos de credenciales soportados
Este endpoint solo admite credenciales SII (no certificados digitales ni credenciales de otros proveedores, que se crean con POST /credentials):Tipo (credential_type) | Descripcion |
|---|---|
SII | Servicio de Impuestos Internos (clave tributaria personal) |
sii_company | SII a nivel de empresa (clave de empresa) |
Flujo del batch
- Respuesta inmediata (
201): confirma que el formato de cada credencial es valido y devuelvebatch_id+ unitem_idpor credencial, en el mismo orden enviado. - Procesamiento asincrono: cada credencial se valida contra el SII por separado. Una credencial con error no afecta a las demas del mismo lote.
- Notificacion por webhook: cuando una credencial termina de procesarse, se dispara:
credential.validatedsi el login al SII fue exitosocredential.invalidsi la clave es incorrecta o la cuenta esta bloqueada
Idempotency-Key
Enviaidempotency_key en el body para evitar crear un batch duplicado si reintentas la misma solicitud (por ejemplo, tras un timeout de red). Si ya existe un batch con esa clave, se devuelve el batch existente en vez de crear uno nuevo.
Errores de formato (422)
Si alguna credencial del lote no pasa la validacion de formato, la respuesta es 422 y no se crea ningun batch. Los errores se devuelven por indice, en el mismo orden del array credentials enviado.Authorizations
Body
application/json
Lote de credenciales a crear/validar
Response
Solicitud aceptada. El formato de cada credencial es válido; el resultado de cada una se notificará por webhook.
