Openmercantil SDK
OpenMercantil API client, generated from the OpenAPI spec.
Versioned public-read, browser-account, billing, support and provider-callback contracts.
Learn more about OpenMercantil API at openmercantil.es/api/documentacion.
This is an unofficial SDK for the OpenMercantil 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.
Metadata kindly supplied by www.freepublicapis.com.
TypeScript, Python, PHP, Golang, Ruby, Lua SDKs, a CLI, an interactive REPL, and an MCP server for AI agents — all generated from one OpenAPI spec by @voxgig/sdkgen.
Entities, not endpoints
This SDK exposes the API as 113 semantic entities that you
call directly, instead of assembling URL paths and query strings. See the Entities table below for the full list. Entities are
Capitalised to mark them as the primary surface, each with the operations they
support (list, load, create, update, remove):
const client = new OpenmercantilSDK()
const apicredential = await client.ApiCredential().create({
scope: [],
})
Thinking in entities keeps the mental model small — for people and AI agents alike — rather than reasoning about raw HTTP routes and query parameters.
Offline unit testing
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:
TypeScript
const client = OpenmercantilSDK.test()
const billing = await client.Billing().load({ id: 'test01' })
// billing is a bare Billing populated with mock data
console.log(billing)
Python
client = OpenmercantilSDK.test()
billing = client.Billing().load({"id": "test01"})
print(billing)
PHP
// Seed fixture data so offline calls resolve without a live server.
$client = OpenmercantilSDK::test([
"entity" => ["billing" => ["test01" => ["id" => "test01"]]],
]);
$billing = $client->Billing()->load(["id" => "test01"]);
Golang
client := sdk.Test()
result, err := client.Billing(nil).Load(
map[string]any{"id": "test01"}, nil,
)
Ruby
# Seed fixture data so offline calls resolve without a live server.
client = OpenmercantilSDK.test({
"entity" => { "billing" => { "test01" => { "id" => "test01" } } },
})
billing = client.Billing.load({ "id" => "test01" })
Lua
local client = sdk.test()
local result, err = client:Billing():load({ id = "test01" })
Packages
| Language | Package | Install |
|---|---|---|
| TypeScript | @voxgig-sdk/openmercantil | publish pending — install from git tag |
| Python | voxgig-sdk-openmercantil | publish pending — install from git tag |
| PHP | voxgig-sdk/openmercantil | publish pending — install from git tag |
| Golang | github.com/voxgig-sdk/openmercantil-sdk/go | go get github.com/voxgig-sdk/openmercantil-sdk/go@latest |
| Ruby | voxgig-sdk-openmercantil | publish pending — install from git tag |
| Lua | voxgig-sdk-openmercantil | publish pending — install from git tag |
| Go CLI | github.com/voxgig-sdk/openmercantil-sdk/go-cli | go install github.com/voxgig-sdk/openmercantil-sdk/go-cli/cmd/openmercantil@latest |
| Go MCP server | github.com/voxgig-sdk/openmercantil-sdk/go-mcp | go get github.com/voxgig-sdk/openmercantil-sdk/go-mcp@latest |
Quickstart
TypeScript
import { OpenmercantilSDK } from '@voxgig-sdk/openmercantil'
const client = new OpenmercantilSDK({
apikey: process.env.OPENMERCANTIL_APIKEY,
})
// Load a specific companyactivityscore (returns a CompanyActivityScore)
const companyactivityscore = await client.CompanyActivityScore().load({
slug: 'example_slug',
})
console.log(companyactivityscore)
See the TypeScript README for the full guide.
Surfaces
| Surface | Path |
|---|---|
| SDK (TypeScript, Python, PHP, Golang, Ruby, Lua) | ts/ py/ php/ go/ rb/ lua/ |
| CLI | go-cli/ |
| MCP server | go-mcp/ |
Use it from an AI agent (MCP)
The generated MCP server exposes every operation in this SDK as an MCP tool that Claude, Cursor or Cline can call directly. Build and register it:
cd go-mcp && go build -o openmercantil-mcp .
Then add it to your agent’s MCP config (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"openmercantil": {
"command": "/abs/path/to/openmercantil-mcp"
}
}
}
Entities
The API exposes 113 entities:
| Entity | Description | API path |
|---|---|---|
| ApiCredential | The ApiCredential entity (create). | /api/v1/user/api-credentials |
| ApiCredentialOneTime | The ApiCredentialOneTime entity (create). | /api/v1/user/api-credentials/{id}/rotate |
| Billing | The Billing entity (create, load). | /api/v1/stripe-webhook |
| BillingInvoice | The BillingInvoice entity (list). | /api/v1/billing/invoices |
| CcaaStat | The CcaaStat entity (list). | /api/v1/ccaa/stats |
| Cnae | The Cnae entity (load). | /api/v1/cnae/{code} |
| CnaeTree | The CnaeTree entity (list). | /api/v1/cnae/tree |
| Company | The Company entity (list, load). | /api/v1/company/{slug}/risk-signals |
| CompanyAccount | The CompanyAccount entity (list). | /api/v1/company/{slug}/accounts |
| CompanyActivity | The CompanyActivity entity (list). | /api/v1/company/{slug}/activity |
| CompanyActivityScore | The CompanyActivityScore entity (load). | /api/v1/company/{slug}/score |
| CompanyAeatDebtor | The CompanyAeatDebtor entity (list). | /api/v1/company/{slug}/aeat-moroso |
| CompanyBde | The CompanyBde entity (list). | /api/v1/company/{slug}/bde |
| CompanyCnmv | The CompanyCnmv entity (list). | /api/v1/company/{slug}/cnmv |
| CompanyCompare | The CompanyCompare entity (list). | /api/v1/companies/compare |
| CompanyEmbargo | The CompanyEmbargo entity (list). | /api/v1/company/{slug}/embargoes |
| CompanyEnrichment | The CompanyEnrichment entity (list). | /api/v1/company/{slug}/enrichment |
| CompanyEvent | The CompanyEvent entity (list). | /api/v1/company/{slug}/events |
| CompanyFact | The CompanyFact entity (list). | /api/v1/company/{slug}/facts |
| CompanyGrant | The CompanyGrant entity (list). | /api/v1/company/{slug}/grants |
| CompanyGraph | The CompanyGraph entity (load). | /api/v1/grafo/{slug} |
| CompanyLei | The CompanyLei entity (list). | /api/v1/company/{slug}/lei |
| CompanyProcurement | The CompanyProcurement entity (list). | /api/v1/company/{slug}/contracts |
| CompanyRelationship | The CompanyRelationship entity (list). | /api/v1/company/{slug}/relationships |
| CompanyReport | The CompanyReport entity (list). | /api/v1/company/{slug}/export |
| CompanySanction | The CompanySanction entity (list). | /api/v1/company/{slug}/sanctions |
| CompanySimilar | The CompanySimilar entity (list). | /api/v1/company/{slug}/similar |
| CompanySource | The CompanySource entity (list). | /api/v1/company/{slug}/sources |
| CompanyTed | The CompanyTed entity (list). | /api/v1/company/{slug}/ted |
| CompanyWikidata | The CompanyWikidata entity (list). | /api/v1/company/{slug}/wikidata |
| CredentialRevoked | The CredentialRevoked entity (remove). | /api/v1/user/api-credentials/{id} |
| Daily | The Daily entity (load). | /api/v1/daily/{date} |
| DailySummary | The DailySummary entity (load). | /api/v1/summary/date/{date} |
| Dataset | The Dataset entity (load). | /api/v1/export/companies |
| Deleted | The Deleted entity (remove). | /api/v1/user/webhooks/{id} |
| EmailDispatch | The EmailDispatch entity (create). | /api/v1/user/org/invites/{id}/resend |
| ExportUsage | The ExportUsage entity (load). | /api/v1/user/exports/usage |
| Health | The Health entity (load). | /api/v1/health |
| Integration | The Integration entity (list, load). | /api/v1/integrations |
| KycPersonLookup | The KycPersonLookup entity (create). | /api/v1/persons/lookup |
| KycPersonLookupHistory | The KycPersonLookupHistory entity (list). | /api/v1/persons/lookup/history |
| KycPersonLookupUsage | The KycPersonLookupUsage entity (load). | /api/v1/persons/lookup/usage |
| LegalActMap | The LegalActMap entity (list). | /api/v1/legal/act-map |
| LegalActMapEntry | The LegalActMapEntry entity (load). | /api/v1/legal/act-map/{acto} |
| LegalArticle | The LegalArticle entity (load). | /api/v1/legal/article/{norm}/{n} |
| LegalNorm | The LegalNorm entity (load). | /api/v1/legal/norm/{slug} |
| LegalNormsIndex | The LegalNormsIndex entity (list). | /api/v1/legal/norm |
| LegalReport | The LegalReport entity (create). | /api/v1/empresa/{slug}/informe-legal |
| Officer | The Officer entity (list). | /api/v1/company/{slug}/officers |
| Okn | The Okn entity (create). | /api/v1/support/ticket/{id}/reply |
| Okn10 | The Okn10 entity (update). | /api/v1/user/org |
| Okn11 | The Okn11 entity (remove). | /api/v1/user/org/invites/{id} |
| Okn12 | The Okn12 entity (create). | /api/v1/user/org/leave |
| Okn13 | The Okn13 entity (update). | /api/v1/user/org/members/{id} |
| Okn14 | The Okn14 entity (remove). | /api/v1/user/org/members/{id} |
| Okn15 | The Okn15 entity (update). | /api/v1/user/segments/{id} |
| Okn16 | The Okn16 entity (update). | /api/v1/user/segments/{id} |
| Okn17 | The Okn17 entity (remove). | /api/v1/user/segments/{id} |
| Okn18 | The Okn18 entity (remove). | /api/v1/user/tags/{id} |
| Okn19 | The Okn19 entity (create). | /api/v1/user/tags/{id}/assign |
| Okn2 | The Okn2 entity (update). | /api/v1/user/lists/{id} |
| Okn20 | The Okn20 entity (create). | /api/v1/user/tags/{id}/unassign |
| Okn3 | The Okn3 entity (update). | /api/v1/user/lists/{id} |
| Okn4 | The Okn4 entity (remove). | /api/v1/user/lists/{id} |
| Okn5 | The Okn5 entity (create). | /api/v1/user/lists/{id}/items |
| Okn6 | The Okn6 entity (remove). | /api/v1/user/lists/{id}/items/{item_id} |
| Okn7 | The Okn7 entity (update). | /api/v1/user/notes/{id} |
| Okn8 | The Okn8 entity (update). | /api/v1/user/notes/{id} |
| Okn9 | The Okn9 entity (remove). | /api/v1/user/notes/{id} |
| Org | The Org entity (create). | /api/v1/user/org |
| OrganizationInviteCreated | The OrganizationInviteCreated entity (create). | /api/v1/user/org/invites |
| OutboundWebhookOneTime | The OutboundWebhookOneTime entity (create). | /api/v1/user/webhooks/{id}/rotate |
| Person | The Person entity (load). | /api/v1/person/{slug} |
| PersonDocumentaryReport | The PersonDocumentaryReport entity (load). | /api/v1/persona/{slug} |
| PersonGraph | The PersonGraph entity (load). | /api/v1/grafo/persona/{slug} |
| PersonSearch | The PersonSearch entity (list). | /api/v1/person/search |
| Public | The Public entity (list). | /api/v1/datasets/public |
| PublicProcurement | The PublicProcurement entity (load). | /api/v1/tenders/{key} |
| PublicSourceStatus | The PublicSourceStatus entity (list). | /api/v1/sources/status |
| Search | The Search entity (list). | /api/v1/search |
| SectorCompany | The SectorCompany entity (list). | /api/v1/sector/{cnae}/companies |
| SectorRatio | The SectorRatio entity (list). | /api/v1/sector/{cnae}/ratios |
| SectorStat | The SectorStat entity (list). | /api/v1/sectores/stats |
| Source | The Source entity (list). | /api/v1/sources/freshness |
| StripeSession | The StripeSession entity (create). | /api/v1/checkout |
| SupportTicketCreated | The SupportTicketCreated entity (create). | /api/v1/support/ticket |
| System | The System entity (load). | /api/v1/stats |
| Tender | The Tender entity (list). | /api/v1/tenders |
| TenderStat | The TenderStat entity (list). | /api/v1/tenders/stats |
| TenderSupplier | The TenderSupplier entity (list). | /api/v1/contracts/top-companies |
| User | The User entity (list, load). | /api/v1/user/api-credentials |
| UserAudit | The UserAudit entity (list). | /api/v1/user/audit |
| UserExportList | The UserExportList entity (list). | /api/v1/user/exports |
| UserListCreated | The UserListCreated entity (create). | /api/v1/user/lists |
| UserListDetail | The UserListDetail entity (load). | /api/v1/user/lists/{id} |
| UserListList | The UserListList entity (list). | /api/v1/user/lists |
| UserMe | The UserMe entity (load). | /api/v1/user/me |
| UserNote | The UserNote entity (load). | /api/v1/user/notes/{id} |
| UserNoteCreated | The UserNoteCreated entity (create). | /api/v1/user/notes |
| UserNoteList | The UserNoteList entity (list). | /api/v1/user/notes |
| UserNotesForTarget | The UserNotesForTarget entity (list). | /api/v1/user/notes/for/{type}/{id} |
| UserOrganization | The UserOrganization entity (list). | /api/v1/user/org |
| UserPersona | The UserPersona entity (list). | /api/v1/user/persona |
| UserPersonaSelected | The UserPersonaSelected entity (create). | /api/v1/user/persona |
| UserSegment | The UserSegment entity (load). | /api/v1/user/segments/{id} |
| UserSegmentCreated | The UserSegmentCreated entity (create). | /api/v1/user/segments |
| UserSegmentList | The UserSegmentList entity (list). | /api/v1/user/segments |
| UserSegmentPin | The UserSegmentPin entity (create). | /api/v1/user/segments/{id}/pin |
| UserSegmentRun | The UserSegmentRun entity (create). | /api/v1/user/segments/{id}/run |
| UserTagCreated | The UserTagCreated entity (create). | /api/v1/user/tags |
| UserTagList | The UserTagList entity (list). | /api/v1/user/tags |
| VerificationDispatch | The VerificationDispatch entity (create). | /api/v1/resend-verification |
| Webhook | The Webhook entity (update). | /api/v1/user/webhooks/{id} |
The operations available across these entities are load, list, create, update, remove — see each entity’s own list above for exactly which it supports.
Quickstart in other languages
Python
import os
from openmercantil_sdk import OpenmercantilSDK
client = OpenmercantilSDK({
"apikey": os.environ.get("OPENMERCANTIL_APIKEY"),
})
PHP
<?php
require_once 'openmercantil_sdk.php';
$client = new OpenmercantilSDK([
"apikey" => getenv("OPENMERCANTIL_APIKEY"),
]);
Golang
import sdk "github.com/voxgig-sdk/openmercantil-sdk/go"
client := sdk.NewOpenmercantilSDK(map[string]any{
"apikey": os.Getenv("OPENMERCANTIL_APIKEY"),
})
// Load a specific companyactivityscore
companyActivityScore, err := client.CompanyActivityScore(nil).Load(
map[string]any{"slug": "example_slug"}, nil,
)
if err != nil {
panic(err)
}
fmt.Println(companyActivityScore)
Ruby
require_relative "Openmercantil_sdk"
client = OpenmercantilSDK.new({
"apikey" => ENV["OPENMERCANTIL_APIKEY"],
})
Lua
local sdk = require("openmercantil_sdk")
local client = sdk.new({
apikey = os.getenv("OPENMERCANTIL_APIKEY"),
})
Direct and prepare
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.
How-to guides
Make a direct API call
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)
Python:
result = client.direct({
"path": "/api/resource/{id}",
"method": "GET",
"params": {"id": "example"},
})
PHP:
$result = $client->direct([
"path" => "/api/resource/{id}",
"method" => "GET",
"params" => ["id" => "example"],
]);
Go:
result, err := client.Direct(map[string]any{
"path": "/api/resource/{id}",
"method": "GET",
"params": map[string]any{"id": "example"},
})
if err != nil {
panic(err)
}
fmt.Println(result)
Ruby:
result = client.direct({
"path" => "/api/resource/{id}",
"method" => "GET",
"params" => { "id" => "example" },
})
Lua:
local result, err = client:direct({
path = "/api/resource/{id}",
method = "GET",
params = { id = "example" },
})
Advanced
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.
Features
| Feature | Purpose |
|---|---|
| TestFeature | In-memory mock transport for testing without a live server |
Pass custom features via the extend option at construction time.
Per-language documentation
Upstream API
This SDK is generated from the upstream OpenAPI specification. It is an unofficial client and is not affiliated with the API provider.
- Upstream API: https://openmercantil.es/soporte
Security
Please report security issues to security@voxgig.com. See SECURITY.md. Do not open public issues for suspected vulnerabilities.
Generated from the OpenMercantil API OpenAPI spec by @voxgig/sdkgen.