BCRPData Series API client, generated from the OpenAPI spec.
Community-authored minimal description of the official public BCRPData JSON series endpoint.
Learn more about BCRPData Series API at estadisticas.bcrp.gob.pe.
This is an unofficial SDK for the BCRPData Series public API, generated by Voxgig with @voxgig/sdkgen. It is not affiliated with, endorsed by, or sponsored by the upstream API provider.
Learn more about Voxgig SDKs at voxgig.com/sdk.
Features:
test— opt-in, inactive until switched on, and configured per client. See the Features section of any SDK README below for what each one does.
This SDK exposes the API as a small set of semantic entities — Series — that you
call directly, instead of assembling URL paths and query strings. Entities are
Capitalised to mark them as the primary surface, each with the operations they
support (load):
const client = new BcrpDataSDK()
const series = await client.Series().load({ code: "example", end: "example", start: "example" })Thinking in entities keeps the mental model small — for people and AI agents alike — rather than reasoning about raw HTTP routes and query parameters.
Every SDK ships a built-in test mode that swaps the HTTP transport for an in-memory mock, so your unit tests run fully offline — no server, no network, and no credentials:
// The offline mock starts EMPTY — seed it with the records the test needs.
// Shape: { entity: { <entity-name>: { <id>: <record> } } }
const client = BcrpDataSDK.test({
entity: {
series: {
test01: { id: 'test01' },
},
},
})
const series = await client.Series().load({ code: 'example_code', end: 'example_end', start: 'example_start' })
// series is the Series entity, populated with mock data
// — call series.data() for the record itself
console.log(series)| Language | Package | Install |
|---|---|---|
| TypeScript | @dreamcoder08/bcrp-data-sdk |
publish pending — install from source |
import { BcrpDataSDK } from '@dreamcoder08/bcrp-data-sdk'
const client = new BcrpDataSDK()
// Load series data (returns a Series)
const series = await client.Series().load()
console.log(series)See the TypeScript README for the full guide.
| Surface | Path |
|---|---|
| SDK (TypeScript) | ts/ |
The API exposes one entity:
| Entity | Description | API path |
|---|---|---|
| Series | The Series entity (load). | /{code}/json/{start}/{end} |
The operations available across these entities are load — see each entity's own list above for exactly which it supports.
For endpoints the entity model doesn't cover, use the low-level methods:
direct(fetchargs)— build and send an HTTP request in one step.prepare(fetchargs)— build the request without sending it.
Both accept a map with path, method, params, query,
headers, and body. See the How-to guides below.
When the entity interface does not cover an endpoint, use direct:
TypeScript:
const result = await client.direct({
path: '/api/resource/{id}',
method: 'GET',
params: { id: 'example' },
})
if (result instanceof Error) {
throw result
}
console.log(result.data)Everyday use only needs the sections above. This explains the internals behind every call — relevant when writing custom features.
Every SDK call runs the same five-stage pipeline:
- Point — resolve the API endpoint from the operation definition.
- Spec — build the HTTP specification (URL, method, headers, body).
- Request — send the HTTP request.
- Response — receive and parse the response.
- Result — extract the result data for the caller.
A feature hook fires at each stage (e.g. PrePoint, PreSpec,
PreRequest), so features can inspect or modify the pipeline without
forking the SDK.
| Feature | Purpose |
|---|---|
| TestFeature | Test transport |
Pass custom features via the extend option at construction time.
This repository contains its own generator (.sdk/), so the SDK is
customizable without forking any upstream tool:
- The model (
.sdk/model/) declares everything this project owns: package names, versions, active features, per-target settings. It is written in aontu, a JSON-based specification language designed for building ontologies: easy to edit by hand, and files unify rather than override, so small declarations compose into one model. Regeneration re-reads it every time. - Templates (
.sdk/tm/) and components (.sdk/src/cmp/) are the two layers of generation, copied into this repo: templates are the literal per-language source, components generate the API-shaped parts. - Regeneration merges. By default, newly generated content is three-way merged into existing files, so generator updates and local edits usually converge without manual conflict handling. A project can opt for plain overwrite instead.
- Custom features and entire custom targets arrive through sdkgen
packages (
voxgig-sdkgen package add), on the same rails as the bundled languages, andvoxgig-sdkgen doctorreports any drift from what a resync would write.
How-to: customize and propagate templates. The full story: voxgig.com/sdk/custom.
This SDK is generated from the upstream OpenAPI specification. It is an unofficial client and is not affiliated with the API provider.
The OpenAPI spec(s) this SDK was generated from are kept in the
.sdk/def/ folder.
- Upstream API: https://estadisticas.bcrp.gob.pe/estadisticas/series/api
Please report security issues to security@voxgig.com. See SECURITY.md. Do not open public issues for suspected vulnerabilities.
Generated from the BCRPData Series API OpenAPI spec by @voxgig/sdkgen.