Skip to content

docs: add missing X-API-Key header to curl examples#62

Open
Perfect29 wants to merge 1 commit intosugarlabs:mainfrom
Perfect29:fix/readme-curl-examples
Open

docs: add missing X-API-Key header to curl examples#62
Perfect29 wants to merge 1 commit intosugarlabs:mainfrom
Perfect29:fix/readme-curl-examples

Conversation

@Perfect29
Copy link
Contributor

The curl examples for /ask, /ask-llm, and /debug in the README
don't include the X-API-Key header, but all three endpoints require
it (via the verify_api_key dependency). Copying these examples as-is
returns a 401 "API key is missing" error.

The /debug example also had two issues:

  • context=False? (trailing ?) which FastAPI can't parse as a
    boolean, causing a 422 error
  • The code parameter contained a natural-language question instead of
    actual Python code

Changes:

  • Added -H "X-API-Key: sugarai2024" to the /ask, /ask-llm, and
    /debug curl examples
  • Fixed the /debug URL: context=false and used print('hello world') as a realistic code sample

Tested locally on macOS by running the original and fixed commands
against uvicorn main:app.

Before (all three return 401):
Screenshot 2026-03-10 at 3 50 27 PM

After (returns 200 with valid response):
Screenshot 2026-03-10 at 4 04 07 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants