# Knuspr Composition API Documentation

<p><strong>Knuspr Composition API</strong> returns the public nutrition panel per 100 g or 100 ml for a product id from search: energy, fats, carbohydrates, sugars, protein, salt and fiber.</p><p>Set <code>ingredients=true</code> to include the public ingredients text. An optional <code>slug</code> helps locate the page for that text. An unknown id answers 404 and is free. Costs 1 credit per request; failed requests are free.</p>

- **Documentation:** [https://scrappa.co/docs/knuspr-api/knuspr_composition](https://scrappa.co/docs/knuspr-api/knuspr_composition)
- **API group:** Knuspr API
- **Endpoint:** `GET https://scrappa.co/api/knuspr/composition`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | Numeric id from search, for example 1470. |
| `ingredients` | boolean | No | true to include the public ingredients text, default false. |
| `slug` | string | No | Optional product slug, letters digits and dashes only. |

## Example response

```json
{
    "data": {
        "product": "1470",
        "composition": {
            "nutrients": [
                {
                    "name": "energyKCal",
                    "unit": "kcal",
                    "amount": 64
                }
            ],
            "plain_ingredients": "Water, oats."
        },
        "ingredients_requested": true
    },
    "meta": {
        "credits": 1,
        "billable": true,
        "endpoint_family": "composition"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | The id or a value is invalid. This response is not billable. |
| 503 | Upstream Unavailable | The source could not be reached. This response is not billable. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
