Get started
Get started

Go to production

Go to production

Run through this list before your integration takes real traffic. Each item links to the page that covers it.

Handle every answer

A production call checks for errors, logs the request id, and waits out a 429. Here is a Data API call that does all three:

# --retry waits out Retry-After on a 429. Print the request id beside the body,
# and check the body for "errors" even under 200 OK.
curl -s --retry 3 https://data.mountaya.com/graphql \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" \
  -H "X-Session-Token: $MOUNTAYA_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query": "query Directions($input: DirectionsInput!) { directions(input: $input) { routes { summary } } }", "variables": {"input": {"activity": "HIKING_AND_TRAIL", "waypoints": [[6.8712, 45.9231], [6.9271, 45.9822]]}}}' \
  -w '\nX-Request-Id: %header{x-request-id}\n'

Keys and scopes

  • Keep the secret key on your servers. Store it in an environment variable, never in code, a browser, or a URL. See authentication.
  • Give each app its own publishable key, with only the scopes it needs. A key that administers your account carries management alone and stays on your backend. See scopes.
  • Plan for rotation. Create the new key, deploy it, then revoke the old one under Organization → API keys. Tokens minted with a revoked secret key keep working until they expire, at most five minutes.

Session tokens

  • Mint tokens on your server and renew them before expires_at, as authentication shows.
  • Reuse a token across visitors of a public page until shortly before it expires, rather than minting one per page view.
  • Mint member tokens only for the person signed in to your own product, never for an id the page sends.
  • Turn on Require session token under Organization → Security to hold every request made with your publishable key to a token from your server.

Allowed domains

List every site that uses your key or embeds your maps under Organization → Security, including each subdomain. Remove localhost entries you only needed in development. See allowed domains.

Retries and writes

  • Wait out a 429 for the seconds Retry-After names. See rate limits.
  • Send an Idempotency-Key with every Map Studio API write, and the same key on every retry. See idempotency.
  • Check errors on every Data API answer, even under 200 OK. See errors.

Monitoring and support

Last updated