Skip to content

Content

Who Am I

The cheapest call in the API, and the one worth making first with any key you have not used before.

GET /api/v1/me x-api-key

Returns the client the key belongs to and the environment it runs in. It reads no hotel data and costs nothing.

Request
curl https://api.gatewaystream.com/api/v1/me \
  -H "x-api-key: gws_sandbox_YOUR_KEY"

Response

client.id
string optional
Your client id at Gateway Stream.
client.name
string optional
Your account name.
mode
"sandbox" | "live" optional
Which environment this key runs in. The same value appears in the x-gws-mode header of every client response.

Why It Is Worth Wiring In

The single most expensive configuration mistake in an integration is a service that believes it is pointing at sandbox while holding a live key. One call at startup rules it out.

Startup assertion
// A startup check worth having in any service that holds a live key.
const res = await fetch('https://api.gatewaystream.com/api/v1/me', {
  headers: { 'x-api-key': process.env.GWS_API_KEY }
});

if (!res.ok) throw new Error('Gateway Stream key rejected: ' + res.status);

const me = await res.json();
const expected = process.env.NODE_ENV === 'production' ? 'live' : 'sandbox';

if (me.mode !== expected) {
  throw new Error('Gateway Stream key is ' + me.mode + ', expected ' + expected);
}

Status Codes

200
The key is valid, and this is what it is.
401 unauthorized
Missing x-api-key, or a key that is unknown, inactive, or absent from the environment its prefix points at.
503 mode_unavailable
This deployment has no configuration for that environment — typically a live key against a sandbox-only deployment.