{"openapi":"3.1.0","info":{"title":"w14n.dev Open Data API","version":"1.0.0","description":"Structured open data APIs for Brazilian business intelligence, CNAE establishment counts, historical vehicle depreciation, and geographic coordinates. Datasets are partial declared samples.","license":{"name":"ODbL 1.0 / Open Data Commons Open Database License","url":"https://opendatacommons.org/licenses/odbl/1-0/"}},"security":[],"servers":[{"url":"https://w14n.dev","description":"Production Edge Server"}],"components":{"schemas":{"MetaEnvelope":{"type":"object","properties":{"api_version":{"type":"string"},"dataset":{"type":"string"},"data_as_of":{"type":"string"},"snapshot_note":{"type":"string"},"scope":{"type":"string"},"coverage":{"type":"string"},"source":{"type":"string"},"generated_at":{"type":"string"}},"required":["api_version","dataset","data_as_of","source"]},"ErrorPayload":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"hint":{"type":"string"}},"required":["code","message","hint"]},"meta":{"$ref":"#/components/schemas/MetaEnvelope"}},"required":["error","meta"]}}},"paths":{"/api/v1/company/{cnpj}":{"get":{"summary":"Get Company Profile by CNPJ","operationId":"getCompanyByCnpj","description":"Look up a Brazilian company by CNPJ in agribusiness, mining and meat-processing sectors. Returns status, size, share capital, activity and location.","parameters":[{"name":"cnpj","in":"path","required":true,"description":"14-digit Brazilian CNPJ (with or without standard formatting).","schema":{"type":"string"}}],"responses":{"200":{"description":"Company record found.","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/MetaEnvelope"},"data":{"type":"object","properties":{"cnpj":{"type":"string"},"legal_name":{"type":"string"},"trade_name":{"type":["string","null"]},"legal_nature":{"type":"object"},"status":{"type":"object"},"establishment_type":{"type":"string"},"opened_on":{"type":"string"},"age_years":{"type":"number"},"company_size":{"type":"object"},"share_capital":{"type":"object"},"main_activity":{"type":"object"},"location":{"type":"object"}}}},"required":["meta","data"]}}}},"400":{"description":"Invalid CNPJ format.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayload"}}}},"404":{"description":"CNPJ not in sample dataset.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayload"}}}}}}},"/api/v1/analytics/cnae/{cnae}/municipalities":{"get":{"summary":"Get Active Establishments by Municipality for a CNAE","operationId":"getCnaeEstablishmentsByMunicipality","description":"Count active establishments of a Brazilian economic activity (CNAE) by municipality, with age and size mix.","parameters":[{"name":"cnae","in":"path","required":true,"description":"7-digit CNAE code (0115600, 0134200, 0710301, 0710302, 1011201, 1012101).","schema":{"type":"string"}},{"name":"state","in":"query","required":true,"description":"2-letter Brazilian state abbreviation (e.g. MT, SP, GO).","schema":{"type":"string"}}],"responses":{"200":{"description":"Municipality aggregations for the requested CNAE and state.","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/MetaEnvelope"},"data":{"type":"object","properties":{"cnae":{"type":"object"},"state":{"type":"string"},"total_establishments_in_state":{"type":"integer"},"total_municipalities":{"type":"integer"},"municipalities":{"type":"array"}}}},"required":["meta","data"]}}}},"400":{"description":"Missing required state query parameter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayload"}}}},"404":{"description":"CNAE or state not in sample dataset.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayload"}}}}}}},"/api/v1/analytics/cnae/{cnae}/states":{"get":{"summary":"Get Active Establishments by State for a CNAE","operationId":"getCnaeEstablishmentsByState","description":"State-level totals and municipality counts for a supported Brazilian economic activity (CNAE).","parameters":[{"name":"cnae","in":"path","required":true,"description":"7-digit CNAE code (0115600, 0134200, 0710301, 0710302, 1011201, 1012101).","schema":{"type":"string"}}],"responses":{"200":{"description":"State totals for the requested CNAE.","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/MetaEnvelope"},"data":{"type":"object"}},"required":["meta","data"]}}}},"404":{"description":"CNAE not in sample dataset.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayload"}}}}}}},"/api/v1/fipe/{fipe_code}/depreciation":{"get":{"summary":"Get Historical Vehicle Price Depreciation","operationId":"getFipeDepreciation","description":"Historical year-over-year depreciation of Brazilian vehicle prices (FIPE), up to Sep 2023.","parameters":[{"name":"fipe_code","in":"path","required":true,"description":"FIPE vehicle code with or without hyphen (e.g. 001001-4 or 0010014).","schema":{"type":"string"}}],"responses":{"200":{"description":"Historical vehicle depreciation series.","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/MetaEnvelope"},"data":{"type":"object"}},"required":["meta","data"]}}}},"400":{"description":"Invalid FIPE code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayload"}}}},"404":{"description":"FIPE code not in sample dataset.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayload"}}}}}}},"/api/v1/geo/municipality":{"get":{"summary":"Resolve Municipality to Geographic Coordinates","operationId":"resolveMunicipalityCoordinates","description":"Resolve a Brazilian municipality name and state to coordinates.","parameters":[{"name":"name","in":"query","required":true,"description":"Municipality or administrative region name or slug (e.g., Sorriso, plano-piloto).","schema":{"type":"string"}},{"name":"state","in":"query","required":true,"description":"2-letter state abbreviation (e.g. MT, DF, SP).","schema":{"type":"string"}}],"responses":{"200":{"description":"Municipality geographic coordinates resolved.","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/MetaEnvelope"},"data":{"type":"object","properties":{"name":{"type":"string"},"slug":{"type":"string"},"state":{"type":"string"},"kind":{"type":"string"},"lat":{"type":"number"},"lng":{"type":"number"},"ibge_code":{"type":["string","null"]}}}},"required":["meta","data"]}}}},"400":{"description":"Missing required parameters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayload"}}}},"404":{"description":"Municipality not found in specified state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayload"}}}}}}}}}