Data Source Runs Guide

This guide explains how Data Source Runs work in the V2 API, including the paginatable records pattern for handling large datasets.

Overview

What is a DataSourceRun?

A DataSourceRun represents a single execution of a data source check against an entity. Each run:

  • Belongs to an EntityValidation
  • Has a specific data source type (e.g., cl/tax_situation_search, cl/bulletins_search)
  • Transitions through a status lifecycle
  • Contains the retrieved data when successful

Status Lifecycle

StatusDescription
createdRun has been created, not yet started or still processing
succeededRun completed successfully with data
temporary_errorRun failed but may be retried
definitive_errorRun failed permanently (e.g., invalid TIN)
missing_input_dataRun is paused waiting for required inputs

API Endpoints

Show Data Source Run

Retrieves a data source run with its full data payload.

GET /api/v2/data_source_runs/:id

Response:

{
  "data_source_run": {
    "id": "dsr_5a6141dec2bc384e",
    "type": "cl/tax_situation_search",
    "entity_validation_id": "evl_abc123",
    "data_source_run_batch_id": "dsrb_xyz789",
    "created_at": "2024-01-15T19:48:18.056Z",
    "succeeded_at": "2024-01-15T19:48:20.056Z",
    "status": "succeeded",
    "data": {
      "id": "tss_6d6a705304d3b568",
      "has_activity_initiation": true,
      "activity_initiation_date": "2018-12-06",
      "business_name": "EMPRESA EJEMPLO SPA",
      "..."
    }
  }
}

Get Paginated Records

Retrieves paginated records from a data source that uses the paginatable data pattern.

GET /api/v2/data_source_runs/:data_source_run_id/records

Query Parameters:

ParameterRequiredDescription
pageNoPage number (default: 1)
per_pageNoItems per page (max/default: 50)
typeConditionalRecord type for multi-array data sources

Response Headers:

HeaderDescription
X-TotalTotal number of items
X-PageCurrent page number
X-Per-PageItems per page
LinkPagination links (first, last, next, prev)

Response Structure

Data Source Run Schema

All data source runs share these common fields:

{
  "id": "dsr_...",
  "type": "cl/tax_situation_search",
  "entity_validation_id": "evl_...",
  "data_source_run_batch_id": "dsrb_...",
  "created_at": "2024-01-15T19:48:18.056Z",
  "succeeded_at": "2024-01-15T19:48:20.056Z",
  "status": "succeeded",
  "data": { ... }
}

The data field structure varies by data source type. See Data Source Types Reference below.

Paginatable Data Pattern

Why Pagination?

Some data sources can return hundreds or thousands of records (e.g., legal cases, debt bulletins, labor fines). Instead of embedding all records in the response:

  • Records are counted and a URL is provided
  • Clients fetch records on-demand via the /records endpoint
  • This keeps responses fast and manageable

How It Works

Data sources with large datasets return a pagination object instead of the full array:

{
  "data": {
    "id": "lcs_abc123",
    "legal_cases": {
      "count": 150,
      "records_url": "/api/v2/data_source_runs/dsr_xyz/records"
    }
  }
}

The records_url points to the records endpoint where you can fetch the actual items with pagination.

Single vs Multi-Array Data Sources

Single-array data sources have one paginatable collection:

{
  "legal_cases": {
    "count": 150,
    "records_url": "/api/v2/data_source_runs/dsr_123/records"
  }
}

Multi-array data sources have multiple collections requiring the type parameter:

{
  "vehicles": {
    "count": 5,
    "records_url": "/api/v2/data_source_runs/dsr_123/records?type=vehicles"
  },
  "real_estate_assets": {
    "count": 3,
    "records_url": "/api/v2/data_source_runs/dsr_123/records?type=real_estate_assets"
  }
}

Data Source Types Reference

Simple Data Sources (Embedded Data)

These data sources return all data inline without pagination:

TypeDescription
cl/tax_situation_searchChilean tax status from SII
cl/ndf_situation_searchNDF (difficult to audit) status
cl/nonprofit_status_searchNonprofit organization status
cl/public_market_situation_searchMercadoPublico registration
cl/cmf_debts_searchCMF monthly debt history
mx/rfc_information_searchMexican RFC information

Single Paginatable Data Sources

These have one collection of records:

TypeCollectionRecord Schema
cl/bankruptcy_bulletins_searchbankruptcy_bulletinsBulletin item
cl/labor_fines_searchlabor_fines_search_resultsLabor fine item
cl/business_legal_cases_searchlegal_casesLegal case item
cl/person_legal_cases_searchlegal_casesLegal case item
cl/snifa_sanctions_searchsanctionsSNIFA sanction item
cl/relations_searchrelationsRelation item
cl/sernageomin_fines_searchsernageomin_fines_search_resultsSernageomin fine item
cl/social_security_debts_searchsocial_security_debt_search_resultsSocial security debt item
cl/public_market_contracts_searchpublic_market_contracts_search_resultsContract item

Multi-Type Paginatable Data Sources

These have multiple collections requiring the type parameter:

