Malha
curl --request POST \
--url https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "3550308",
"nivel": "municipios"
}
'import requests
url = "https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha"
payload = {
"id": "3550308",
"nivel": "municipios"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({id: '3550308', nivel: 'municipios'})
};
fetch('https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '3550308',
'nivel' => 'municipios'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha"
payload := strings.NewReader("{\n \"id\": \"3550308\",\n \"nivel\": \"municipios\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"3550308\",\n \"nivel\": \"municipios\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"3550308\",\n \"nivel\": \"municipios\"\n}"
response = http.request(request)
puts response.read_body{
"feature_count": 1,
"geojson": {
"features": [
{
"geometry": {
"coordinates": [
[
[
-46.8061,
-23.9396
],
[
-46.7894,
-23.941
],
[
-46.7422,
-23.9916
],
[
-46.6912,
-23.9849
],
[
-46.6502,
-24.0015
],
[
-46.6116,
-23.9694
],
[
-46.6071,
-23.9536
],
[
-46.6162,
-23.8627
],
[
-46.6324,
-23.8514
],
[
-46.6215,
-23.7846
],
[
-46.6542,
-23.7305
],
[
-46.6177,
-23.7122
],
[
-46.6317,
-23.6966
],
[
-46.6165,
-23.658
],
[
-46.5834,
-23.6412
],
[
-46.5793,
-23.6044
],
[
-46.548,
-23.6061
],
[
-46.5063,
-23.6258
],
[
-46.4854,
-23.623
],
[
-46.4724,
-23.6388
],
[
-46.4154,
-23.6386
],
[
-46.3948,
-23.6124
],
[
-46.3831,
-23.5993
],
[
-46.3946,
-23.5318
],
[
-46.3664,
-23.5122
],
[
-46.3867,
-23.4747
],
[
-46.4121,
-23.4704
],
[
-46.461,
-23.4831
],
[
-46.4937,
-23.4765
],
[
-46.5621,
-23.5001
],
[
-46.5705,
-23.4589
],
[
-46.5669,
-23.4162
],
[
-46.5363,
-23.3636
],
[
-46.5538,
-23.3616
],
[
-46.6006,
-23.3886
],
[
-46.6121,
-23.4173
],
[
-46.6551,
-23.4307
],
[
-46.6697,
-23.4183
],
[
-46.6999,
-23.4234
],
[
-46.7356,
-23.3881
],
[
-46.823,
-23.4011
],
[
-46.8233,
-23.4224
],
[
-46.8005,
-23.4696
],
[
-46.7987,
-23.4706
],
[
-46.7755,
-23.4662
],
[
-46.7601,
-23.5548
],
[
-46.8055,
-23.5876
],
[
-46.8081,
-23.6092
],
[
-46.7505,
-23.604
],
[
-46.7927,
-23.6472
],
[
-46.8013,
-23.686
],
[
-46.7961,
-23.7387
],
[
-46.7773,
-23.7667
],
[
-46.8006,
-23.8017
],
[
-46.7627,
-23.8274
],
[
-46.7761,
-23.8558
],
[
-46.7766,
-23.8927
],
[
-46.8044,
-23.8923
],
[
-46.8109,
-23.9203
],
[
-46.8061,
-23.9396
]
]
],
"type": "Polygon"
},
"properties": {
"codarea": "3550308"
},
"type": "Feature"
}
],
"type": "FeatureCollection"
},
"id": "3550308",
"metadados": {
"area": {
"dimensao": "1522.683",
"unidade": {
"id": "km2",
"nome": "Quilômetros quadrados"
}
},
"centroide": {
"latitude": -23.6504,
"longitude": -46.6482
},
"id": "3550308",
"nivel-geografico": "município",
"nome": "São Paulo",
"regiao-limitrofe": [
{
"latitude": -23.3568,
"longitude": -46.8263
},
{
"latitude": -24.0082,
"longitude": -46.3651
}
]
},
"nivel": "municipios",
"observed_at_ms": 1790047063790,
"source_url": "https://servicodados.ibge.gov.br/api/v4/malhas/municipios/3550308?formato=application%2Fvnd.geo%2Bjson&qualidade=minima"
}IBGE service data API
Malha
Draw or geo-join a Brazilian state, municipality or region; get its centroid and area in km2. Use qualidade=minima unless you need detailed geometry (maxima meshes are megabytes).
POST
https://api.aisa.one
/
apis
/
v1
/
servicodados-ibge-gov-br
/
official-statistics
/
malha
Malha
curl --request POST \
--url https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "3550308",
"nivel": "municipios"
}
'import requests
url = "https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha"
payload = {
"id": "3550308",
"nivel": "municipios"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({id: '3550308', nivel: 'municipios'})
};
fetch('https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '3550308',
'nivel' => 'municipios'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha"
payload := strings.NewReader("{\n \"id\": \"3550308\",\n \"nivel\": \"municipios\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"3550308\",\n \"nivel\": \"municipios\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"3550308\",\n \"nivel\": \"municipios\"\n}"
response = http.request(request)
puts response.read_body{
"feature_count": 1,
"geojson": {
"features": [
{
"geometry": {
"coordinates": [
[
[
-46.8061,
-23.9396
],
[
-46.7894,
-23.941
],
[
-46.7422,
-23.9916
],
[
-46.6912,
-23.9849
],
[
-46.6502,
-24.0015
],
[
-46.6116,
-23.9694
],
[
-46.6071,
-23.9536
],
[
-46.6162,
-23.8627
],
[
-46.6324,
-23.8514
],
[
-46.6215,
-23.7846
],
[
-46.6542,
-23.7305
],
[
-46.6177,
-23.7122
],
[
-46.6317,
-23.6966
],
[
-46.6165,
-23.658
],
[
-46.5834,
-23.6412
],
[
-46.5793,
-23.6044
],
[
-46.548,
-23.6061
],
[
-46.5063,
-23.6258
],
[
-46.4854,
-23.623
],
[
-46.4724,
-23.6388
],
[
-46.4154,
-23.6386
],
[
-46.3948,
-23.6124
],
[
-46.3831,
-23.5993
],
[
-46.3946,
-23.5318
],
[
-46.3664,
-23.5122
],
[
-46.3867,
-23.4747
],
[
-46.4121,
-23.4704
],
[
-46.461,
-23.4831
],
[
-46.4937,
-23.4765
],
[
-46.5621,
-23.5001
],
[
-46.5705,
-23.4589
],
[
-46.5669,
-23.4162
],
[
-46.5363,
-23.3636
],
[
-46.5538,
-23.3616
],
[
-46.6006,
-23.3886
],
[
-46.6121,
-23.4173
],
[
-46.6551,
-23.4307
],
[
-46.6697,
-23.4183
],
[
-46.6999,
-23.4234
],
[
-46.7356,
-23.3881
],
[
-46.823,
-23.4011
],
[
-46.8233,
-23.4224
],
[
-46.8005,
-23.4696
],
[
-46.7987,
-23.4706
],
[
-46.7755,
-23.4662
],
[
-46.7601,
-23.5548
],
[
-46.8055,
-23.5876
],
[
-46.8081,
-23.6092
],
[
-46.7505,
-23.604
],
[
-46.7927,
-23.6472
],
[
-46.8013,
-23.686
],
[
-46.7961,
-23.7387
],
[
-46.7773,
-23.7667
],
[
-46.8006,
-23.8017
],
[
-46.7627,
-23.8274
],
[
-46.7761,
-23.8558
],
[
-46.7766,
-23.8927
],
[
-46.8044,
-23.8923
],
[
-46.8109,
-23.9203
],
[
-46.8061,
-23.9396
]
]
],
"type": "Polygon"
},
"properties": {
"codarea": "3550308"
},
"type": "Feature"
}
],
"type": "FeatureCollection"
},
"id": "3550308",
"metadados": {
"area": {
"dimensao": "1522.683",
"unidade": {
"id": "km2",
"nome": "Quilômetros quadrados"
}
},
"centroide": {
"latitude": -23.6504,
"longitude": -46.6482
},
"id": "3550308",
"nivel-geografico": "município",
"nome": "São Paulo",
"regiao-limitrofe": [
{
"latitude": -23.3568,
"longitude": -46.8263
},
{
"latitude": -24.0082,
"longitude": -46.3651
}
]
},
"nivel": "municipios",
"observed_at_ms": 1790047063790,
"source_url": "https://servicodados.ibge.gov.br/api/v4/malhas/municipios/3550308?formato=application%2Fvnd.geo%2Bjson&qualidade=minima"
}Request contract
- Method and path: POST /apis/v1/servicodados-ibge-gov-br/official-statistics/malha
- Availability: enabled
- Request URL template:
https://api.aisa.one/apis/v1/servicodados-ibge-gov-br/official-statistics/malha
{
"operationId": "servicodados-ibge-gov-br.official-statistics.malha",
"method": "POST",
"path": "/apis/v1/servicodados-ibge-gov-br/official-statistics/malha",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"examples": {
"provider": {
"summary": "Official provider example; checked against AIsa request constraints",
"value": {
"id": "3550308",
"nivel": "municipios"
}
}
},
"schema": {
"additionalProperties": true,
"properties": {
"id": {
"description": "IBGE code (35 or SP for a state, 3550308 for a municipality, BR for the country). Pattern: ^[A-Za-z0-9]{1,9}$.",
"type": "string"
},
"intrarregiao": {
"description": "Split the mesh into the localities of this level (e.g. municipio inside a state).\n\nProvider reference: allowed values [\"regiao\", \"UF\", \"mesorregiao\", \"microrregiao\", \"regiao-intermediaria\", \"regiao-imediata\", \"municipio\"].",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body",
"oneOf": [
"regiao",
"UF",
"mesorregiao",
"microrregiao",
"regiao-intermediaria",
"regiao-imediata",
"municipio"
]
}
},
"nivel": {
"description": "nivel\n\nProvider reference: allowed values [\"paises\", \"regioes\", \"estados\", \"mesorregioes\", \"microrregioes\", \"regioes-intermediarias\", \"regioes-imediatas\", \"municipios\"].",
"type": "string"
},
"qualidade": {
"default": "minima",
"description": "qualidade\n\nProvider reference: allowed values [\"minima\", \"intermediaria\", \"maxima\"]; default \"minima\".",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body",
"oneOf": [
"minima",
"intermediaria",
"maxima"
]
}
}
},
"required": [
"id",
"nivel"
],
"type": "object"
}
}
},
"required": true
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
Cost and request rules
Usage-based pricing. Default request estimate: $0.0005 USD. The final charge depends on actual usage. Your account price may differ; use a request quote where supported.Authorizations
Body
application/json
Response
Territorial mesh (boundary) of one locality from /api/v4/malhas/{nivel}/{id} as GeoJSON at a chosen simplification quality (minima | intermediaria | maxima), optionally subdivided into intra-region features (intrarregiao), plus the mesh metadata (/metadados: centroid, bounding box, area).
The response contains the tool result directly.
| Documented field | Provider type | Description |
|---|---|---|
feature_count | number | |
geojson | object | GeoJSON FeatureCollection exactly as the source returns it. |
id | string | |
metadados | object | Mesh metadata as /metadados returns it: id, nome, nivel-geografico, centroide {longitude, latitude}, regiao-limitrofe (bounding corners), area {dimensao, unidade}. |
nivel | string | |
observed_at_ms | number | Unix epoch milliseconds when this program observed the response. |
source_url | string | The exact servicodados.ibge.gov.br request that produced this result. |
These are the provider's documented fields. Field requiredness, nullability and nested object structures are specified only where the descriptions explicitly say so.