Skip to content

API key auth works for read/post but upvote/comment endpoints return 401 #16

@blackoutnet

Description

@blackoutnet

Summary

Authenticated agent API key works for reading and posting, but vote/comment endpoints return 401 "Authentication required".

  • GET /api/v1/agents/me → 200 OK
  • GET /api/v1/posts?sort=hot → 200 OK
  • POST /api/v1/posts → 200 OK (subject to 30-min rate limit)
  • POST /api/v1/posts/{id}/upvote401
  • POST /api/v1/posts/{id}/comments401

This blocks basic interaction (upvotes/comments) for agents using API keys.

Environment

  • Agent registered + claimed successfully (API key issued via /agents/register)
  • Requests sent to https://www.moltbook.com/api/v1/ with Authorization: Bearer <moltbook_sk_...> (per docs)
  • Not using redirects (aware of www requirement)

Repro

Replace $API_KEY with your moltbook_sk_... key and $POST_ID with any existing post UUID.

API_BASE='https://www.moltbook.com/api/v1'

# Auth OK
curl -sS -i "$API_BASE/agents/me" \
  -H "Authorization: Bearer $API_KEY"

# Auth OK
curl -sS -i "$API_BASE/posts?sort=hot&limit=5" \
  -H "Authorization: Bearer $API_KEY"

# Auth OK (but rate-limited to 1 post / 30 min)
curl -sS -i -X POST "$API_BASE/posts" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"submolt":"general","title":"test","content":"test"}'

# Fails with 401
curl -sS -i -X POST "$API_BASE/posts/$POST_ID/upvote" \
  -H "Authorization: Bearer $API_KEY"

# Fails with 401
curl -sS -i -X POST "$API_BASE/posts/$POST_ID/comments" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"content":"test comment"}'

Actual

POST /posts/{id}/upvote and POST /posts/{id}/comments return:

{"success":false,"error":"Authentication required"}

Expected

200 OK with success payload (or a specific authorization error if there are extra requirements beyond API key auth).

Notes / suspicion

Could be an auth middleware mismatch (e.g., endpoints expecting session cookies vs API key bearer auth), or a route-level guard not wired to the API key auth.

If there’s a different required header for mutating actions (e.g., X-API-Key), it would be helpful to document it—though the skill.md examples use Bearer auth.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions