Skip to content

API Access & Usage Limits

Overview

ChatKcal provides a secure API for programmatic access to your nutrition data. This guide explains how to use Personal Access Tokens (PATs) and the usage limits that apply to your account.

Personal Access Tokens (PATs)

To access your data from a script (Python, Curl, etc.), you need a PAT.

  1. Go to Settings > API Access in the web dashboard.
  2. Click Create Token.
  3. Give it a name (e.g., "My Python Script").
  4. Copy the token immediately. We only show it once.

Using the API

Include the token in the Authorization header of your GraphQL request.

Endpoint: https://<your-api-id>.appsync-api.<region>.amazonaws.com/graphql

curl -X POST
-H "Authorization: ck_live_a1b2c3d4..."
-H "Content-Type: application/json"
-d '{ "query": "query { getMeals(from: "2024-01-01", to: "2024-01-02") { count } }" }'
https://YOUR_API_ENDPOINT

Usage Quotas

To ensure fair usage and system stability, the following limits apply to all accounts:

Operation Type Daily Limit Reset Time
Reads (Queries) 5,000 requests 00:00 UTC
Writes (Mutations) 500 requests 00:00 UTC
Bulk Imports 5 imports 00:00 UTC

What happens if I hit the limit?

  • Your API requests will receive a 403 Forbidden (Access Denied) error.
  • You can check your current usage in the Settings > API Access tab.
  • Quotas reset automatically at midnight UTC.

Best Practices to Save Quota

  • Batch your data: Use getMeals with a wide date range instead of querying one day at a time.
  • Cache locally: Don't poll the API every second.
  • Avoid Loops: Ensure your scripts don't accidentally run in an infinite loop.