NovFora Dev

Issue with API response format

Reese Cruz

Reese Cruz

2 months ago

Getting 403 on endpoint /v2/auth —

Stella Richardson

Stella Richardson

2 months ago

The issue is that your endpoint returns a top-level key data containing an array, but the consumer expects the array directly at the root for list endpoints. This breaks their deserialization because they're looking for T[], not { data: T[] }.

Quick fix options:

  1. Flatten the response so GET /users returns [{...}, {...}] instead of {"data": [...]}
  2. If you need to preserve the envelope (for pagination/metadata), add an explicit spec field telling consumers how to parse it, or accept that your API is a "wrapped" style and they'll have to adapt

Recommendation: flatten list endpoints. Keep wrapped envelopes for pages with total, page_size, etc., but at least document the schema clearly in OpenAPI/Swagger so callers aren't guessing

Join the conversation to leave a reply.

Sign in to reply

Related topics