# ClipParse API ClipParse extracts a structured recipe from a TikTok or Instagram post. Send a post URL to `POST /v1/extract` and get back ingredients with quantities and units, ordered steps, timing, and yield. ## Quickstart Get a free API key at [clipparse.com/get-free-key](https://clipparse.com/get-free-key): it takes seconds and doesn't require a credit card. Then send a post URL: ```bash curl https://api.clipparse.com/v1/extract \ -H "X-API-Key: $CLIPPARSE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url": "https://www.tiktok.com/@chef/video/7300000000000000000"}' ``` ## Base URL `https://api.clipparse.com` ## SDKs For mobile apps, the ClipParse SDKs are the recommended way to call this API: they wrap it in a native client, and extraction is more reliable through them. - **iOS**: the [ClipParse iOS SDK](https://github.com/clipparse/clipparse-ios-sdk), in Swift. - **Android**: the [ClipParse Android SDK](https://github.com/clipparse/clipparse-android-sdk), in Kotlin. ## Authentication Send your API key in the `X-API-Key` header. [Get a free key](https://clipparse.com/get-free-key). ## Usage allowance Allowances are counted in credits. A successful extraction uses 1 credit when the recipe was extracted from the caption or a photo post, and 4 credits when it was extracted from what's said in the video. Errors and `no_recipe` outcomes don't use any credits. Allowances renew monthly, on the day of the month your plan started. - **Free**: 100 credits a month. Once spent, requests return HTTP 429 `quota_exceeded` until the renewal date given in `resetsAt`. - **Paid**: larger allowances. Past yours, requests keep working and each extra credit is billed as overage. If your plan is set to pause at the allowance instead, requests return HTTP 429 `quota_exceeded` until the renewal date given in `resetsAt`. See [pricing](https://clipparse.com/pricing). Every authenticated response, success or error, reports your allowance in headers, so you can track it without a separate call: - `X-Quota-Limit`: your allowance for the current period. - `X-Quota-Used`: how much of it is used, this request included. Past the allowance it keeps counting, so it shows your overage. - `X-Quota-Remaining`: what is left, never below 0. - `X-Quota-Reset`: when the allowance renews (ISO 8601 UTC, the same value as `resetsAt`). Responses that reach an outcome also carry `X-Credits-Used`: the credits this request used (`0`, `1` or `4`), so `X-Quota-Used` goes up only on a `success`. ## Rate limits Every key also has per-minute and per-day request limits, well above normal use. Exceeding one returns HTTP 429 `rate_limited`: retry after the `Retry-After` seconds. ## Responses Every response has a `status` field, mirrored by the HTTP status code: - **`success`** (200): the `recipe` is present. - **`no_recipe`** (200): the post holds no usable recipe (`no_recipe_found` or `multiple_recipes_detected`). Not worth retrying. - **`error`**: `platform_unsupported` (400), `post_unavailable` (404: the post doesn't exist, was deleted, or isn't public), or `internal_error` (500, retry with backoff). Errors about your API key, your allowance or the rate limits (HTTP 401, 403 and 429) also carry a `message`: what happened and what to do next, in plain language. Branch on `code`; the wording of `message` can change. ### Example (HTTP 200) ```json { "status": "success", "recipe": { "title": "Easy Pancakes", "language": "en", "sourceUrl": "https://www.tiktok.com/@chef/video/7300000000000000000", "thumbnailUrl": "https://p16-sign.tiktokcdn.com/example/thumb.jpg", "servings": 4, "prepTimeMinutes": 5, "cookTimeMinutes": 15, "ingredients": [ { "name": "all-purpose flour", "prep": null, "quantity": 150, "quantityMin": null, "quantityMax": null, "unit": "g", "raw": "150g flour", "section": null }, { "name": "milk", "prep": null, "quantity": 250, "quantityMin": null, "quantityMax": null, "unit": "ml", "raw": "250ml milk", "section": null }, { "name": "eggs", "prep": null, "quantity": 2, "quantityMin": null, "quantityMax": null, "unit": "each", "raw": "2 eggs", "section": null } ], "steps": [ { "text": "Whisk the flour, milk, and eggs into a smooth batter.", "durationMinutes": null, "section": null }, { "text": "Cook ladlefuls in a hot buttered pan until golden on both sides.", "durationMinutes": 15, "section": null } ] } } ``` ## Request tracing Every response carries an `X-Request-Id` header; quote it in support requests. Send your own UUID v4 in that header to have it echoed back. ## Endpoints ### POST /v1/extract **Extract a recipe from a post URL** Extracts a canonical recipe from a TikTok or Instagram post. Provide the post `url`. The response has one of three `status` shapes. `success` carries the full `recipe`. `no_recipe` (HTTP 200) means the post held no usable recipe, or held several. `error` is `platform_unsupported` (HTTP 400), `post_unavailable` (HTTP 404: the post doesn't exist, was deleted, or isn't public) or `internal_error` (HTTP 500); of these only 500 is worth retrying, with backoff. Authentication: an API key in the `X-API-Key` header. Request body (`application/json`): `ExtractRequest` Responses: - **200**: Extraction completed. `success` carries the recipe; `no_recipe` reports that the post held no usable recipe. - `application/json`: `SuccessResponse` or `NoRecipeResponse` - **400**: URL is not on a supported platform (`platform_unsupported`). - `application/json`: `PlatformUnsupportedResponse` - **401**: `unauthorized`: no `X-API-Key` header. `invalid_key`: the key isn't recognized. Not retryable. - `application/json`: `AuthError` - **403**: `key_revoked`: the API key has been revoked. Not retryable. - `application/json`: `AuthError` - **404**: The post doesn't exist, was deleted, or isn't publicly viewable (`post_unavailable`). Not retryable. - `application/json`: `PostUnavailableResponse` - **429**: `rate_limited`: retry after `Retry-After` seconds. `quota_exceeded`: the allowance is spent until `resetsAt`. - `application/json`: `AuthError` - **500**: Transient server-side failure. Retry with backoff. - `application/json`: `InternalErrorResponse` - **422**: Validation Error - `application/json`: `HTTPValidationError` Examples: 200 `application/json`, Recipe extracted: ```json { "status": "success", "recipe": { "title": "One-Pan Garlic Butter Pasta", "language": "en", "sourceUrl": "https://www.tiktok.com/@chef/video/7300000000000000000", "thumbnailUrl": "https://p16-sign.tiktokcdn.com/example/thumb.jpg", "servings": 2, "prepTimeMinutes": 5, "cookTimeMinutes": 15, "ingredients": [ { "name": "spaghetti", "quantity": 200, "unit": "g", "raw": "200g spaghetti" }, { "name": "garlic cloves", "prep": "minced", "quantity": 3, "unit": "each", "raw": "3 cloves garlic, minced" }, { "name": "butter", "quantity": 2.5, "quantityMin": 2, "quantityMax": 3, "unit": "tbsp", "raw": "2-3 tbsp butter" }, { "name": "salt", "raw": "salt to taste" } ], "steps": [ { "text": "Boil the spaghetti until al dente.", "durationMinutes": 10 }, { "text": "Melt the butter, cook the garlic until fragrant, then toss with the drained pasta.", "durationMinutes": 5 } ] } } ``` 200 `application/json`, No recipe in the post: ```json { "status": "no_recipe", "code": "no_recipe_found" } ``` 200 `application/json`, Multiple recipes in one post: ```json { "status": "no_recipe", "code": "multiple_recipes_detected" } ``` 401 `application/json`, No API key: ```json { "status": "error", "code": "unauthorized", "message": "No API key. Send your key in the X-API-Key header. Get a free key at https://clipparse.com/get-free-key" } ``` 401 `application/json`, Key not recognized: ```json { "status": "error", "code": "invalid_key", "message": "API key not recognized. Check that the X-API-Key header holds the full key. Get a free key at https://clipparse.com/get-free-key" } ``` 403 `application/json`, Key revoked: ```json { "status": "error", "code": "key_revoked", "message": "This API key has been revoked. Contact contact@clipparse.com" } ``` 429 `application/json`, Too many requests: ```json { "status": "error", "code": "rate_limited", "message": "Too many requests. Retry after the number of seconds in the Retry-After header." } ``` 429 `application/json`, Free allowance spent: ```json { "status": "error", "code": "quota_exceeded", "message": "This key's allowance is spent until the time in resetsAt. See plans at https://clipparse.com/pricing", "resetsAt": "2026-11-14T00:00:00Z", "upgradeUrl": "https://clipparse.com/pricing" } ``` ### POST /v1/extract/schema-org **Extract a recipe as schema.org/Recipe JSON-LD** Extracts a recipe from a TikTok or Instagram post and returns it as a schema.org/Recipe JSON-LD document. It takes the same request as `/v1/extract` and shares its API key and allowance. On `success` the body is a bare `schema.org/Recipe` object served as `application/ld+json`, so it drops straight into a schema.org importer with no unwrapping. Non-success outcomes are unchanged from `/v1/extract`: `no_recipe` (HTTP 200), `platform_unsupported` (HTTP 400), `post_unavailable` (HTTP 404), and `internal_error` (HTTP 500), each a `{status, code}` JSON body. The response `Content-Type` alone discriminates a success (`application/ld+json`) from a `no_recipe` verdict (`application/json`). Authentication: an API key in the `X-API-Key` header. Request body (`application/json`): `ExtractRequest` Responses: - **200**: Extraction completed. On `success` the body is a bare `schema.org/Recipe` JSON-LD object (`application/ld+json`). A `no_recipe` verdict passes through unchanged from `/v1/extract`: `application/json` with a `{status, code}` body. Discriminate on the `Content-Type`. - `application/json`: any JSON value - `application/ld+json`: object - **400**: URL is not on a supported platform (`platform_unsupported`). - `application/json`: `PlatformUnsupportedResponse` - **401**: `unauthorized`: no `X-API-Key` header. `invalid_key`: the key isn't recognized. Not retryable. - `application/json`: `AuthError` - **403**: `key_revoked`: the API key has been revoked. Not retryable. - `application/json`: `AuthError` - **404**: The post doesn't exist, was deleted, or isn't publicly viewable (`post_unavailable`). Not retryable. - `application/json`: `PostUnavailableResponse` - **429**: `rate_limited`: retry after `Retry-After` seconds. `quota_exceeded`: the allowance is spent until `resetsAt`. - `application/json`: `AuthError` - **500**: Transient server-side failure. Retry with backoff. - `application/json`: `InternalErrorResponse` - **422**: Validation Error - `application/json`: `HTTPValidationError` Examples: 200 `application/json`, No recipe in the post: ```json { "status": "no_recipe", "code": "no_recipe_found" } ``` 200 `application/json`, Multiple recipes in one post: ```json { "status": "no_recipe", "code": "multiple_recipes_detected" } ``` 200 `application/ld+json`: ```json { "@context": "https://schema.org", "@type": "Recipe", "name": "One-Pan Garlic Butter Pasta", "inLanguage": "en", "mainEntityOfPage": "https://www.tiktok.com/@chef/video/7300000000000000000", "image": "https://p16-sign.tiktokcdn.com/example/thumb.jpg", "recipeYield": "2", "prepTime": "PT5M", "cookTime": "PT15M", "recipeIngredient": [ "200g spaghetti", "3 cloves garlic, minced", "2-3 tbsp butter", "salt to taste" ], "recipeInstructions": [ { "@type": "HowToStep", "text": "Boil the spaghetti until al dente." }, { "@type": "HowToStep", "text": "Melt the butter, cook the garlic until fragrant, then toss with the drained pasta." } ] } ``` 401 `application/json`, No API key: ```json { "status": "error", "code": "unauthorized", "message": "No API key. Send your key in the X-API-Key header. Get a free key at https://clipparse.com/get-free-key" } ``` 401 `application/json`, Key not recognized: ```json { "status": "error", "code": "invalid_key", "message": "API key not recognized. Check that the X-API-Key header holds the full key. Get a free key at https://clipparse.com/get-free-key" } ``` 403 `application/json`, Key revoked: ```json { "status": "error", "code": "key_revoked", "message": "This API key has been revoked. Contact contact@clipparse.com" } ``` 429 `application/json`, Too many requests: ```json { "status": "error", "code": "rate_limited", "message": "Too many requests. Retry after the number of seconds in the Retry-After header." } ``` 429 `application/json`, Free allowance spent: ```json { "status": "error", "code": "quota_exceeded", "message": "This key's allowance is spent until the time in resetsAt. See plans at https://clipparse.com/pricing", "resetsAt": "2026-11-14T00:00:00Z", "upgradeUrl": "https://clipparse.com/pricing" } ``` ## Schemas ### AuthError Error body for a missing, invalid or revoked API key, or a spent allowance or rate limit. Same `{status, code}` shape as the other errors. | Field | Type | Required | Description | | --- | --- | --- | --- | | `status` | `error` | no | | | `code` | one of `unauthorized`, `invalid_key`, `key_revoked`, `quota_exceeded`, `rate_limited` | yes | `unauthorized` or `invalid_key` (401), `key_revoked` (403), `rate_limited` or `quota_exceeded` (429). | | `message` | string or null | no | What happened and what to do next, in plain language, for people and AI agents to read. Branch on `code`, not on this text: its wording can change. | | `resetsAt` | string or null | no | `quota_exceeded` only: when the allowance renews (UTC). | | `upgradeUrl` | string or null | no | `quota_exceeded` only: where to upgrade. | ### ExtractRequest | Field | Type | Required | Description | | --- | --- | --- | --- | | `url` | string (uri) | yes | Public URL of the TikTok or Instagram post to extract. | ### HTTPValidationError | Field | Type | Required | Description | | --- | --- | --- | --- | | `detail` | array of `ValidationError` | no | | ### Ingredient | Field | Type | Required | Description | | --- | --- | --- | --- | | `name` | string | yes | Ingredient name, normalized. | | `prep` | string or null | yes | Preparation note when the post gives one, such as "finely chopped". Null when none is stated. | | `quantity` | number or null | yes | Amount expressed in `unit`. For a range such as "3-4 tbsp", the midpoint (3.5), with the bounds in `quantityMin` and `quantityMax`. Null when the post gives no amount. | | `quantityMin` | number or null | yes | Low end of the range when the post gives one, such as 3 for "3-4 tbsp", in `unit`. Null for a single amount. | | `quantityMax` | number or null | yes | High end of the range when the post gives one, such as 4 for "3-4 tbsp", in `unit`. Null for a single amount. | | `unit` | `Unit` or null | yes | Measurement unit for `quantity`. A measurement value (`g`, `ml`, `cup`, and so on) means `quantity` counts that unit. `each` means the ingredient is counted rather than measured, for example 4 eggs. Null means the post gave no unit information, which usually pairs with a null `quantity`. | | `raw` | string | yes | The ingredient exactly as written in the post, before normalization. | | `section` | string or null | yes | Grouping label when the recipe splits ingredients into sections, such as "For the sauce". Null when ungrouped. | ### InternalErrorResponse | Field | Type | Required | Description | | --- | --- | --- | --- | | `status` | `error` | no | Outcome discriminator. Always `error` for this response. | | `code` | `internal_error` | no | A transient server-side failure. Retry with backoff. | ### NoRecipeResponse | Field | Type | Required | Description | | --- | --- | --- | --- | | `status` | `no_recipe` | no | Outcome discriminator. `no_recipe` means the request succeeded but produced no recipe. Returned with HTTP 200; not retryable. | | `code` | one of `no_recipe_found`, `multiple_recipes_detected` | yes | Reason no recipe was returned. `no_recipe_found`: the post contained no recipe. `multiple_recipes_detected`: it contained more than one recipe, which this version does not split. | ### PlatformUnsupportedResponse | Field | Type | Required | Description | | --- | --- | --- | --- | | `status` | `error` | no | Outcome discriminator. Always `error` for this response. | | `code` | `platform_unsupported` | no | The URL is not a TikTok or Instagram post. | ### PostUnavailableResponse | Field | Type | Required | Description | | --- | --- | --- | --- | | `status` | `error` | no | Outcome discriminator. Always `error` for this response. | | `code` | `post_unavailable` | no | The post doesn't exist, was deleted, or isn't publicly viewable. Retrying the same URL won't help. | ### Recipe | Field | Type | Required | Description | | --- | --- | --- | --- | | `title` | string | yes | Recipe title. | | `language` | string | yes | Language of the recipe content as a short code, for example "en". | | `sourceUrl` | string | yes | URL of the source post. | | `thumbnailUrl` | string or null | yes | URL of the post's thumbnail image when available. Null otherwise. | | `servings` | number or null | yes | Number of servings when stated. Null when not given. | | `prepTimeMinutes` | integer or null | yes | Preparation time in minutes when stated. Null when not given. | | `cookTimeMinutes` | integer or null | yes | Cooking time in minutes when stated. Null when not given. | | `ingredients` | array of `Ingredient` | yes | Ingredients, in the order the post lists them. | | `steps` | array of `Step` | yes | Steps, in order. | ### Step | Field | Type | Required | Description | | --- | --- | --- | --- | | `text` | string | yes | The instruction text for this step. | | `durationMinutes` | integer or null | yes | Duration of this step in minutes when stated. Null when not given. | | `section` | string or null | yes | Grouping label when the recipe splits steps into sections. Null when ungrouped. | ### SuccessResponse | Field | Type | Required | Description | | --- | --- | --- | --- | | `status` | `success` | no | Outcome discriminator. `success` means a recipe was extracted. | | `recipe` | `Recipe` | yes | The extracted recipe. | ### Unit One of: `g`, `kg`, `ml`, `l`, `tsp`, `tbsp`, `cup`, `pt`, `qt`, `gal`, `oz`, `lb`, `pinch`, `each`. ### ValidationError | Field | Type | Required | Description | | --- | --- | --- | --- | | `loc` | array of string or integer | yes | | | `msg` | string | yes | | | `type` | string | yes | | | `input` | any JSON value | no | | | `ctx` | object | no | | ## Guide: How to import recipes from TikTok and Instagram links in an iOS app Web page: https://docs.clipparse.com/guides/import-recipes-from-tiktok-instagram-ios To import a recipe from a TikTok or Instagram post into an iOS app, pass the post's link to the ClipParse iOS SDK. It returns the recipe as structured data: the title, ingredients with quantities and units, ordered steps, timings and servings. You need a ClipParse API key: get a free one at [clipparse.com/get-free-key](https://clipparse.com/get-free-key). It takes seconds and doesn't require a credit card. For a complete app built from this guide's code, see [tiktok-instagram-recipe-import-swiftui](https://github.com/clipparse/tiktok-instagram-recipe-import-swiftui) on GitHub: a SwiftUI app with a share extension. ### Requirements - iOS 15 or later, or macOS 12 or later - Swift 5.9 or later, Xcode 15 or later - A ClipParse API key ### Add the SDK In Xcode, choose **File → Add Package Dependencies…** and enter: ```text https://github.com/clipparse/clipparse-ios-sdk ``` Or add it to your `Package.swift`: ```swift dependencies: [ .package(url: "https://github.com/clipparse/clipparse-ios-sdk", from: "1.5.0") ] ``` ### Extract a recipe from a link Create a client with your API key, then call `extract` with the post's URL. It returns one of two outcomes: `.recipe` with the recipe, or `.noRecipe` when the post holds no usable recipe. A post with no recipe is an expected outcome, not an error. ```swift import ClipParse let client = ClipParseClient(apiKey: "") let url = URL(string: "https://www.tiktok.com/@somecreator/video/1234567890")! switch try await client.extract(url) { case .recipe(let recipe): print(recipe.title) for ingredient in recipe.ingredients { print(ingredient.raw) } for step in recipe.steps { print(step.text) } case .noRecipe(let reason): print("No recipe found:", reason) @unknown default: print("We couldn't import a recipe from this post.") } ``` `.noRecipe` carries a reason: `.noRecipeFound` when the post holds no recipe, or `.multipleRecipesDetected` when it holds several recipes in one post. Keep the `@unknown default` branch: later versions of the SDK can add outcomes. ### Wire it into a SwiftUI screen A small view model that imports a link and keeps either the recipe or a message to show the user: ```swift import ClipParse import SwiftUI @MainActor final class RecipeImportModel: ObservableObject { @Published var recipe: ClipParse.Recipe? @Published var message: String? private let client = ClipParseClient(apiKey: "") func importRecipe(from link: String) async { recipe = nil message = nil guard let url = URL(string: link.trimmingCharacters(in: .whitespacesAndNewlines)) else { message = "That doesn't look like a link." return } do { switch try await client.extract(url) { case .recipe(let found): recipe = found case .noRecipe(.multipleRecipesDetected): message = "This post has more than one recipe." case .noRecipe: message = "We couldn't find a recipe in this post." @unknown default: message = "We couldn't import a recipe from this post." } } catch { message = importErrorMessage(for: error) } } } ``` ### Handle errors Failures throw a typed `ClipParseError`. Turn them into messages for the user: ```swift func importErrorMessage(for error: Error) -> String { switch error { case ClipParseError.unsupportedPlatform: return "Only TikTok and Instagram links are supported." case ClipParseError.postUnavailable: return "This post was deleted, is private, or doesn't exist." case ClipParseError.unauthorized, ClipParseError.invalidAPIKey, ClipParseError.apiKeyRevoked: print("ClipParse API key error:", error) return "Recipe import isn't available right now." case ClipParseError.quotaExceeded, ClipParseError.rateLimited: return "Too many imports right now. Try again later." case ClipParseError.network: return "Check your connection and try again." default: return "Something went wrong. Please try again." } } ``` The API key errors (`unauthorized`, `invalidAPIKey`, `apiKeyRevoked`) are yours to fix, not the user's: log them so you notice. `rateLimited` and `quotaExceeded` carry a `retryAfter` interval in seconds; `quotaExceeded` gives `nil` when the allowance doesn't renew. Errors where `isRetryable` is true, such as a dropped connection, are safe to retry. ### Use the recipe's fields The recipe's fields: - `title`, and `language`: a short code such as `"en"`. - `sourceUrl`: the post the recipe came from. - `thumbnailUrl`: the post's thumbnail, when there is one. The URL expires, so download the image if you keep the recipe. - `servings`, `prepTimeMinutes` and `cookTimeMinutes`, when the post states them. - `ingredients`, in the order the post lists them. Each has a `name`, a `quantity` and a `unit`, the `prep` note (such as "finely chopped"), the `section` it belongs to (such as "For the sauce"), and `raw`: the line exactly as the post wrote it. - `steps`, in order. Each has its `text`, a `durationMinutes` when stated, and a `section`. Anything the post doesn't state is `nil`. For a range such as "2-3 tbsp", `quantity` is the midpoint and `quantityMin` and `quantityMax` hold the ends. `unit` is `.each` for counted ingredients such as 3 eggs. To show an amount, use the range when there is one: ```swift func amountText(_ ingredient: ClipParse.Ingredient) -> String? { guard let quantity = ingredient.quantity else { return nil } var amount = quantity.formatted() if let low = ingredient.quantityMin, let high = ingredient.quantityMax { amount = "\(low.formatted())–\(high.formatted())" } switch ingredient.unit { case nil, .each: return amount case let unit?: return "\(amount) \(unit.rawValue)" } } ``` ### Accept links from the share sheet People find recipes in the TikTok and Instagram apps, so the smoothest way in is the share sheet: the user taps Share on a post and picks your app. Add a Share Extension target, set `NSExtensionActivationSupportsWebURLWithMaxCount` to `1` in its `NSExtensionActivationRule`, and read the shared URL: ```swift import UniformTypeIdentifiers let provider = (extensionContext?.inputItems.first as? NSExtensionItem)? .attachments? .first { $0.hasItemConformingToTypeIdentifier(UTType.url.identifier) } provider?.loadItem(forTypeIdentifier: UTType.url.identifier) { item, _ in guard let url = item as? URL else { return } handleSharedLink(url) } ``` `handleSharedLink` is yours: pass the URL to the same import code, in the extension or in your app. ### Next steps - The [example app](https://github.com/clipparse/tiktok-instagram-recipe-import-swiftui) is this guide's code as a complete app, ready to run. - The [API reference](https://docs.clipparse.com/) lists every field and outcome. - The [ClipParse iOS SDK](https://github.com/clipparse/clipparse-ios-sdk) repository has the changelog. - [Pricing](https://clipparse.com/pricing) covers what each import costs and the plans past the free tier. ## Guide: How to import recipes from TikTok and Instagram links in an Android app Web page: https://docs.clipparse.com/guides/import-recipes-from-tiktok-instagram-android To import a recipe from a TikTok or Instagram post into an Android app, pass the post's link to the ClipParse Android SDK. It returns the recipe as structured data: the title, ingredients with quantities and units, ordered steps, timings and servings. You need a ClipParse API key: get a free one at [clipparse.com/get-free-key](https://clipparse.com/get-free-key). It takes seconds and doesn't require a credit card. For a complete app built from this guide's code, see [tiktok-instagram-recipe-import-compose](https://github.com/clipparse/tiktok-instagram-recipe-import-compose) on GitHub: a Jetpack Compose app that receives links from the share sheet. ### Requirements - Android 6.0 (API level 23) or later - Kotlin 2.0 or later - A ClipParse API key ### Add the SDK The SDK is on Maven Central. Add it to your app module's `build.gradle.kts`: ```kotlin dependencies { implementation("com.clipparse:clipparse-android-sdk:1.2.0") } ``` The code in this guide needs 1.2.0 or later. The SDK's [changelog](https://github.com/clipparse/clipparse-android-sdk/blob/main/CHANGELOG.md) lists the latest version. The SDK declares the one permission it uses, `INTERNET`, in its own manifest. ### Extract a recipe from a link Create a client with a `Context` and your API key, then call `extract` with the post's URL. `extract` is a suspending function: call it from a coroutine. It is safe to call from the main thread. ```kotlin import com.clipparse.sdk.ClipParseClient import com.clipparse.sdk.model.ExtractionResult val client = ClipParseClient(context, apiKey = "") when (val result = client.extract("https://www.tiktok.com/@somecreator/video/1234567890")) { is ExtractionResult.Success -> { val recipe = result.recipe println(recipe.title) recipe.ingredients.forEach { println(it.raw) } recipe.steps.forEach { println(it.text) } } is ExtractionResult.NoRecipe -> println("No recipe found: ${result.reason}") } ``` `ExtractionResult` has two outcomes: `Success` with the recipe, or `NoRecipe` when the post holds no usable recipe. A post with no recipe is an expected outcome, not an error. `NoRecipe` carries a reason: `NoRecipeReason.NoRecipeFound` when the post holds no recipe, or `NoRecipeReason.MultipleRecipesDetected` when it holds several recipes in one post. The client reads your app's package name from the `Context` and doesn't keep a reference to it, so any context works. ### Wire it into a ViewModel A ViewModel that imports a link and exposes the state to your UI: ```kotlin import android.app.Application import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.viewModelScope import com.clipparse.sdk.ClipParseClient import com.clipparse.sdk.ClipParseException import com.clipparse.sdk.model.ExtractionResult import com.clipparse.sdk.model.NoRecipeReason import com.clipparse.sdk.model.Recipe import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.launch sealed interface ImportState { data object Idle : ImportState data object Loading : ImportState data class Imported(val recipe: Recipe) : ImportState data class Failed(val message: String) : ImportState } class RecipeImportViewModel(application: Application) : AndroidViewModel(application) { private val client = ClipParseClient(application, apiKey = "") private val _state = MutableStateFlow(ImportState.Idle) val state: StateFlow = _state.asStateFlow() fun importRecipe(link: String) { _state.value = ImportState.Loading viewModelScope.launch { _state.value = try { when (val result = client.extract(link.trim())) { is ExtractionResult.Success -> ImportState.Imported(result.recipe) is ExtractionResult.NoRecipe -> if (result.reason == NoRecipeReason.MultipleRecipesDetected) { ImportState.Failed("This post has more than one recipe.") } else { ImportState.Failed("We couldn't find a recipe in this post.") } } } catch (e: ClipParseException) { ImportState.Failed(importErrorMessage(e)) } } } } ``` ### Handle errors Failures throw a `ClipParseException`. Its `code` says what went wrong. Turn it into a message for the user: ```kotlin import android.util.Log import com.clipparse.sdk.ClipParseErrorCode import com.clipparse.sdk.ClipParseException fun importErrorMessage(e: ClipParseException): String = when (e.code) { ClipParseErrorCode.PlatformUnsupported -> "Only TikTok and Instagram links are supported." ClipParseErrorCode.InvalidRequest -> "That doesn't look like a link." ClipParseErrorCode.PostUnavailable -> "This post was deleted, is private, or doesn't exist." ClipParseErrorCode.Unauthorized, ClipParseErrorCode.InvalidApiKey, ClipParseErrorCode.ApiKeyRevoked -> { Log.w("RecipeImport", "ClipParse API key error", e) "Recipe import isn't available right now." } ClipParseErrorCode.RateLimited, ClipParseErrorCode.QuotaExceeded -> "Too many imports right now. Try again later." ClipParseErrorCode.Network -> "Check your connection and try again." else -> "Something went wrong. Please try again." } ``` Always keep the `else` branch: new error codes can be added, and the SDK passes on a code it doesn't know yet as is. The API key errors (`Unauthorized`, `InvalidApiKey`, `ApiKeyRevoked`) are yours to fix, not the user's: log them so you notice. `RateLimited` and `QuotaExceeded` carry a `retryAfter` duration; for `QuotaExceeded` it is `null` when the allowance doesn't renew. When `isRetryable` is true, such as for a dropped connection, the same call is safe to retry. `requestId` identifies the failed request: quote it when contacting support. ### Use the recipe's fields The recipe's fields: - `title`, and `language`: a short code such as `"en"`. - `sourceUrl`: the post the recipe came from. - `thumbnailUrl`: the post's thumbnail, when there is one. The URL expires, so download the image if you keep the recipe. - `servings`, `prepTimeMinutes` and `cookTimeMinutes`, when the post states them. - `ingredients`, in the order the post lists them. Each has a `name`, a `quantity` and a `unit`, the `prep` note (such as "finely chopped"), the `section` it belongs to (such as "For the sauce"), and `raw`: the line exactly as the post wrote it. - `steps`, in order. Each has its `text`, a `durationMinutes` when stated, and a `section`. Anything the post doesn't state is `null`. For a range such as "2-3 tbsp", `quantity` is the midpoint and `quantityMin` and `quantityMax` hold the ends. `unit` is `IngredientUnit.Each` for counted ingredients such as 3 eggs, and `null` when the post gives no unit. To show an amount, use the range when there is one: ```kotlin import com.clipparse.sdk.model.Ingredient import com.clipparse.sdk.model.IngredientUnit import java.text.DecimalFormat private val number = DecimalFormat("0.##") fun amountText(ingredient: Ingredient): String? { val quantity = ingredient.quantity ?: return null val low = ingredient.quantityMin val high = ingredient.quantityMax val amount = if (low != null && high != null) { "${number.format(low)}–${number.format(high)}" } else { number.format(quantity) } val unit = ingredient.unit return if (unit == null || unit == IngredientUnit.Each) amount else "$amount ${unit.raw}" } ``` ### Accept links from the share sheet People find recipes in the TikTok and Instagram apps, so the smoothest way in is the share sheet: the user taps Share on a post and picks your app. Declare an activity that accepts shared text in your `AndroidManifest.xml`: ```xml ``` Apps share the link as text, sometimes with other words around it, so pick the URL out of the text: ```kotlin import android.content.Intent import android.util.Patterns val sharedText = intent.takeIf { it.action == Intent.ACTION_SEND } ?.getStringExtra(Intent.EXTRA_TEXT) val link = sharedText ?.let { Patterns.WEB_URL.matcher(it) } ?.takeIf { it.find() } ?.group() if (link != null) { viewModel.importRecipe(link) } ``` ### Next steps - The [example app](https://github.com/clipparse/tiktok-instagram-recipe-import-compose) is this guide's code as a complete app, ready to run. - The [API reference](https://docs.clipparse.com/) lists every field and outcome. - The [ClipParse Android SDK](https://github.com/clipparse/clipparse-android-sdk) repository has the changelog, and `DATA_SAFETY.md`, which helps you fill in Google Play's Data safety form. - [Pricing](https://clipparse.com/pricing) covers what each import costs and the plans past the free tier. ## Guide: How to extract recipes from TikTok and Instagram links in Python Web page: https://docs.clipparse.com/guides/extract-recipes-from-tiktok-instagram-python To extract a recipe from a TikTok or Instagram post in Python, send the post's link to the ClipParse API. It returns the recipe as JSON: the title, ingredients with quantities and units, ordered steps, timings and servings. You need a ClipParse API key: get a free one at [clipparse.com/get-free-key](https://clipparse.com/get-free-key). It takes seconds and doesn't require a credit card. Building an iOS or Android app? The [iOS](/guides/import-recipes-from-tiktok-instagram-ios) and [Android](/guides/import-recipes-from-tiktok-instagram-android) SDKs are the recommended way to call the API from a mobile app: extraction is more reliable through them. ### Requirements - Python 3.10 or later - The `requests` package: `pip install requests` - A ClipParse API key, in the `CLIPPARSE_API_KEY` environment variable ### Extract a recipe from a link Send the link to `POST https://api.clipparse.com/v1/extract`, with your key in the `X-API-Key` header: ```python import os import requests API_URL = "https://api.clipparse.com/v1/extract" class ClipParseError(Exception): def __init__(self, status: int, code: str, message: str | None, retry_after: float | None): super().__init__(message or f"HTTP {status}: {code}") self.status = status self.code = code self.retry_after = retry_after @property def retryable(self) -> bool: return self.status >= 500 or self.code == "rate_limited" def extract_recipe(post_url: str) -> dict: response = requests.post( API_URL, headers={"X-API-Key": os.environ["CLIPPARSE_API_KEY"]}, json={"url": post_url}, timeout=60, ) try: body = response.json() except ValueError: body = {} if response.ok and body.get("status") in ("success", "no_recipe"): return body retry_after = response.headers.get("Retry-After") raise ClipParseError( response.status_code, body.get("code") or ("invalid_request" if response.status_code == 422 else "unexpected_response"), body.get("message"), float(retry_after) if retry_after else None, ) ``` The response's `status` says what happened. On `success`, the body carries the `recipe`. On `no_recipe`, the post holds no usable recipe, and `code` says why: `no_recipe_found`, or `multiple_recipes_detected` when it holds several recipes in one post. Both come with HTTP 200: a post with no recipe is an expected outcome, not an error. ```python result = extract_recipe("https://www.tiktok.com/@somecreator/video/1234567890") if result["status"] == "success": recipe = result["recipe"] print(recipe["title"]) for ingredient in recipe["ingredients"]: print(ingredient["raw"]) for step in recipe["steps"]: print(step["text"]) else: print("No recipe:", result["code"]) ``` ### Handle errors Every other outcome is an error with a `code`, raised above as a `ClipParseError`: - `platform_unsupported` (400): the link isn't a TikTok or Instagram post. - `post_unavailable` (404): the post was deleted, is private, or doesn't exist. Retrying won't help. - `unauthorized` or `invalid_key` (401), `key_revoked` (403): a problem with your API key. - `rate_limited` (429): too many requests in a short time. Retry after the number of seconds in the `Retry-After` header. - `quota_exceeded` (429): the key's allowance is spent until the time in `resetsAt`. - `internal_error` (500): a transient failure. Retry with backoff. A value that isn't a URL gets a 422 with a validation error, which `extract_recipe` reports as `invalid_request`. To show a message to your users, map the codes they can act on and treat the rest as a generic failure: ```python USER_MESSAGES = { "platform_unsupported": "Only TikTok and Instagram links are supported.", "invalid_request": "That doesn't look like a link.", "post_unavailable": "This post was deleted, is private, or doesn't exist.", "rate_limited": "Too many imports right now. Try again later.", "quota_exceeded": "Too many imports right now. Try again later.", } def user_message(error: ClipParseError) -> str: return USER_MESSAGES.get(error.code, "Something went wrong. Please try again.") ``` The API key errors are yours to fix, not the user's: log them, with their `message`, so you notice. Branch on `code`, not on `message`: its wording can change. ### Retry what's worth retrying Only `internal_error` and `rate_limited` are worth retrying. This wrapper retries them a few times, waiting for `Retry-After` when the API gives one and backing off otherwise: ```python import time def extract_with_retry(post_url: str, attempts: int = 3) -> dict: for attempt in range(1, attempts + 1): try: return extract_recipe(post_url) except ClipParseError as error: wait = error.retry_after or 2**attempt if not error.retryable or attempt == attempts or wait > 60: raise time.sleep(wait) ``` ### Use the recipe's fields The recipe's fields: - `title`, and `language`: a short code such as `"en"`. - `sourceUrl`: the post the recipe came from. - `thumbnailUrl`: the post's thumbnail, when there is one. The URL expires, so download the image if you keep the recipe. - `servings`, `prepTimeMinutes` and `cookTimeMinutes`, when the post states them. - `ingredients`, in the order the post lists them. Each has a `name`, a `quantity` and a `unit`, the `prep` note (such as "finely chopped"), the `section` it belongs to (such as "For the sauce"), and `raw`: the line exactly as the post wrote it. - `steps`, in order. Each has its `text`, a `durationMinutes` when stated, and a `section`. Anything the post doesn't state is `null` in the JSON, so `None` in Python. For a range such as "2-3 tbsp", `quantity` is the midpoint and `quantityMin` and `quantityMax` hold the ends. `unit` is one of `g`, `kg`, `ml`, `l`, `tsp`, `tbsp`, `cup`, `pt`, `qt`, `gal`, `oz`, `lb`, `pinch` or `each`. `each` means the ingredient is counted, such as 3 eggs; `None` means the post gives no unit. To show an amount, use the range when there is one: ```python def amount_text(ingredient: dict) -> str | None: if ingredient["quantity"] is None: return None if ingredient["quantityMin"] is not None and ingredient["quantityMax"] is not None: amount = f"{ingredient['quantityMin']:g}–{ingredient['quantityMax']:g}" else: amount = f"{ingredient['quantity']:g}" if ingredient["unit"] in (None, "each"): return amount return f"{amount} {ingredient['unit']}" ``` ### Track your allowance Every response to a request with a valid key reports your allowance in headers: `X-Quota-Limit`, `X-Quota-Used`, `X-Quota-Remaining`, and `X-Quota-Reset`, the time it renews. `X-Credits-Used` says what the request itself used. Errors and `no_recipe` outcomes use no credits. Every response also carries an `X-Request-Id`. Log it with failures, and quote it when contacting support. ### Get schema.org JSON-LD instead If your app already imports recipes in the schema.org format, call `POST https://api.clipparse.com/v1/extract/schema-org` with the same request instead. On success, the body is a `schema.org/Recipe` object served as `application/ld+json`. The other outcomes are unchanged, so tell them apart by the `Content-Type`. ### Next steps - The [API reference](https://docs.clipparse.com/) lists every field and outcome. The OpenAPI spec is at [docs.clipparse.com/openapi.json](https://docs.clipparse.com/openapi.json). - The [Node.js guide](/guides/extract-recipes-from-tiktok-instagram-node) shows the same calls in JavaScript. - [Pricing](https://clipparse.com/pricing) covers what each extraction costs and the plans past the free tier. ## Guide: How to extract recipes from TikTok and Instagram links in Node.js Web page: https://docs.clipparse.com/guides/extract-recipes-from-tiktok-instagram-node To extract a recipe from a TikTok or Instagram post in Node.js, send the post's link to the ClipParse API. It returns the recipe as JSON: the title, ingredients with quantities and units, ordered steps, timings and servings. You need a ClipParse API key: get a free one at [clipparse.com/get-free-key](https://clipparse.com/get-free-key). It takes seconds and doesn't require a credit card. Building an iOS or Android app? The [iOS](/guides/import-recipes-from-tiktok-instagram-ios) and [Android](/guides/import-recipes-from-tiktok-instagram-android) SDKs are the recommended way to call the API from a mobile app: extraction is more reliable through them. ### Requirements - Node.js 18 or later, for the built-in `fetch`. No package is needed. - A ClipParse API key, in the `CLIPPARSE_API_KEY` environment variable ### Extract a recipe from a link Send the link to `POST https://api.clipparse.com/v1/extract`, with your key in the `X-API-Key` header: ```js const API_URL = "https://api.clipparse.com/v1/extract"; export class ClipParseError extends Error { constructor(status, code, message, retryAfter) { super(message ?? `HTTP ${status}: ${code}`); this.name = "ClipParseError"; this.status = status; this.code = code; this.retryAfter = retryAfter; } get retryable() { return this.status >= 500 || this.code === "rate_limited"; } } export async function extractRecipe(postUrl) { const response = await fetch(API_URL, { method: "POST", headers: { "X-API-Key": process.env.CLIPPARSE_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ url: postUrl }), signal: AbortSignal.timeout(60_000), }); const body = await response.json().catch(() => ({})); if (response.ok && (body.status === "success" || body.status === "no_recipe")) { return body; } const retryAfter = response.headers.get("Retry-After"); throw new ClipParseError( response.status, body.code ?? (response.status === 422 ? "invalid_request" : "unexpected_response"), body.message, retryAfter ? Number(retryAfter) : undefined, ); } ``` The response's `status` says what happened. On `success`, the body carries the `recipe`. On `no_recipe`, the post holds no usable recipe, and `code` says why: `no_recipe_found`, or `multiple_recipes_detected` when it holds several recipes in one post. Both come with HTTP 200: a post with no recipe is an expected outcome, not an error. ```js const result = await extractRecipe("https://www.tiktok.com/@somecreator/video/1234567890"); if (result.status === "success") { const { recipe } = result; console.log(recipe.title); for (const ingredient of recipe.ingredients) { console.log(ingredient.raw); } for (const step of recipe.steps) { console.log(step.text); } } else { console.log("No recipe:", result.code); } ``` ### Handle errors Every other outcome is an error with a `code`, thrown above as a `ClipParseError`: - `platform_unsupported` (400): the link isn't a TikTok or Instagram post. - `post_unavailable` (404): the post was deleted, is private, or doesn't exist. Retrying won't help. - `unauthorized` or `invalid_key` (401), `key_revoked` (403): a problem with your API key. - `rate_limited` (429): too many requests in a short time. Retry after the number of seconds in the `Retry-After` header. - `quota_exceeded` (429): the key's allowance is spent until the time in `resetsAt`. - `internal_error` (500): a transient failure. Retry with backoff. A value that isn't a URL gets a 422 with a validation error, which `extractRecipe` reports as `invalid_request`. To show a message to your users, map the codes they can act on and treat the rest as a generic failure: ```js const USER_MESSAGES = { platform_unsupported: "Only TikTok and Instagram links are supported.", invalid_request: "That doesn't look like a link.", post_unavailable: "This post was deleted, is private, or doesn't exist.", rate_limited: "Too many imports right now. Try again later.", quota_exceeded: "Too many imports right now. Try again later.", }; export function userMessage(error) { return USER_MESSAGES[error.code] ?? "Something went wrong. Please try again."; } ``` The API key errors are yours to fix, not the user's: log them, with their `message`, so you notice. Branch on `code`, not on `message`: its wording can change. ### Retry what's worth retrying Only `internal_error` and `rate_limited` are worth retrying. This wrapper retries them a few times, waiting for `Retry-After` when the API gives one and backing off otherwise: ```js export async function extractWithRetry(postUrl, attempts = 3) { for (let attempt = 1; ; attempt++) { try { return await extractRecipe(postUrl); } catch (error) { const wait = error.retryAfter ?? 2 ** attempt; if (!(error instanceof ClipParseError) || !error.retryable || attempt === attempts || wait > 60) { throw error; } await new Promise((resolve) => setTimeout(resolve, wait * 1000)); } } } ``` ### Use the recipe's fields The recipe's fields: - `title`, and `language`: a short code such as `"en"`. - `sourceUrl`: the post the recipe came from. - `thumbnailUrl`: the post's thumbnail, when there is one. The URL expires, so download the image if you keep the recipe. - `servings`, `prepTimeMinutes` and `cookTimeMinutes`, when the post states them. - `ingredients`, in the order the post lists them. Each has a `name`, a `quantity` and a `unit`, the `prep` note (such as "finely chopped"), the `section` it belongs to (such as "For the sauce"), and `raw`: the line exactly as the post wrote it. - `steps`, in order. Each has its `text`, a `durationMinutes` when stated, and a `section`. Anything the post doesn't state is `null`. For a range such as "2-3 tbsp", `quantity` is the midpoint and `quantityMin` and `quantityMax` hold the ends. `unit` is one of `g`, `kg`, `ml`, `l`, `tsp`, `tbsp`, `cup`, `pt`, `qt`, `gal`, `oz`, `lb`, `pinch` or `each`. `each` means the ingredient is counted, such as 3 eggs; `null` means the post gives no unit. To show an amount, use the range when there is one: ```js export function amountText(ingredient) { if (ingredient.quantity === null) { return null; } const amount = ingredient.quantityMin !== null && ingredient.quantityMax !== null ? `${ingredient.quantityMin}–${ingredient.quantityMax}` : `${ingredient.quantity}`; return ingredient.unit === null || ingredient.unit === "each" ? amount : `${amount} ${ingredient.unit}`; } ``` For TypeScript, generate the types from the OpenAPI spec at [docs.clipparse.com/openapi.json](https://docs.clipparse.com/openapi.json). ### Track your allowance Every response to a request with a valid key reports your allowance in headers: `X-Quota-Limit`, `X-Quota-Used`, `X-Quota-Remaining`, and `X-Quota-Reset`, the time it renews. `X-Credits-Used` says what the request itself used. Errors and `no_recipe` outcomes use no credits. Every response also carries an `X-Request-Id`. Log it with failures, and quote it when contacting support. ### Get schema.org JSON-LD instead If your app already imports recipes in the schema.org format, call `POST https://api.clipparse.com/v1/extract/schema-org` with the same request instead. On success, the body is a `schema.org/Recipe` object served as `application/ld+json`. The other outcomes are unchanged, so tell them apart by the `Content-Type`. ### Next steps - The [API reference](https://docs.clipparse.com/) lists every field and outcome. - The [Python guide](/guides/extract-recipes-from-tiktok-instagram-python) shows the same calls in Python. - [Pricing](https://clipparse.com/pricing) covers what each extraction costs and the plans past the free tier. ## Guide: Build or buy: extracting recipes from TikTok and Instagram yourself Web page: https://docs.clipparse.com/guides/build-or-buy-tiktok-instagram-recipe-extraction The obvious way to add recipe import from TikTok and Instagram links is to build it: take the post's caption, give it to a language model, and ask for the recipe as JSON. On a demo post it works in an afternoon. This guide lists the problems that show up on real posts, and what the ClipParse API returns for each, so you can weigh building it against calling an API. ### In short - **Building it is enough** when the posts you care about have the recipe written out in the caption, in one language, and your app only shows the recipe as text. - **It takes more** when the recipe is said out loud or shown on photo slides, when users share posts that hold no recipe, when your app scales recipes or builds shopping lists from the amounts, or when posts come in several languages. - **ClipParse is an API that covers those cases**: send a TikTok or Instagram link, get back the recipe as JSON, or a clear `no_recipe` outcome when the post holds none. The free plan has 100 credits a month and needs no credit card: [get a key](https://clipparse.com/get-free-key). ### The recipe isn't always in the caption Many creators put only a title and some hashtags in the caption and say the recipe out loud, or show it on photo slides. A caption-only import tells the user there's nothing to import from those posts, while the recipe is right there in the video. Covering them takes a speech-to-text step for videos and an image-reading step for photo posts, each with its own cost. ClipParse reads the recipe from the caption, from a photo post's images and, when the caption falls short, from what is said in the video. ### Posts with no recipe A model asked for a recipe tends to write one. Give it a restaurant review, a taste test or a day-in-my-life vlog, and it can return plausible ingredients the post never mentions. Telling "no recipe here" apart from "a recipe stated loosely" is the hard part, and a wrong guess either way is visible to your users: an invented recipe, or a real one turned away. Compilations are a related case: "5 easy breakfasts" in one post. Merged into a single recipe, they make no sense. ClipParse answers both with a `no_recipe` status and a code that says which: ```json { "status": "no_recipe", "code": "no_recipe_found" } ``` A compilation returns `multiple_recipes_detected` instead: ClipParse extracts one recipe per post, so your app can tell the user why rather than show a merged recipe. Neither outcome uses a credit. ### Quantities and units Amounts like "200g" are the easy part. The lines that trip up an import are the ones where the numbers don't mean what they seem: a count and a weight for the same ingredient, the same amount in two units, a range, or two ingredients on one line with no amount. For your app to scale a recipe or build a shopping list, each line needs one number and one unit from a fixed set, without inventing precision the post doesn't give. Keep the original line too, for whatever the structured fields can't express. Four such lines: "4 chicken thighs (about 600g)", "200g (1 ½ cups) flour", "2-3 tbsp milk" and "salt and pepper". ClipParse returns them as: ```json [ { "name": "chicken thighs", "prep": null, "quantity": 4, "quantityMin": null, "quantityMax": null, "unit": "each", "raw": "4 chicken thighs (about 600g)", "section": null }, { "name": "flour", "prep": null, "quantity": 200, "quantityMin": null, "quantityMax": null, "unit": "g", "raw": "200g (1 ½ cups) flour", "section": null }, { "name": "milk", "prep": null, "quantity": 2.5, "quantityMin": 2, "quantityMax": 3, "unit": "tbsp", "raw": "2-3 tbsp milk", "section": null }, { "name": "salt", "prep": null, "quantity": null, "quantityMin": null, "quantityMax": null, "unit": null, "raw": "salt", "section": null }, { "name": "pepper", "prep": null, "quantity": null, "quantityMin": null, "quantityMax": null, "unit": null, "raw": "pepper", "section": null } ] ``` `unit` comes from a fixed set, with `each` for an ingredient that is counted rather than measured and `null` when the post gives no amount. A range keeps its bounds in `quantityMin` and `quantityMax`, with the midpoint in `quantity`. `raw` is the ingredient as written in the post. ### Languages Recipe posts come in every language, and a model's output in one language isn't proof it handles the others. Amounts are written differently from one language to the next: "2 EL" in German and "2 c. à s." in French are both tablespoons, "1,5 kg" uses a decimal comma, and "1 dl" is common in some countries and unknown in others. ClipParse returns the recipe in the post's language, with the amounts in the same fixed units. From a German and a French post: ```json [ { "name": "Olivenöl", "prep": null, "quantity": 2, "quantityMin": null, "quantityMax": null, "unit": "tbsp", "raw": "2 EL Olivenöl", "section": null }, { "name": "Sahne", "prep": null, "quantity": 100, "quantityMin": null, "quantityMax": null, "unit": "ml", "raw": "1 dl Sahne", "section": null }, { "name": "huile d'olive", "prep": null, "quantity": 2, "quantityMin": null, "quantityMax": null, "unit": "tbsp", "raw": "2 c. à s. d'huile d'olive", "section": null } ] ``` ### Keeping it working Once it ships, the feature needs upkeep. Platform changes break import pipelines without warning, and even established recipe apps ship regular fixes for social imports. It also needs a set of test posts to check every change against, and a budget for the model calls, including those spent on posts with no recipe. ### Using ClipParse instead One request with a TikTok or Instagram link returns the recipe with ingredients, quantities, units, ordered steps, timings and servings, or one of the outcomes above. - **Price**: the free plan has 100 credits a month. A recipe uses 1 credit, or 4 when it was extracted from what's said in the video. Errors and posts with no recipe use none. Paid plans start at $19 a month for 5,000 credits: see [pricing](https://clipparse.com/pricing). - **Mobile apps**: the [iOS](/guides/import-recipes-from-tiktok-instagram-ios) and [Android](/guides/import-recipes-from-tiktok-instagram-android) SDKs. - **Anything else**: the API is one HTTP request, from any language or framework. The [Python](/guides/extract-recipes-from-tiktok-instagram-python) and [Node.js](/guides/extract-recipes-from-tiktok-instagram-node) guides show it in code. - **Every field and outcome**: the [API reference](https://docs.clipparse.com/). Get a free API key at [clipparse.com/get-free-key](https://clipparse.com/get-free-key). It takes seconds and doesn't require a credit card.