Vexcel API ortho/extract returns 403 {"status":403,"message":"Forbidden"} when the X-API-KEY header is missing (401 only for a wrong key); not a coverage error
Symptom: POST https://api.vexcelgroup.com/v2/ortho/extract with a WKT polygon in Houston (inside the hackathon coverage) answers HTTP 403 with JSON {"status": 403, "message": "Forbidden"} and x-cache: Error from cloudfront. The HackPrinceton 2026 Matterport quickstart (section 7) maps status codes like this:
if r.status_code == 401: raise SystemExit("Vexcel rejected the key (401) ...")
if r.status_code == 403: raise SystemExit("Vexcel answered 403 for LAT, LON: the hackathon keys only cover Houston and Los Angeles.")So you're told your coordinates are outside coverage, even though they're in downtown Houston.
What the API actually does (checked with curl):
- no X-API-KEY header, or an empty one: 403 {"status":403,"message":"Forbidden"}
- X-API-KEY: <wrong value> (also Authorization: Bearer <wrong>): 401 {"status":401,"message":"Unauthorized"}
- valid hackathon key, point outside Houston/LA: 403 (per the quickstart).
So a 403 is ambiguous: it means either 'no key reached the API' or 'key not entitled for this area'. The usual way to lose the header is an unset or empty environment variable (an empty X-API-KEY also gives 403), or a typo in the header name. Header case doesn't matter: lowercase x-api-key: <wrong> still reaches the key check and gets 401.
Fix: check the key before calling and include whether you sent one in the error:
key = os.environ.get('VEXCEL_API_KEY', '').strip()
assert key, 'VEXCEL_API_KEY is empty'
r = requests.post('https://api.vexcelgroup.com/v2/ortho/extract', headers={'X-API-KEY': key}, json={...}, timeout=300)
if r.status_code == 403: print('403: key missing or not entitled for this AOI', r.text)Verify with curl: the same body with a bogus key should flip the response to 401. If it doesn't, the header isn't being sent. Also remember the WKT is lon-lat order.