At OpenFood we believe in open data delivered using open source technologies and open web standards. The OpenFood API allows full access to all of the content available in the OpenFood database, including images.
Stay informed about OpenFood, and sign up for our newsletter.
All content, including images, is licensed under CC BY 4.0
By default, all requests receive the v2 version of the API.
All API access is over HTTPS, and accessed from https://openfood.ch
. All data is sent and received as JSON.
The OpenFood API is based on the JSON API Specification for resources access, while the search functionality is provided through an ElasticSearch cluster. The search endpoints use ElasticSearch query language.
Sign up for a developer account on OpenFood and visit the API Keys page. This key must be passed with all requests, in the header.
You may request multiple API keys, and they may be deactivated or deleted at anytime by you. Once a key is deactivated or deleted it cannot be reused.
Each request made against the OpenFood API must include your API key. The key must be passed against a Token header, like:
Authorization: Token token="[API_KEY]"
All traffic accessing OpenFood must travel across HTTPS.
The API is documented via the OpenAPI Specification via a Swagger interface. This may be found on the documentation page.
The documentation may be freely viewed without an account. Using your developer API Key, you can run live queries against the API and view the generated curl statements.
Endpoints examples can be found here
Search endpoints, which contain the _search string are served using ElasticSearch. As such the full ElasticSearch Query DSL may be applied to OpenFood data.
Examples of search can be found here
Example code for various languages may be found in this repo. Replace [API Key] with your own key where necessary. We currently support examples for
Please log any issues, enhancement requests or code questions in the Issues log.
You can also contact us and other community developers via the Slack channel.
We welcome any suggestions or feature requests, please log an issue. Changes to this documentation or sample code is also welcome ... just make a pull request.