Skip to content
Maple

Core concepts

Every request carries a Bearer credential. An API key or an OAuth client sets the mode and carries the scopes your app holds.

Every request to the Developer API carries a Bearer credential in the Authorization header:

curl https://api.maple.inc/v1/me \
-H "Authorization: Bearer mpk_test_..."

A credential answers three questions at once: which app you are, which mode you are in (test or live), and which scopes you hold. Verify any credential with GET /v1/me, which returns exactly that.

All requests go to https://api.maple.inc/v1. The key’s prefix sets the mode. See Test and live modes.

API keys or OAuth clients

Both sign in as your app, never as a restaurant. Either way, the restaurants your app can reach are the ones that granted it access, and what it may do is set by its scopes.

  • An API key is a long-lived bearer secret. It is the simplest choice for a server.
  • An OAuth client trades its client ID and secret for a short-lived access token (client_credentials grant), which you send as the bearer token.

API keys

Members of your developer organization create and revoke keys in the developer console, on the Keys page of your app. No restaurant selection is needed. To add a teammate, open Team in the console and choose Invite Member. Any member can.

Key Mode Reaches
mpk_test_… Test Test restaurants
mpk_live_… Live Real restaurants

Send the key as the bearer token on every request. Keep keys server-side; never embed them in a client app or commit them to source control. Narrowing an app’s scopes takes effect immediately for its existing keys. Any app can make test keys; live keys need a certified app (see Going live).

To replace a key, create a new one, update your client, verify it works, and explicitly revoke the old key. Revocation immediately stops authentication with that key. A suspended or revoked app cannot authenticate with any of its keys, although console access still supports inspection and protective revocation.

A key does not grant restaurant access. A test restaurant you create in the console grants your app access to itself. A real restaurant gives your app access by installing it from the Maple dashboard.

Follow the Quickstart to create a key and verify the returned app and mode with /v1/me.

Scopes

Access is scoped, so your app holds only the permissions it needs:

Scope Grants
locations:read List and read granted locations
connections:read / connections:write Read or manage the location connection
orders:read / orders:write Read orders or submit order decisions
catalog:read / catalog:write Read or publish a location’s catalog
delivery_zones:read / delivery_zones:write Read a location’s delivery zones and check deliverability, or manage them (writes need an active connection)

Webhook subscriptions have no scope of their own. To subscribe to an event type, a credential needs that event’s read scope; see Subscribing.

A request missing a required scope returns 403 with code insufficient_scope. A restaurant your app has no grant for in the key’s mode answers 404; 403 with code wrong_environment is the rarer case where the grant exists but the restaurant is the other kind. See Test and live modes and Errors.

OAuth clients

Create an OAuth client on the OAuth clients tab of your app’s Keys page. You get a client ID and a secret, shown once. Like keys, a client belongs to one mode.

Exchange the client for an access token:

curl https://api.maple.inc/v1/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "'"$CLIENT_ID"'",
"client_secret": "'"$CLIENT_SECRET"'",
"scope": "orders:read catalog:read"
}'

scope is optional; it asks for fewer scopes than the client holds. The response carries access_token, token_type, expires_in (3600 seconds) and scope. Send the token as Authorization: Bearer <access_token>, and request a new one before it expires. Token requests are rate limited per client.

The token and revoke endpoints answer errors in OAuth’s own form, { "error": "invalid_client", "error_description": "…", "error_uri": "…" }, not in the error object the rest of the API uses. See OAuth endpoints.