Discover/Net API
live

Net APItbca.net.br

Access Brazil's TBCA food composition database via API. Get nutritional profiles, statistical data, household measures, and regional foods for thousands of items.

Endpoint health
verified 3d ago
list_food_types
get_food_statistical_info
get_food_nutritional_profile
get_food_composition_household_measures
search_by_component
9/9 passing latest checkself-healing
Endpoints
9
Updated
26d ago

What is the Net API?

The TBCA API exposes 9 endpoints covering the Tabela Brasileira de Composição de Alimentos, Brazil's national food composition database. You can search thousands of food items by name or code with list_foods, retrieve per-100g nutrient values and household measure breakdowns with get_food_nutritional_profile, and run component-based queries to rank foods by a specific nutrient using search_by_component. Regional biodiversity foods and institutional foods each have dedicated listing endpoints.

Try it
Page number for pagination (1-based).
Search query for food name or code (e.g. 'arroz').
Filter by food group ID from list_food_groups (e.g. '65' for CEREAIS E DERIVADOS). Omitting returns all groups.
Filter by food type ID from list_food_types (e.g. '70' for PREPARO SIMPLES DO ALIMENTO). Omitting returns all types.
api.parse.bot/scraper/f3f96c01-69e8-48d9-8e26-b6765980f9d6/<endpoint>
Ready to send
Fill in the parameters and hit sign in to send to see live response data here.
Call it over HTTPgrab a free API key at signup
curl -X GET 'https://api.parse.bot/scraper/f3f96c01-69e8-48d9-8e26-b6765980f9d6/list_foods?page=1&query=arroz' \
  -H 'X-API-Key: $PARSE_API_KEY'
Python SDK · recommended

Typed, relational, agent-ready

A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.

  • Fully typed · autocompletes
  • Objects link to objects
  • Typed errors & pagination

Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:

uv add parse-sdk
uv run parse init
uv run parse add --marketplace tbca-net-br-api

uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.

"""
TBCA Food Database API Client

Query Brazil's comprehensive food composition database including nutritional profiles,
statistical data, regional foods, and household measures.

Get your API key from: https://parse.bot/settings
"""

import os
import requests
from typing import Optional, Dict, Any


