Quickstart
Make your first January REST API request with an API key and curl.
1. Create an API key
Open the January Developer Dashboard, select API keys, and create a key. Copy the secret when it is shown; the full value is displayed only at creation time.
API keys begin with sk-. Keep the key on a backend or another machine you control, never in browser or mobile app code.
2. Store it for this terminal session
export JANUARY_API_KEY="sk-your-key"Do not commit the key to source control.
3. Search for a food
curl --get 'https://partners.january.ai/v1.2/foods' \
--data-urlencode 'query=greek yogurt' \
--data-urlencode 'limit=5' \
--header "Authorization: Bearer ${JANUARY_API_KEY}" \
--header 'Accept: application/json'A successful response lists matching foods, best match first, trimmed here:
{
"items": [
{ "id": "70376084", "name": "greek yogurt", "type": "generic", "nutrients": { … }, "servings": [ … ], … }
]
}A 401 means the key is missing, malformed, or not recognized. A 403 forbidden means the key was issued for API v1.1.
Next steps
Last updated
Was this helpful?