Crear Tratamiento
Crear Tratamiento
POST /cl/consent_manager/create_processing
Crea un tratamiento (DataProcessing). Un solo endpoint para REDEC y LPDP: el marco legal (legal_framework) y la base legal (legal_basis) se infieren de la Activity publicada resuelta por activity_code. Según la base legal, el motor registra:
-
CONSENT →
CONSENT_GRANTED(admitemedium,evidence,expires_aty, sólo en Activities REDEC, el bloqueredec). -
CONTRACT | LEGITIMATE_INTEREST | LEGAL_OBLIGATION →
PROCESSING_DECLARED(rechazaexpires_atyredec). -
URL de producción:
https://api.floid.app/cl/consent_manager/create_processing -
URL de sandbox:
https://sandbox.floid.app/cl/consent_manager/create_processing
Headers requeridos
Authorization: Bearer {{TOKEN}}
Content-Type: application/json
El
client_idse deriva del Bearer token. La versión de Activity, el marco y la base legal se infieren; no los envíes.
Parámetros del body
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
activity_code | string | Sí | Código de la Activity publicada. Determina marco y base legal. |
occurred_at | string (ISO 8601) | Sí | Momento real del hecho. Debe estar dentro de la vigencia de la versión resuelta (tolerancia futura de 5 min). |
subject_external_id | string | Sí | Identificador del titular en tu sistema (se indexa como blind index). |
subject_snapshot | object | Sí | Snapshot del titular. Sólo subject_identification es obligatorio (ver tabla). |
operational_code | string | Sí | Código operacional del responsable. |
medium | string | Sí | Medio de captura: ELECTRONIC, VERBAL, PHYSICAL. |
evidence | array | Condicional | Piezas de evidencia. No siempre es obligatoria: depende de la base legal y de la política de evidencia de la Activity (ver nota). |
expires_at | string (ISO 8601) | No | Sólo CONSENT. Acorta la vigencia máxima (nunca la extiende); posterior a occurred_at. |
redec | object | Condicional | Sólo CONSENT + marco REDEC. Ver tabla redec. |
business_reference | string | No | Referencia de negocio libre (trazabilidad). |
metadata | object | No | Metadatos libres. |
duplicate_protection_key | string | No | Clave de idempotencia por tenant. Un reintento idéntico devuelve replayed: true. |
subject_snapshot
subject_snapshot| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
subject_type | string | Sí | NATURAL o JURIDICAL. |
subject_identification | object | Sí | { type, value }. En REDEC debe ser CL_RUT válido. |
name / email / phone | string | No | Datos de contacto (opcionales). |
company / attorneys | object/array | No | Sólo para titulares jurídicos. |
redec
redec| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
consent_id | string | Sí | Identificador del consentimiento en la institución. Único por compañía + REDEC. |
purpose | number | Sí | Finalidad: 1 o 2. |
objective | string | Sí | Objetivo: 01..07. |
executive_rut | string | No | RUT del ejecutivo (validado si se envía). |
evidence[]
evidence[]| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
format | string | Sí | Formato permitido por la Activity (PDF_A, MP3, JSON). |
url | string | Condicional | URL válida cuando la custodia es EXTERNAL_URL_ONLY. |
hash | string | Condicional | Hash declarado (obligatorio en REDEC). |
custody | string | No | FLOID_STORAGE o EXTERNAL_URL_ONLY (se valida contra la Activity). |
¿Cuándo es obligatoria la evidencia? Depende de la política de evidencia (
evidence_requirement) de la Activity: si esREQUIRED_IMMEDIATE, se exige al menos una pieza al crear; si es diferida, se agrega después conregister_evidence.
Ejemplo (REDEC · consentimiento)
curl --location 'https://api.floid.app/cl/consent_manager/create_processing' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{TOKEN}}' \
--data '{
"activity_code": "marketing-redec",
"occurred_at": "2026-09-10T13:00:00.000Z",
"subject_external_id": "customer-8293",
"subject_snapshot": {
"subject_type": "NATURAL",
"subject_identification": { "type": "CL_RUT", "value": "12.345.678-5" },
"email": "[email protected]"
},
"medium": "ELECTRONIC",
"operational_code": "crm-op-8891",
"redec": {
"consent_id": "institution-consent-001",
"purpose": 2,
"objective": "02",
"executive_rut": "98765432-1"
},
"evidence": [
{ "format": "JSON", "url": "https://institution.example/evidence/redec-001.json", "hash": "hash-declarado" }
]
}'Respuesta exitosa (200)
{
"code": 200,
"message": "DataProcessing created",
"caseid": "b3f1c2a4-9e77-4c31-8a10-2f6d5e7a1b90",
"data": {
"data_processing_id": "550e8400-e29b-41d4-a716-446655440000",
"data_processing_event_id": "9d2b7f10-3c44-4a51-8b22-77aa11bb22cc",
"event_type": "CONSENT_GRANTED",
"occurred_at": "2026-09-10T13:00:00.000Z",
"received_at": "2026-09-10T13:00:05.000Z",
"status": "ACTIVE",
"legal_basis": "CONSENT",
"legal_framework": "REDEC",
"subject_external_id": "customer-8293",
"subject_snapshot": {
"subject_type": "NATURAL",
"subject_identification": { "type": "CL_RUT", "value": "12.345.678-5" },
"email": "[email protected]"
},
"activity": { "code": "marketing-redec", "version_number": 3 },
"terms_and_conditions": {
"version": 2,
"title": "Términos de marketing",
"status": "PUBLISHED",
"snapshot_url": "https://cdn.floid.app/tc/marketing-v2.pdf",
"hash": "9f2b...e7"
},
"validity": {
"ends_at": "2026-09-25T13:00:00.000Z",
"end_mode": "FIXED_DURATION_FROM_FACT",
"ended_at": null
},
"evidence_status": "RECEIVED",
"evidence_due_at": null,
"evidence": [
{
"evidence_id": "ev_7c2a1b0d",
"source_event_id": "9d2b7f10-3c44-4a51-8b22-77aa11bb22cc",
"source_event_type": "CONSENT_GRANTED",
"received_at": "2026-09-10T13:00:05.000Z",
"format": "JSON",
"custody": "EXTERNAL_URL_ONLY",
"hash": "hash-declarado",
"ref": "https://institution.example/evidence/redec-001.json"
}
],
"operational_code": "crm-op-8891",
"business_reference": null,
"metadata": null,
"redec": {
"consent_id": "institution-consent-001",
"institution_code": "1234",
"purpose": "2",
"objective": "02",
"executive_rut": "98765432-1"
},
"replayed": false
}
}Estructura de data
data| Campo | Tipo | Descripción |
|---|---|---|
data_processing_id | string | UUID del tratamiento creado. |
data_processing_event_id | string | UUID del evento de inicio registrado. |
event_type | string | CONSENT_GRANTED o PROCESSING_DECLARED (según base legal). |
occurred_at | string (ISO 8601) | Momento del hecho. |
received_at | string (ISO 8601) | Momento en que Floid recibió el evento. |
status | string | Estado inicial: normalmente ACTIVE. |
legal_basis | string | Base legal inferida. |
legal_framework | string | Marco inferido (REDEC | LPDP). |
subject_external_id | string | Identificador del titular (eco en claro). |
subject_snapshot | object | Snapshot del titular tal como se persistió. |
activity | object | { code, version_number } de la Activity aplicada. |
terms_and_conditions | object | T&C aplicados (version, title, status, snapshot_url, hash) o null. |
validity | object | { ends_at, end_mode, ended_at }. |
evidence_status | string | NOT_REQUIRED, PENDING, RECEIVED, OVERDUE. |
evidence_due_at | string (ISO 8601) | Vencimiento de evidencia diferida (null si no aplica). |
evidence | array | Piezas de evidencia activas (evidence_id, source_event_id, source_event_type, received_at, format, custody, hash, ref). |
operational_code | string | Eco del código operacional. |
business_reference | string | Eco de la referencia de negocio (null si no se envió). |
metadata | object | Eco de metadatos (null si no se envió). |
redec | object | Bloque REDEC (null para LPDP). |
replayed | boolean | true si el request fue una reproducción idempotente. |
Errores
| HTTP | error_code | Cuándo |
|---|---|---|
| 400 | ACTIVITY_CODE_REQUIRED | Falta activity_code. |
| 400 | VALIDATION_ERROR | Falta operational_code u otro campo obligatorio. |
| 400 | OCCURRED_AT_REQUIRED / OCCURRED_AT_INVALID | occurred_at ausente o inválido. |
| 400 | SUBJECT_EXTERNAL_ID_REQUIRED | Falta subject_external_id. |
| 400 | IDENTIFICATION_REQUIRED | Falta subject_snapshot.subject_identification. |
| 400 | MEDIUM_REQUIRED / MEDIUM_INVALID | medium ausente o fuera de catálogo. |
| 400 | EVIDENCE_REQUIRED / EVIDENCE_INVALID | Falta evidencia exigida o formato/custodia inválidos. |
| 400 | REDEC_CONSENT_ID_REQUIRED / REDEC_PURPOSE_INVALID / REDEC_OBJECTIVE_INVALID | Datos REDEC ausentes o inválidos. |
| 400 | INVALID_FIELD_FOR_PROCESSING_DECLARED | Se envió expires_at o redec en un tratamiento no-consentimiento. |
| 409 | INSTITUTION_NOT_CONFIGURED | La Activity es REDEC pero el tenant no tiene institution_code configurado. |
| 404 | ACTIVITY_NOT_FOUND / ACTIVITY_NOT_PUBLISHED | No hay Activity publicada aplicable en occurred_at. |
| 409 | REDEC_CONSENT_ID_DUPLICATE | redec.consent_id ya existe (con contenido distinto). |
| 500 | INTERNAL_ERROR | Error inesperado del servidor. |
Updated about 7 hours ago
