---
title: "Import a provider food into the local database (import-on-select)"
method: POST
path: "/api/meals/foods/import"
tags: ["Meals"]
---

# Import a provider food into the local database (import-on-select)

`POST /api/meals/foods/import`

## Request

- Base URL: `https://api.hiyd.ai`
- URL: `https://api.hiyd.ai/api/meals/foods/import`
- Auth: HTTP bearer

Fetches full detail from the external provider, upserts it into food_items (canonical store) and returns the local row with a uuid id. Nutrient columns are totals for serving_size_g in serving_size_unit.

## Request body

- object
  - `external_source` 'fatsecret', required
  - `external_id` string, required

## Response `201`

Food imported

## Other responses

- `400`: Invalid body
- `404`: Provider does not know this id
- `503`: No food data provider configured

---

[API](https://skmtc.dev/hiyd/apis/hiyd-backend-api.md) - [All operations](https://skmtc.dev/hiyd/apis/hiyd-backend-api/llms.txt) - [OpenAPI document](https://skmtc.dev/hiyd/apis/hiyd-backend-api/revisions/23598d347e1b?raw)