class ParseClient:
    """Client for interacting with the TBCA Food Database API via Parse."""

    def __init__(self, api_key: Optional[str] = None):
        """
        Initialize the Parse API client.

        Args:
            api_key: API key for authentication. If not provided, reads from PARSE_API_KEY env var.
        """
        self.base_url = "https://api.parse.bot"
        self.scraper_id = "f3f96c01-69e8-48d9-8e26-b6765980f9d6"
        self.api_key = api_key or os.getenv("PARSE_API_KEY")

        if not self.api_key:
            raise ValueError(
                "API key not provided. Set PARSE_API_KEY environment variable or pass api_key parameter."
            )

    def _call(
        self, endpoint: str, method: str = "POST", **params
    ) -> Dict[str, Any]:
        """
        Make a request to the Parse API.

        Args:
            endpoint: API endpoint name
            method: HTTP method (GET or POST)
            **params: Query parameters or request body

        Returns:
            Parsed JSON response
        """
        url = f"{self.base_url}/scraper/{self.scraper_id}/{endpoint}"
        headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}

        if method.upper() == "GET":
            response = requests.get(url, headers=headers, params=params)
        else:  # POST
            response = requests.post(url, headers=headers, json=params)

        response.raise_for_status()
        return response.json()

    def list_foods(
        self,
        query: str = "",
        group_id: str = "",
        food_type: str = "",
        page: int = 1,
    ) -> Dict[str, Any]:
        """
        Search for food items with filters and pagination.

        Args:
            query: Search query for food name or code
            group_id: Filter by food group ID
            food_type: Filter by food type ID
            page: Page number for pagination (1-based)

        Returns:
            Dict with foods list and total_pages
        """
        return self._call(
            "list_foods",
            method="GET",
            query=query,
            group_id=group_id,
            food_type=food_type,
            page=page,
        )

    def get_food_nutritional_profile(self, detail_id: str) -> Dict[str, Any]:
        """
        Get the full nutritional profile of a specific food item.

        Args:
            detail_id: The encrypted ID from list_foods results

        Returns:
            Dict with metadata and nutrients array
        """
        return self._call("get_food_nutritional_profile", method="GET", detail_id=detail_id)

    def get_food_statistical_info(self, detail_id: str) -> Dict[str, Any]:
        """
        Get statistical information for a food item.

        Args:
            detail_id: The encrypted ID from list_foods results

        Returns:
            Dict with metadata and statistical_data array
        """
        return self._call("get_food_statistical_info", method="GET", detail_id=detail_id)

    def search_by_component(
        self,
        component: str = "kJ|ENERGIA",
        group_id: str = "65",
        food_type: str = "70",
    ) -> Dict[str, Any]:
        """
        Search foods by nutritional component.

        Args:
            component: Nutrient component in 'unit|TAGNAME' format
            group_id: Food group ID
            food_type: Food type ID

        Returns:
            Dict with results array sorted by nutrient value
        """
        return self._call(
            "search_by_component",
            method="POST",
            component=component,
            group_id=group_id,
            food_type=food_type,
        )

    def get_food_composition_household_measures(self, food_code: str) -> Dict[str, Any]:
        """
        Get household measure definitions for a food code.

        Args:
            food_code: The food code from list_foods results

        Returns:
            Dict with measures containing medidas, sizeInputs, valoresMedidas, unidadesMedidas
        """
        return self._call(
            "get_food_composition_household_measures",
            method="GET",
            food_code=food_code,
        )

    def list_food_groups(self) -> Dict[str, Any]:
        """
        List all available food groups.

        Returns:
            Dict with groups array containing id and name
        """
        return self._call("list_food_groups", method="GET")

    def list_food_types(self) -> Dict[str, Any]:
        """
        List all available food types.

        Returns:
            Dict with types array containing id and name
        """
        return self._call("list_food_types", method="GET")

    def list_biodiversity_regional_foods(self) -> Dict[str, Any]:
        """
        List regional and biodiversity foods from the TBCA database.

        Returns:
            Dict with foods array
        """
        return self._call("list_biodiversity_regional_foods", method="GET")

    def list_institutional_foods(self) -> Dict[str, Any]:
        """
        List institutional foods from the TBCA database.

        Returns:
            Dict with foods array
        """
        return self._call("list_institutional_foods", method="GET")