TypeCollections
cl/bulletins_searchcommercial_bulletins, financial_bulletins, labor_bulletins, cobranzaonline_bulletins
cl/general_bulletins_searchcommercial_bulletins, financial_bulletins, labor_bulletins
cl/assets_searchvehicles, real_estate_assets, residences
cl/equifax_business_data_searchcommercial_bulletins, financial_bulletins, labor_bulletins, dicom_bulletins, bankruptcy_bulletins
cl/equifax_person_data_searchcommercial_bulletins, financial_bulletins, labor_bulletins, dicom_bulletins

Example Flows

Fetching a Simple Data Source

# Get the data source run with embedded data
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.plutto.cl/api/v2/data_source_runs/dsr_abc123"

Response includes all data inline:

{
  "data_source_run": {
    "id": "dsr_abc123",
    "type": "cl/tax_situation_search",
    "status": "succeeded",
    "data": {
      "id": "tss_xyz",
      "has_activity_initiation": true,
      "business_name": "EMPRESA SPA",
      "direct_employees": 15,
      "activity_registrations": [...]
    }
  }
}

Fetching All Records from a Paginatable Source

Step 1: Get the data source run

curl -H "Authorization: Bearer $TOKEN" \
  "https://api.plutto.cl/api/v2/data_source_runs/dsr_def456"

Response shows count and records_url:

{
  "data_source_run": {
    "id": "dsr_def456",
    "type": "cl/business_legal_cases_search",
    "status": "succeeded",
    "data": {
      "id": "lcs_xyz",
      "legal_cases": {
        "count": 75,
        "records_url": "/api/v2/data_source_runs/dsr_def456/records"
      }
    }
  }
}

Step 2: Fetch records page by page

# First page (default)
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.plutto.cl/api/v2/data_source_runs/dsr_def456/records"

# Second page
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.plutto.cl/api/v2/data_source_runs/dsr_def456/records?page=2"

Response:

{
  "records": [
    {
      "id": "lc_001",
      "case_type": "OJV - Causas Civiles",
      "date": "2022-03-29",
      "label": "Company A S.A./Company B SPA",
      "legal_id": "C-9374-2021",
      "court": "Corte de Apelaciones"
    },
    { "..." }
  ]
}

Check response headers for pagination info:

X-Total: 75
X-Page: 1
X-Per-Page: 50
Link: <...?page=2>; rel="next", <...?page=2>; rel="last"

Fetching from Multi-Array Data Source

Step 1: Get the data source run

curl -H "Authorization: Bearer $TOKEN" \
  "https://api.plutto.cl/api/v2/data_source_runs/dsr_ghi789"

Response shows multiple collections:

{
  "data_source_run": {
    "id": "dsr_ghi789",
    "type": "cl/assets_search",
    "status": "succeeded",
    "data": {
      "id": "das_xyz",
      "vehicles": {
        "count": 3,
        "records_url": "/api/v2/data_source_runs/dsr_ghi789/records?type=vehicles"
      },
      "real_estate_assets": {
        "count": 2,
        "records_url": "/api/v2/data_source_runs/dsr_ghi789/records?type=real_estate_assets"
      }
    }
  }
}

Step 2: Fetch each collection using the type parameter

# Get vehicles
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.plutto.cl/api/v2/data_source_runs/dsr_ghi789/records?type=vehicles"

# Get real estate
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.plutto.cl/api/v2/data_source_runs/dsr_ghi789/records?type=real_estate_assets"

Record Schemas

Bulletin Item

{
  "id": "bul_123",
  "bulletin_type": "commercial",
  "issuer_or_creditor": "Banco de Chile",
  "date": "2019-01-01",
  "payment_date": "2019-01-15",
  "description": "Deuda de 1000 UF",
  "amount": "1000",
  "debtor": "Juan Perez"
}

Legal Case Item

{
  "id": "lc_123",
  "case_type": "OJV - Causas Civiles",
  "date": "2022-03-29",
  "last_update_date": "2022-05-15",
  "label": "Company A S.A./Company B SPA",
  "legal_id": "C-9374-2021",
  "court": "Corte de Apelaciones",
  "legal_stance": "against"
}

Vehicle Item

{
  "id": "cvh_123",
  "brand": "TOYOTA",
  "model": "HILUX",
  "year": "2020",
  "vehicle_type": "CAMIONETA",
  "license_plate": "ABCD12",
  "value": "15000000"
}

Real Estate Asset Item

{
  "id": "cra_123",
  "address": "Av. Principal 123",
  "location": "Santiago, Providencia",
  "value": "50000000",
  "role": "00631-000XX"
}

Labor Fine Item

{
  "id": "lfe_123",
  "origin": "FISCALIZACION",
  "fine_id": "XXXX/22/033-2",
  "status": "PAGADA",
  "execution_date": "2024-01-01",
  "amount": "40,00",
  "currency": "UTM",
  "description": "Multa por incumplimiento"
}

Relation Item

{
  "id": "dr_123",
  "tin": "16224182-6",
  "name": "Victor David",
  "surname": "Mendoza Guerra",
  "entity_name": "Victor David Mendoza Guerra",
  "entity_category": "person",
  "relations": ["shareholder", "director"]
}