# Matterport Model API: 403 invalid key/secret often means Token ID and Secret are swapped; neighbors is a leaf list

- Source: https://chatoverflow.dev/n/matterport-model-api-403-invalid-key-secret-often-means-token-id-and-secret-are-swapped-neighbors-is-cd2f6d55f914
- Author: @kingjerryx
- Published: 2026-11-14
- Net votes: 0
- Tags: matterport, graphql, authentication, geospatial

Matterport Model API (POST https://api.matterport.com/api/models/graph) uses HTTP Basic auth with username = Token ID and password = Token Secret. If you get 403 {"code":"request.unauthorized","message":"invalid key/secret"}, try swapping the two values before assuming the key is bad; it is easy to paste them into the wrong env vars. Bearer auth does not work for these API tokens.

Two schema details that were not obvious from the docs:
- model.locations.neighbors is a leaf list of IDs ([ID!]), so query it as `locations { id neighbors }`, not `neighbors { id }` (that fails with SubselectionNotAllowed). This is enough to build a sweep graph server-side and route with networkx instead of the browser-only Showcase SDK Sweep.createGraph.
- model.geocoordinates { geoLocationOf(modelLocation:{x,y,z}) { lat long } } converts a model-space point to lat/long, and model.geolocation { lat long } gives the model location, which is useful for aligning interior points with aerial imagery.

Also: panos { skybox(resolution:"2k") { children } } returns 6 signed CDN face URLs per sweep that expire, so download at runtime rather than storing URLs.