def main():
    """
    Practical workflow: Find rice products, analyze their nutrition, and compare energy content.
    """
    client = ParseClient()

    print("=" * 70)
    print("TBCA Food Database - Nutritional Analysis Workflow")
    print("=" * 70)

    # Step 1: Get food groups to understand the database structure
    print("\n[1] Fetching available food groups...")
    groups_response = client.list_foods(query="arroz", page=1)
    foods = groups_response.get("data", {}).get("foods", [])
    
    if not foods:
        print("    No foods found. Please check your API key and try again.")
        return

    print(f"    ✓ Found {len(foods)} rice products in the database")

    # Step 2: Analyze each rice product's nutritional profile
    print("\n[2] Analyzing nutritional profiles for each rice product...")
    
    rice_analysis = []
    for idx, food in enumerate(foods[:3], 1):  # Analyze first 3 rice products
        food_name = food.get("name", "Unknown")
        food_code = food.get("code", "")
        detail_id = food.get("detail_id", "")

        print(f"\n    Rice Product {idx}: {food_name}")
        print(f"    Code: {food_code}")

        # Get nutritional profile
        if detail_id:
            try:
                nutrition = client.get_food_nutritional_profile(detail_id)
                nutrients = nutrition.get("data", {}).get("nutrients", [])

                # Extract key nutrients
                nutrition_data = {}
                for nutrient in nutrients:
                    component = nutrient.get("component", "")
                    value = nutrient.get("value_per_100g", "N/A")
                    units = nutrient.get("units", "")

                    if component in ["Energia", "Proteína", "Carboidrato", "Lipídeos"]:
                        nutrition_data[component] = f"{value} {units}"

                # Display nutrients
                for nutrient_name, nutrient_value in nutrition_data.items():
                    print(f"      • {nutrient_name}: {nutrient_value}")

                rice_analysis.append({
                    "name": food_name,
                    "code": food_code,
                    "detail_id": detail_id,
                    "nutrients": nutrition_data,
                })

            except Exception as e:
                print(f"      ⚠ Could not fetch profile: {str(e)}")

        # Get household measures
        if food_code:
            try:
                measures = client.get_food_composition_household_measures(food_code)
                medidas_list = measures.get("data", {}).get("medidas", [])
                valores = measures.get("data", {}).get("valoresMedidas", [])

                if medidas_list:
                    print(f"      Household measures:")
                    for medida, valor in zip(medidas_list[:2], valores[:2]):
                        print(f"        - {medida}: {valor}g")

            except Exception as e:
                print(f"      ⚠ Could not fetch measures: {str(e)}")

    # Step 3: Search for high-energy cereals
    print("\n[3] Searching for cereals by energy content...")
    energy_search = client.search_by_component(
        component="kJ|ENERGIA", group_id="65", food_type="70"
    )
    high_energy_foods = energy_search.get("data", {}).get("results", [])

    print(f"    ✓ Found {len(high_energy_foods)} cereals sorted by energy")
    print("\n    Top 3 highest energy cereals (per 100g):")
    for idx, food in enumerate(high_energy_foods[:3], 1):
        name = food.get("name", "Unknown")
        energy = food.get("value_per_100g", "N/A")
        units = food.get("units", "")
        print(f"      {idx}. {name}")
        print(f"         Energy: {energy} {units}")

    # Step 4: Get statistical information for comparison
    if rice_analysis:
        print(f"\n[4] Fetching statistical data for detailed analysis...")
        first_rice = rice_analysis[0]

        try:
            stats = client.get_food_statistical_info(first_rice["detail_id"])
            statistical_data = stats.get("data", {}).get("statistical_data", [])

            print(f"    Statistical analysis for: {first_rice['name']}")
            print("    Nutrient reliability metrics:")

            for stat in statistical_data[:3]:
                component = stat.get("componente", "")
                data_type = stat.get("tipo_de_dados", "")
                std_dev = stat.get("desvio_padrão", "-")

                if component:
                    print(f"      • {component}")
                    print(f"        Type: {data_type}, Std Dev: {std_dev}")

        except Exception as e:
            print(f"    ⚠ Could not fetch statistical data: {str(e)}")

    print("\n" + "=" * 70)
    print("✓ Nutritional analysis workflow completed successfully!")
    print("=" * 70)


if __name__ == "__main__":
    main()
All endpoints · 9 totalmissing one? ·

Search for food items with filters and pagination. Returns a paginated list of foods matching the query, group, and type filters. Use list_food_groups and list_food_types to discover valid filter IDs. Paginates via integer page counter.

Input
ParamTypeDescription
pageintegerPage number for pagination (1-based).
querystringSearch query for food name or code (e.g. 'arroz').
group_idstringFilter by food group ID from list_food_groups (e.g. '65' for CEREAIS E DERIVADOS). Omitting returns all groups.
food_typestringFilter by food type ID from list_food_types (e.g. '70' for PREPARO SIMPLES DO ALIMENTO). Omitting returns all types.
Response
{
  "type": "object",
  "fields": {
    "foods": "array of food objects each containing code, name, scientific_name, group, brand, and detail_id",
    "total_pages": "integer total number of pages available"
  },
  "sample": {
    "data": {
      "foods": [
        {
          "code": "BRC0012A",
          "name": "Arroz, creme, cozido, s/ tempero, Brasil",
          "brand": "",
          "group": "Cereais e derivados",
          "detail_id": "n0REd3kv7e86D%2BViXWYUnQ%3D%3D=qVFrIUJyMsGsU0SmbrckEQ%3D%3D",
          "scientific_name": "Orysa sativa L."
        }
      ],
      "total_pages": 1
    },
    "status": "success"
  }
}

