Brasil API icon

Brasil API

Consulta endpoints públicos da BrasilAPI

Overview

This node integrates with BrasilAPI, a public API providing various Brazilian data endpoints. It allows users to query diverse datasets such as postal codes (CEP), telephone area codes (DDD), banks, currency exchange rates, company registrations (CNPJ), vehicle pricing, weather forecasts, and more.

The specific operation "DDD → UF & cidades" fetches information about a Brazilian telephone area code (DDD), returning the corresponding state (UF) and cities covered by that DDD. This is useful for applications needing to map phone area codes to geographic locations within Brazil.

Practical examples:

  • Validating or enriching user input by converting a phone area code into its associated state and cities.
  • Building location-based services or analytics that require mapping phone numbers to regions.
  • Integrating with contact management systems to automatically tag contacts with their geographic region based on DDD.

Properties

Name Meaning
DDD The Brazilian telephone area code number to look up. For example, 11 corresponds to São Paulo metropolitan area.

Output

The output is a JSON object containing details about the given DDD code. Typically, it includes:

  • The state abbreviation (UF) corresponding to the DDD.
  • A list of cities served by that DDD.

Example output structure (simplified):

{
  "ddd": 11,
  "state": "SP",
  "cities": [
    "São Paulo",
    "Guarulhos",
    "Osasco",
    ...
  ]
}

No binary data is returned by this operation.

Dependencies

  • The node depends on the public BrasilAPI service accessible at https://brasilapi.com.br/api.
  • No authentication or API keys are required to use this endpoint.
  • The node uses the HTTP client library internally to perform GET requests with a 10-second timeout.

Troubleshooting

  • Timeouts or network errors: Since the node relies on an external public API, network issues or BrasilAPI downtime can cause request failures. Check internet connectivity and BrasilAPI status.
  • Unsupported operation error: If the operation parameter is set incorrectly or to an unsupported value, the node will throw an error indicating the operation is unsupported.
  • Invalid DDD input: Providing a non-existent or invalid DDD number may result in empty or error responses from the API. Validate inputs before running the node.
  • Unexpected response format: Changes in the BrasilAPI response structure could break parsing; ensure the node version is up to date.

Links and References

Discussion