BEA API: a missing UserID returns HTTP 200 with a zero-length body
Checked 2026-09-08 · Statistical agencies: BLS, Census, BEA, FRED and EIA
apps.bea.gov/api/data answers a request with no UserID with HTTP 200, content-type text/plain and content-length 0. There is no error object to read; a JSON parser fails on empty input. Send a UserID that is not registered and you get HTTP 200 again, this time with a JSON body whose error is buried at BEAAPI.Results.Error. BEA does not use status codes to signal failure at all.
What we saw
No UserID gives 200 and an empty body. Source (response headers, 2026-09-08).
HTTP/2 200 content-type: text/plain; charset=utf-8 content-length: 0
The downloaded body is zero bytes on disk, not whitespace. Source (byte count of saved response, 2026-09-08).
0 /tmp/bea0.out
An unregistered UserID gives 200 with the error nested three levels deep, and echoes every parameter back. Source (BEAAPI.Results.Error, 2026-09-08).
{"BEAAPI":{"Request":{"RequestParam":[{"ParameterName":"USERID","ParameterValue":"00000000-0000-0000-0000-000000000000"},{"ParameterName":"METHOD","ParameterValue":"GETDATASETLIST"},{"ParameterName":"RESULTFORMAT","ParameterValue":"JSON"}]},"Results":{"Error":{"APIErrorCode":"1","APIErrorDescription":"Invalid Request - Invalid API UserId."}}}}
HTTP 200The UserID check runs before the method check: drop method entirely and you still get the UserId error, not a missing-method error. Source (BEAAPI.Results.Error.APIErrorDescription, 2026-09-08).
{"BEAAPI":{"Request":{"RequestParam":[{"ParameterName":"USERID","ParameterValue":"00000000-0000-0000-0000-000000000000"},{"ParameterName":"RESULTFORMAT","ParameterValue":"JSON"}]},"Results":{"Error":{"APIErrorCode":"1","APIErrorDescription":"Invalid Request - Invalid API UserId."}}}}Parameter names are echoed upper-cased regardless of the case you sent, so matching the echo against your request needs a case fold. Source (BEAAPI.Request.RequestParam[].ParameterName, 2026-09-08).
"ParameterName":"USERID" ... "ParameterName":"METHOD" ... "ParameterName":"RESULTFORMAT"
The command
curl -sS -D - -o /tmp/bea0.out 'https://apps.bea.gov/api/data?method=GETDATASETLIST&ResultFormat=json' | grep -iE 'HTTP/|content-type|content-length'; wc -c /tmp/bea0.out
HTTP/2 200 content-type: text/plain; charset=utf-8 content-length: 0 0 /tmp/bea0.out
Checked 2026-09-08.
curl -sS -w '\nHTTP %{http_code}\n' 'https://apps.bea.gov/api/data?UserID=00000000-0000-0000-0000-000000000000&method=GETDATASETLIST&ResultFormat=json'{"BEAAPI":{"Request":{"RequestParam":[{"ParameterName":"USERID","ParameterValue":"00000000-0000-0000-0000-000000000000"},{"ParameterName":"METHOD","ParameterValue":"GETDATASETLIST"},{"ParameterName":"RESULTFORMAT","ParameterValue":"JSON"}]},"Results":{"Error":{"APIErrorCode":"1","APIErrorDescription":"Invalid Request - Invalid API UserId."}}}}
HTTP 200Checked 2026-09-08.
curl -sS 'https://apps.bea.gov/api/data?UserID=00000000-0000-0000-0000-000000000000&ResultFormat=json'
{"BEAAPI":{"Request":{"RequestParam":[{"ParameterName":"USERID","ParameterValue":"00000000-0000-0000-0000-000000000000"},{"ParameterName":"RESULTFORMAT","ParameterValue":"JSON"}]},"Results":{"Error":{"APIErrorCode":"1","APIErrorDescription":"Invalid Request - Invalid API UserId."}}}}Checked 2026-09-08.
| request | HTTP | content-type | body | where the error is |
|---|---|---|---|---|
| no UserID | 200 | text/plain; charset=utf-8 | 0 bytes | nowhere - infer it from the empty body |
| UserID present but unregistered | 200 | (JSON) | BEAAPI envelope | BEAAPI.Results.Error.APIErrorCode = 1 |
| UserID unregistered, no method | 200 | (JSON) | BEAAPI envelope | same UserId error - UserID is checked first |
Limits
- No registered UserID was available, so nothing here describes a successful response. In particular the shape of BEAAPI.Results on success, and whether Error can appear alongside data in a partly-valid request, are untested.
- APIErrorCode 1 is the only code seen. The rest of the code list is not verified here.
- Only the JSON ResultFormat was exercised; the XML format may or may not return an empty body in the same case.
- Whether the empty-body response is BEA's own or an intermediary stripping it was not determined.
Open question
Is the zero-length response specific to a missing UserID, or does any request BEA cannot parse at all return 200 and nothing? A malformed method name would separate the two.