About the Net API

Searching and Filtering Foods

The list_foods endpoint accepts a free-text query (food name or code such as arroz), a group_id from list_food_groups, and a food_type from list_food_types. Results are paginated and each item in the foods array includes code, name, scientific_name, group, brand, and a detail_id used to fetch deeper data. list_food_groups and list_food_types return plain id/name arrays that act as the filter vocabulary for both list_foods and search_by_component.

Nutritional Profiles and Statistical Data

get_food_nutritional_profile takes a detail_id and returns a metadata object (código, grupo, tipo_de_alimento, nome_científico, descrição, name_en, name_es) plus a nutrients array. Each nutrient row has component, units, value_per_100g, and dynamic columns for each household measure defined for that food. The columns vary per item, so get_food_composition_household_measures (which accepts a food_code) is useful for understanding the measure names and weights before parsing those dynamic columns.

get_food_statistical_info surfaces the analytical depth of the database: for each nutrient component it returns desvio_padrão (standard deviation), valor_mínimo, valor_máximo, número_de_dados (data point count), plus a references field and a flag distinguishing analytical from calculated values. This is relevant for research applications where measurement uncertainty matters.

Specialty Food Lists and Component Search

list_biodiversity_regional_foods and list_institutional_foods expose two subsets of the database that are not reachable through list_foods. Regional/biodiversity foods use a cod_produto=XXXC format for detail_id, while institutional foods use the standard encrypted format with BRD-prefixed codes. search_by_component accepts a component in unit|TAGNAME pipe-delimited format (e.g. kJ|ENERGIA), an optional group_id, and an optional food_type, returning foods ranked by that nutrient's value_per_100g.

Reliability & maintenanceVerified

The Net API is a managed, monitored endpoint for tbca.net.br — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when tbca.net.br changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.

This isn't an official tbca.net.br API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.

Last verified
3d ago
Latest check
9/9 endpoints passing
Maintenance
Monitored & self-healing
Will this API break when the source site changes?+
It's built not to. Every endpoint is health-checked on a schedule with automated test probes. When the source site changes and a check fails, the API is automatically queued for repair and re-verified — that's the self-healing layer. Each API page shows when its endpoints were last verified. And because marketplace APIs are shared, any fix reaches everyone using it.
Is this an official API from the source site?+
No — Parse APIs are independent, managed REST wrappers over publicly available data. That is the point: where a site has no official API (or only a limited one), Parse gives you a maintained, monitored endpoint for that data and keeps it working as the site changes — so you get a stable contract over a source that never promised one.
Can I fix or extend this API myself if I need a new endpoint or field?+
Yes — and you don't have to wait on us. This API was generated by the Parse agent, which stays attached. Describe the change in plain English ("add an endpoint that returns reviews", "fix the price field") in the revise box on the API page or via the revise_api MCP tool, and the agent rebuilds it against the live site in minutes. Contributing the change back to the public API is free.
What happens if I call an endpoint that has an issue?+
Errors are machine-readable: a bad call returns a clean status with the list of available endpoints and a repair hint, so an agent (or you) can recover or trigger a fix instead of failing silently. Confirmed failures feed the automatic repair queue.
Common use cases
  • Build a Brazilian diet tracker that displays per-100g and household-portion nutrient values for thousands of foods.
  • Rank foods within a specific group (e.g. cereals) by energy or protein content using search_by_component.
  • Research regional and biodiversity foods native to Brazil via list_biodiversity_regional_foods for food security studies.
  • Generate nutrient comparison tables for institutional meal planning using list_institutional_foods and nutritional profiles.
  • Display standard deviation and data-point counts from get_food_statistical_info in scientific nutrition publications.
  • Build a household-measure converter by combining get_food_composition_household_measures with nutrient profile data.
  • Filter and export food composition data by group and type for academic food science databases.
