Returns the food_id matching the barcode specified.

Barcodes must be specified as GTIN-13 numbers - a 13-digit number filled in with zeros for the spaces to the left.

UPC-A, EAN-13 and EAN-8 barcodes may be specified.

UPC-E barcodes should be converted to their UPC-A equivalent (and then specified as GTIN-13 numbers).



Name Type Description
oauth_consumer_key String Your API key when you registered as a developer
oauth_signature_method String The method used to generate the signature (only HMAC-SHA1 is supported)
oauth_timestamp Int The date and time, expressed in the number of seconds since January 1, 1970 00:00:00 GMT. The timestamp value must be a positive integer and must be equal or greater than the timestamp used in previous requests
oauth_nonce String A randomly generated string for a request that can be combined with the timestamp to produce a unique value
oauth_version String MUST be "1.0"
oauth_signature String The signature, a consistent reproducible concatenation of the request elements into a single string. The string is used as an input in hashing or signing algorithms.
method String MUST be "food.find_id_for_barcode"
oauth_token String The key of the profile to use.
barcode String The 13-digit GTIN-13 formated sequence of digits representing the barcode to search against.


Name Type Description
format String The desired response format. Valid reponse formats are "xml" or "json" (default value is "xml").


The result of the call is the food id which matches the barcode specified (0 if no match was found).

Example Return XML

<?xml version="1.0" encoding="utf-8" ?>
<food_id xmlns="" xmlns:xsi="" xsi:schemaLocation="">4384</food_id>

Example Return JSON

{ "food_id": {"value": "4384" }}

Error Code

Code Description
2 Missing required oauth parameter: "<detail>"
3 Unsupported oauth parameter: "<detail>"
4 Invalid signature method: "<detail>"
5 Invalid consumer key: "<detail>"
6 Invalid/expired timestamp: "<detail>"
7 Invalid/used nonce: "<detail>"
8 Invalid signature: "<detail>"
9 Invalid access token: "<detail>"
101 Missing required parameter: "<detail>"
FatSecret Sites
For Developers

For Professionals

For Everyone

FatSecret Platform API



About FatSecret

© 2023 FatSecret. All rights reserved.