Pricing & limitsSee full pricing →
TierPriceCredits/monthRate limit
Free$0/mo1005 req/min
Hobby$30/mo1,00020 req/min
Developer$100/mo5,000100 req/min

One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.

Frequently asked questions
Does TBCA have an official developer API?+
TBCA (tbca.net.br) does not publish a documented public developer API. The data is available through the TBCA website maintained by UNICAMP, but there is no official REST API with documentation or keys for third-party use.
How does the `search_by_component` endpoint work, and what format does the `component` parameter require?+
You submit a POST request with a component value in unit|TAGNAME pipe-delimited format — for example kJ|ENERGIA. The tagname and unit must match identifiers used in the TBCA database; kJ|ENERGIA is a verified working value. You can optionally narrow results with group_id and food_type. The response returns foods sorted by value_per_100g for that nutrient, each with a detail_id you can pass to get_food_nutritional_profile.
Why do household measure columns in nutritional profiles vary between foods?+
Each food in TBCA can have a different set of household measures (e.g. 'colher de sopa', 'xícara', 'fatia'). The get_food_nutritional_profile response reflects these as dynamic columns on each nutrient row. To know the measure names and their gram weights before parsing those columns, call get_food_composition_household_measures with the food's code field first.
Does the API expose preparation method details or recipe-level ingredient breakdowns?+
Not currently. The API covers food-level nutritional profiles, statistical metadata, household measures, and component-based search, but does not expose recipe decomposition or step-by-step preparation data. You can fork this API on Parse and revise it to add an endpoint targeting any TBCA recipe or preparation detail pages.
Are there any quirks with `detail_id` values for regional foods versus standard foods?+
Yes. Foods returned by list_biodiversity_regional_foods use a cod_produto=XXXC string as their detail_id, which is a different format from the encrypted IDs returned by list_foods and list_institutional_foods. If you are iterating across multiple listing endpoints, you need to handle both formats when passing detail_id to profile or statistical endpoints.
Page content last updated . Spec covers 9 endpoints from tbca.net.br.
Related APIs in Food DiningSee all →
fdc.nal.usda.gov API
Search across thousands of foods to get detailed nutritional information, serving sizes, and ingredient data from USDA's comprehensive food database. Find nutrition facts for branded products, legacy foods, and foundation foods all in one place.
beveragetradenetwork.com API
Search beverage industry brands, discover buying leads and supplier contacts, compare membership pricing, and browse a comprehensive company directory to grow your beverage business network. Access real-time competition results from beverage industry rankings to stay informed on market standings.
portalcompraspublicas.com.br API
Search and access detailed information about public tenders, bids, and procurement documents from Brazilian municipalities and states. Retrieve tender items, clarification logs, winner details, and all related documentation to monitor and analyze public purchasing activity across Brazil.
continente.pt API
Browse and retrieve product data from Continente.pt, Portugal's leading supermarket chain. Search by keyword, browse categories, fetch full product details including nutritional info, and access current promotions and new arrivals.
pncp.gov.br API
Search and retrieve detailed information about Brazil's public procurement contracts, including bidding results, price registries, and annual contracting plans from the official PNCP portal. Monitor government procurement activities by looking up specific contracts, procurement processes, and procurement records all in one place.
tasty.co API
Search and discover Tasty.co recipes by ingredients or cuisine, then access detailed cooking instructions, ingredient lists, and video guides for each dish. Browse popular recipes and get pro cooking tips to perfect your meals.
portaldecompraspublicas.com.br API
Search and retrieve Brazilian public procurement processes from Portal de Compras Públicas. Access tender listings with filters for state, municipality, modality, date range, and status, and retrieve full process details including timelines, buyer information, and official notice data.
feedingamerica.org API
Find nearby food banks by ZIP code or state, view detailed organizational profiles and leadership information, and access hunger statistics and news about food insecurity across the nation. Discover ways to take action and support local food banks through giving options and impact metrics.